package com.google.android.play.core.assetpacks; import java.io.File; import java.io.IOException; import java.security.NoSuchAlgorithmException; /* loaded from: classes2.dex */ final class f3 { /* renamed from: b, reason: collision with root package name */ private static final r3.h0 f4875b = new r3.h0("VerifySliceTaskHandler"); /* renamed from: a, reason: collision with root package name */ private final e0 f4876a; f3(e0 e0Var) { this.f4876a = e0Var; } private final void b(e3 e3Var, File file) { try { File A = this.f4876a.A(e3Var.f5165b, e3Var.f4854c, e3Var.f4855d, e3Var.f4856e); if (!A.exists()) { throw new d1(String.format("Cannot find metadata files for slice %s.", e3Var.f4856e), e3Var.f5164a); } try { if (!f2.a(d3.a(file, A)).equals(e3Var.f4857f)) { throw new d1(String.format("Verification failed for slice %s.", e3Var.f4856e), e3Var.f5164a); } f4875b.d("Verification of slice %s of pack %s successful.", e3Var.f4856e, e3Var.f5165b); } catch (IOException e10) { throw new d1(String.format("Could not digest file during verification for slice %s.", e3Var.f4856e), e10, e3Var.f5164a); } catch (NoSuchAlgorithmException e11) { throw new d1("SHA256 algorithm not supported.", e11, e3Var.f5164a); } } catch (IOException e12) { throw new d1(String.format("Could not reconstruct slice archive during verification for slice %s.", e3Var.f4856e), e12, e3Var.f5164a); } } public final void a(e3 e3Var) { File B = this.f4876a.B(e3Var.f5165b, e3Var.f4854c, e3Var.f4855d, e3Var.f4856e); if (!B.exists()) { throw new d1(String.format("Cannot find unverified files for slice %s.", e3Var.f4856e), e3Var.f5164a); } b(e3Var, B); File C = this.f4876a.C(e3Var.f5165b, e3Var.f4854c, e3Var.f4855d, e3Var.f4856e); if (!C.exists()) { C.mkdirs(); } if (!B.renameTo(C)) { throw new d1(String.format("Failed to move slice %s after verification.", e3Var.f4856e), e3Var.f5164a); } } }