MD5 校验值:d7f913ab91d7343430e85d5ce2e5aff0
w.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package xa; import android.content.Context; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.TimeUnit; public final class w { public static final c8.t f44721c = new c8.t("AssetPackStorage"); public final Context f44722a; public final n1 f44723b; static { TimeUnit timeUnit = TimeUnit.DAYS; timeUnit.toMillis(14L); timeUnit.toMillis(28L); } public w(Context context, n1 n1Var) { this.f44722a = context; this.f44723b = n1Var; } public static long d(File file, boolean z10) { if (!file.exists()) { return -1L; } ArrayList arrayList = new ArrayList(); if (z10 && file.listFiles().length > 1) { f44721c.e("Multiple pack versions found, using highest version code.", new Object[0]); } try { for (File file2 : file.listFiles()) { if (!file2.getName().equals("stale.tmp")) { arrayList.add(Long.valueOf(file2.getName())); } } } catch (NumberFormatException e10) { f44721c.c(e10, "Corrupt asset pack directories.", new Object[0]); } if (arrayList.isEmpty()) { return -1L; } Collections.sort(arrayList); return ((Long) arrayList.get(arrayList.size() - 1)).longValue(); } public static void i(File file) { if (file.listFiles() == null || file.listFiles().length <= 1) { return; } long d10 = d(file, false); for (File file2 : file.listFiles()) { if (!file2.getName().equals(String.valueOf(d10)) && !file2.getName().equals("stale.tmp")) { j(file2); } } } public static boolean j(File file) { File[] listFiles = file.listFiles(); boolean z10 = true; if (listFiles != null) { for (File file2 : listFiles) { z10 &= j(file2); } } if (file.delete()) { return z10; } return false; } public final void a(String str, int i10, long j10, int i11) { File file = new File(p(str, i10, j10), "merge.tmp"); Properties properties = new Properties(); properties.put("numberOfMerges", String.valueOf(i11)); file.getParentFile().mkdirs(); file.createNewFile(); FileOutputStream fileOutputStream = new FileOutputStream(file); properties.store(fileOutputStream, (String) null); fileOutputStream.close(); } public final void b(String str, int i10, long j10) { File e10 = e(str); if (e10.exists()) { for (File file : e10.listFiles()) { if (!file.getName().equals(String.valueOf(i10)) && !file.getName().equals("stale.tmp")) { j(file); } else if (file.getName().equals(String.valueOf(i10))) { for (File file2 : file.listFiles()) { if (!file2.getName().equals(String.valueOf(j10))) { j(file2); } } } } } } public final boolean c(String str, int i10, long j10) { if (f(str, i10, j10).exists()) { return j(f(str, i10, j10)); } return true; } public final File e(String str) { return new File(g(), str); } public final File f(String str, int i10, long j10) { return new File(new File(new File(new File(g(), "_tmp"), str), String.valueOf(i10)), String.valueOf(j10)); } public final File g() { return new File(this.f44722a.getFilesDir(), "assetpacks"); } public final List h() { ArrayList arrayList = new ArrayList(); try { } catch (IOException e10) { f44721c.b("Could not process directory while scanning installed packs. %s", e10); } if (g().exists() && g().listFiles() != null) { for (File file : g().listFiles()) { if (!file.getCanonicalPath().equals(new File(g(), "_tmp").getCanonicalPath())) { arrayList.add(file); } } return arrayList; } return arrayList; } public final int k(String str, int i10, long j10) { File file = new File(p(str, i10, j10), "merge.tmp"); if (!file.exists()) { return 0; } Properties properties = new Properties(); FileInputStream fileInputStream = new FileInputStream(file); try { properties.load(fileInputStream); fileInputStream.close(); if (properties.getProperty("numberOfMerges") == null) { throw new p0("Merge checkpoint file corrupt."); } try { return Integer.parseInt(properties.getProperty("numberOfMerges")); } catch (NumberFormatException e10) { throw new p0("Merge checkpoint file corrupt.", e10); } } catch (Throwable th2) { try { fileInputStream.close(); } catch (Throwable unused) { } throw th2; } } public final long l(String str) { return d(m(str, (int) d(e(str), true)), true); } public final File m(String str, int i10) { return new File(e(str), String.valueOf(i10)); } public final File n(String str, int i10, long j10) { return new File(m(str, i10), String.valueOf(j10)); } public final File o(String str, int i10, long j10) { return new File(n(str, i10, j10), "_metadata"); } public final File p(String str, int i10, long j10) { return new File(f(str, i10, j10), "_packs"); } public final File q(String str, int i10, long j10, String str2) { return new File(r(str, i10, j10, str2), "checkpoint.dat"); } public final File r(String str, int i10, long j10, String str2) { return new File(new File(new File(f(str, i10, j10), "_slices"), "_metadata"), str2); } public final File s(String str, int i10, long j10, String str2) { return new File(new File(new File(f(str, i10, j10), "_slices"), "_unverified"), str2); } public final File t(String str, int i10, long j10, String str2) { return new File(new File(new File(f(str, i10, j10), "_slices"), "_verified"), str2); } public final String u(String str) { int length; File file = new File(g(), str); if (!file.exists()) { f44721c.a("Pack not found with pack name: %s", str); return null; } File file2 = new File(file, String.valueOf(this.f44723b.a())); if (!file2.exists()) { f44721c.a("Pack not found with pack name: %s app version: %s", str, Integer.valueOf(this.f44723b.a())); return null; } File[] listFiles = file2.listFiles(); if (listFiles == null || (length = listFiles.length) == 0) { f44721c.a("No pack version found for pack name: %s app version: %s", str, Integer.valueOf(this.f44723b.a())); return null; } if (length <= 1) { return listFiles[0].getCanonicalPath(); } f44721c.b("Multiple pack versions found for pack name: %s app version: %s", str, Integer.valueOf(this.f44723b.a())); return null; } public final Map v() { HashMap hashMap = new HashMap(); Iterator it = ((ArrayList) h()).iterator(); while (it.hasNext()) { String name = ((File) it.next()).getName(); int d10 = (int) d(e(name), true); long d11 = d(m(name, d10), true); if (n(name, d10, d11).exists()) { hashMap.put(name, Long.valueOf(d11)); } } return hashMap; } }