package com.alibaba.android.arouter.utils; import android.content.Context; import android.content.SharedPreferences; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.os.Build; import android.util.Log; import com.alibaba.android.arouter.launcher.ARouter; import com.alibaba.android.arouter.thread.DefaultPoolExecutor; import java.io.File; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.concurrent.CountDownLatch; /* loaded from: classes.dex */ public class ClassUtils { private static final String a = "code_cache" + File.separator + "secondary-dexes"; private static SharedPreferences a(Context context) { return context.getSharedPreferences("multidex.version", Build.VERSION.SDK_INT < 11 ? 0 : 4); } public static List b(Context context) throws PackageManager.NameNotFoundException, IOException { ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo(context.getPackageName(), 0); File file = new File(applicationInfo.sourceDir); ArrayList arrayList = new ArrayList(); arrayList.add(applicationInfo.sourceDir); String str = file.getName() + ".classes"; if (!a()) { int i = a(context).getInt("dex.number", 1); File file2 = new File(applicationInfo.dataDir, a); for (int i2 = 2; i2 <= i; i2++) { File file3 = new File(file2, str + i2 + ".zip"); if (!file3.isFile()) { throw new IOException("Missing extracted secondary dex file '" + file3.getPath() + "'"); } arrayList.add(file3.getAbsolutePath()); } } if (ARouter.a()) { arrayList.addAll(a(applicationInfo)); } return arrayList; } public static Set a(Context context, final String str) throws PackageManager.NameNotFoundException, IOException, InterruptedException { final HashSet hashSet = new HashSet(); List b = b(context); final CountDownLatch countDownLatch = new CountDownLatch(b.size()); for (final String str2 : b) { DefaultPoolExecutor.a().execute(new Runnable() { // from class: com.alibaba.android.arouter.utils.ClassUtils.1 /* JADX WARN: Code restructure failed: missing block: B:30:0x0057, code lost: if (r0 == null) goto L20; */ @Override // java.lang.Runnable /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ public void run() { /* r4 = this; r0 = 0 java.lang.String r1 = r1 // Catch: java.lang.Throwable -> L4f java.lang.String r2 = ".zip" boolean r1 = r1.endsWith(r2) // Catch: java.lang.Throwable -> L4f if (r1 == 0) goto L26 java.lang.String r1 = r1 // Catch: java.lang.Throwable -> L4f java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L4f r2.() // Catch: java.lang.Throwable -> L4f java.lang.String r3 = r1 // Catch: java.lang.Throwable -> L4f r2.append(r3) // Catch: java.lang.Throwable -> L4f java.lang.String r3 = ".tmp" r2.append(r3) // Catch: java.lang.Throwable -> L4f java.lang.String r2 = r2.toString() // Catch: java.lang.Throwable -> L4f r3 = 0 dalvik.system.DexFile r0 = dalvik.system.DexFile.loadDex(r1, r2, r3) // Catch: java.lang.Throwable -> L4f goto L2e L26: dalvik.system.DexFile r1 = new dalvik.system.DexFile // Catch: java.lang.Throwable -> L4f java.lang.String r2 = r1 // Catch: java.lang.Throwable -> L4f r1.(r2) // Catch: java.lang.Throwable -> L4f r0 = r1 L2e: java.util.Enumeration r1 = r0.entries() // Catch: java.lang.Throwable -> L4f L32: boolean r2 = r1.hasMoreElements() // Catch: java.lang.Throwable -> L4f if (r2 == 0) goto L4c java.lang.Object r2 = r1.nextElement() // Catch: java.lang.Throwable -> L4f java.lang.String r2 = (java.lang.String) r2 // Catch: java.lang.Throwable -> L4f java.lang.String r3 = r2 // Catch: java.lang.Throwable -> L4f boolean r3 = r2.startsWith(r3) // Catch: java.lang.Throwable -> L4f if (r3 == 0) goto L32 java.util.Set r3 = r3 // Catch: java.lang.Throwable -> L4f r3.add(r2) // Catch: java.lang.Throwable -> L4f goto L32 L4c: if (r0 == 0) goto L5c goto L59 L4f: r1 = move-exception java.lang.String r2 = "ARouter" java.lang.String r3 = "Scan map file in dex files made error." android.util.Log.e(r2, r3, r1) // Catch: java.lang.Throwable -> L62 if (r0 == 0) goto L5c L59: r0.close() // Catch: java.lang.Throwable -> L5c L5c: java.util.concurrent.CountDownLatch r0 = r4 r0.countDown() return L62: r1 = move-exception if (r0 == 0) goto L68 r0.close() // Catch: java.lang.Throwable -> L68 L68: java.util.concurrent.CountDownLatch r0 = r4 r0.countDown() throw r1 */ throw new UnsupportedOperationException("Method not decompiled: com.alibaba.android.arouter.utils.ClassUtils.AnonymousClass1.run():void"); } }); } countDownLatch.await(); Log.d("ARouter::", "Filter " + hashSet.size() + " classes by packageName <" + str + ">"); return hashSet; } private static List a(ApplicationInfo applicationInfo) { String[] strArr; ArrayList arrayList = new ArrayList(); if (Build.VERSION.SDK_INT >= 21 && (strArr = applicationInfo.splitSourceDirs) != null) { arrayList.addAll(Arrays.asList(strArr)); Log.d("ARouter::", "Found InstantRun support"); } else { try { File file = new File((String) Class.forName("com.android.tools.fd.runtime.Paths").getMethod("getDexFileDirectory", String.class).invoke(null, applicationInfo.packageName)); if (file.exists() && file.isDirectory()) { for (File file2 : file.listFiles()) { if (file2 != null && file2.exists() && file2.isFile() && file2.getName().endsWith(".dex")) { arrayList.add(file2.getAbsolutePath()); } } Log.d("ARouter::", "Found InstantRun support"); } } catch (Exception e) { Log.e("ARouter::", "InstantRun support error, " + e.getMessage()); } } return arrayList; } private static boolean b() { try { String property = System.getProperty("ro.yunos.version"); String property2 = System.getProperty("java.vm.name"); if (property2 == null || !property2.toLowerCase().contains("lemur")) { if (property == null) { return false; } if (property.trim().length() <= 0) { return false; } } return true; } catch (Exception unused) { return false; } } /* JADX WARN: Code restructure failed: missing block: B:24:0x004e, code lost: if (r2 < 1) goto L24; */ /* JADX WARN: Code restructure failed: missing block: B:6:0x001b, code lost: if (java.lang.Integer.valueOf(java.lang.System.getProperty("ro.build.version.sdk")).intValue() >= 21) goto L7; */ /* JADX WARN: Removed duplicated region for block: B:11:0x0061 */ /* JADX WARN: Removed duplicated region for block: B:15:0x0064 */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ private static boolean a() { /* r0 = 0 r1 = 0 boolean r2 = b() // Catch: java.lang.Throwable -> L51 r3 = 1 if (r2 == 0) goto L1f java.lang.String r1 = "'YunOS'" java.lang.String r2 = "ro.build.version.sdk" java.lang.String r2 = java.lang.System.getProperty(r2) // Catch: java.lang.Throwable -> L51 java.lang.Integer r2 = java.lang.Integer.valueOf(r2) // Catch: java.lang.Throwable -> L51 int r2 = r2.intValue() // Catch: java.lang.Throwable -> L51 r4 = 21 if (r2 < r4) goto L52 L1d: r0 = 1 goto L52 L1f: java.lang.String r1 = "'Android'" java.lang.String r2 = "java.vm.version" java.lang.String r2 = java.lang.System.getProperty(r2) // Catch: java.lang.Throwable -> L51 if (r2 == 0) goto L52 java.lang.String r4 = "(\\d+)\\.(\\d+)(\\.\\d+)?" java.util.regex.Pattern r4 = java.util.regex.Pattern.compile(r4) // Catch: java.lang.Throwable -> L51 java.util.regex.Matcher r2 = r4.matcher(r2) // Catch: java.lang.Throwable -> L51 boolean r4 = r2.matches() // Catch: java.lang.Throwable -> L51 if (r4 == 0) goto L52 java.lang.String r4 = r2.group(r3) // Catch: java.lang.Throwable -> L51 int r4 = java.lang.Integer.parseInt(r4) // Catch: java.lang.Throwable -> L51 r5 = 2 java.lang.String r2 = r2.group(r5) // Catch: java.lang.Throwable -> L51 int r2 = java.lang.Integer.parseInt(r2) // Catch: java.lang.Throwable -> L51 if (r4 > r5) goto L1d if (r4 != r5) goto L52 if (r2 < r3) goto L52 goto L1d L51: L52: java.lang.StringBuilder r2 = new java.lang.StringBuilder r2.() java.lang.String r3 = "VM with name " r2.append(r3) r2.append(r1) if (r0 == 0) goto L64 java.lang.String r1 = " has multidex support" goto L66 L64: java.lang.String r1 = " does not have multidex support" L66: r2.append(r1) java.lang.String r1 = r2.toString() java.lang.String r2 = "ARouter::" android.util.Log.i(r2, r1) return r0 */ throw new UnsupportedOperationException("Method not decompiled: com.alibaba.android.arouter.utils.ClassUtils.a():boolean"); } }