package com.google.android.play.core.assetpacks; import java.io.File; import java.io.IOException; import java.util.concurrent.Executor; /* loaded from: classes2.dex */ final class m2 { /* renamed from: a, reason: collision with root package name */ private final e0 f4984a; /* renamed from: b, reason: collision with root package name */ private final w1 f4985b; /* renamed from: c, reason: collision with root package name */ private final h1 f4986c; /* renamed from: d, reason: collision with root package name */ private final p2 f4987d; /* renamed from: e, reason: collision with root package name */ private final r3.o f4988e; /* renamed from: f, reason: collision with root package name */ private final r3.o f4989f; m2(e0 e0Var, r3.o oVar, w1 w1Var, r3.o oVar2, h1 h1Var, p2 p2Var) { this.f4984a = e0Var; this.f4988e = oVar; this.f4985b = w1Var; this.f4989f = oVar2; this.f4986c = h1Var; this.f4987d = p2Var; } public final void a(final k2 k2Var) { e0 e0Var = this.f4984a; String str = k2Var.f5165b; int i10 = k2Var.f4942c; long j10 = k2Var.f4943d; File v10 = e0Var.v(str, i10, j10); File x10 = e0Var.x(str, i10, j10); if (!v10.exists() || !x10.exists()) { throw new d1(String.format("Cannot find pack files to move for pack %s.", k2Var.f5165b), k2Var.f5164a); } File t10 = this.f4984a.t(k2Var.f5165b, k2Var.f4942c, k2Var.f4943d); t10.mkdirs(); if (!v10.renameTo(t10)) { throw new d1("Cannot move merged pack files to final location.", k2Var.f5164a); } new File(this.f4984a.t(k2Var.f5165b, k2Var.f4942c, k2Var.f4943d), "merge.tmp").delete(); File u10 = this.f4984a.u(k2Var.f5165b, k2Var.f4942c, k2Var.f4943d); u10.mkdirs(); if (!x10.renameTo(u10)) { throw new d1("Cannot move metadata files to final location.", k2Var.f5164a); } try { this.f4987d.b(k2Var.f5165b, k2Var.f4942c, k2Var.f4943d, k2Var.f4944e); ((Executor) this.f4989f.a()).execute(new Runnable() { // from class: com.google.android.play.core.assetpacks.l2 @Override // java.lang.Runnable public final void run() { m2.this.b(k2Var); } }); this.f4985b.i(k2Var.f5165b, k2Var.f4942c, k2Var.f4943d); this.f4986c.c(k2Var.f5165b); ((t3) this.f4988e.a()).b(k2Var.f5164a, k2Var.f5165b); } catch (IOException e10) { throw new d1(String.format("Could not write asset pack version tag for pack %s: %s", k2Var.f5165b, e10.getMessage()), k2Var.f5164a); } } final /* synthetic */ void b(k2 k2Var) { this.f4984a.b(k2Var.f5165b, k2Var.f4942c, k2Var.f4943d); } }