package com.google.android.gms.internal.measurement; import android.content.Context; import android.net.Uri; import android.os.Build; import android.os.StrictMode; import android.util.Log; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Collection; import java.util.HashMap; import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; /* loaded from: classes.dex */ public abstract class zzhu { public static final int zzc = 0; private static volatile zzhs zze = null; private static volatile boolean zzf = false; final zzhr zza; final String zzb; private final T zzj; private volatile int zzk = -1; private volatile T zzl; private final boolean zzm; private static final Object zzd = new Object(); private static final AtomicReference>> zzg = new AtomicReference<>(); private static final zzhw zzh = new zzhw(new Object() { // from class: com.google.android.gms.internal.measurement.zzhl }, null); private static final AtomicInteger zzi = new AtomicInteger(); /* JADX INFO: Access modifiers changed from: package-private */ /* JADX WARN: Multi-variable type inference failed */ public /* synthetic */ zzhu(zzhr zzhrVar, String str, Object obj, boolean z, zzht zzhtVar) { if (zzhrVar.zzb == null) { throw new IllegalArgumentException("Must pass a valid SharedPreferences file name or ContentProvider URI"); } this.zza = zzhrVar; this.zzb = str; this.zzj = obj; this.zzm = true; } @Deprecated public static void zzd(final Context context) { synchronized (zzd) { zzhs zzhsVar = zze; Context applicationContext = context.getApplicationContext(); if (applicationContext != null) { context = applicationContext; } if (zzhsVar == null || zzhsVar.zza() != context) { zzha.zze(); zzhv.zzc(); zzhh.zze(); zze = new zzgx(context, zzif.zza(new zzib(context) { // from class: com.google.android.gms.internal.measurement.zzhm public final Context zza; @Override // com.google.android.gms.internal.measurement.zzib public final Object zza() { zzhz zzc2; zzhz zzc3; Context context2 = this.zza; int i = zzhu.zzc; String str = Build.TYPE; String str2 = Build.TAGS; if ((!str.equals("eng") && !str.equals("userdebug")) || (!str2.contains("dev-keys") && !str2.contains("test-keys"))) { return zzhz.zzc(); } if (zzgw.zza() && !context2.isDeviceProtectedStorage()) { context2 = context2.createDeviceProtectedStorageContext(); } StrictMode.ThreadPolicy allowThreadDiskReads = StrictMode.allowThreadDiskReads(); try { StrictMode.allowThreadDiskWrites(); try { File file = new File(context2.getDir("phenotype_hermetic", 0), "overrides.txt"); zzc2 = file.exists() ? zzhz.zzd(file) : zzhz.zzc(); } catch (RuntimeException e) { Log.e("HermeticFileOverrides", "no data dir", e); zzc2 = zzhz.zzc(); } if (zzc2.zzb()) { File file2 = (File) zzc2.zza(); try { BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file2))); try { HashMap hashMap = new HashMap(); HashMap hashMap2 = new HashMap(); while (true) { String readLine = bufferedReader.readLine(); if (readLine == null) { break; } String[] split = readLine.split(" ", 3); if (split.length != 3) { Log.e("HermeticFileOverrides", readLine.length() != 0 ? "Invalid: ".concat(readLine) : new String("Invalid: ")); } else { String str3 = new String(split[0]); String decode = Uri.decode(new String(split[1])); String str4 = (String) hashMap2.get(split[2]); if (str4 == null) { String str5 = new String(split[2]); str4 = Uri.decode(str5); if (str4.length() < 1024 || str4 == str5) { hashMap2.put(str5, str4); } } if (!hashMap.containsKey(str3)) { hashMap.put(str3, new HashMap()); } ((Map) hashMap.get(str3)).put(decode, str4); } } String obj = file2.toString(); StringBuilder sb = new StringBuilder(obj.length() + 7); sb.append("Parsed "); sb.append(obj); Log.i("HermeticFileOverrides", sb.toString()); zzhi zzhiVar = new zzhi(hashMap); bufferedReader.close(); zzc3 = zzhz.zzd(zzhiVar); } catch (Throwable th) { try { bufferedReader.close(); } catch (Throwable unused) { } throw th; } } catch (IOException e2) { throw new RuntimeException(e2); } } else { zzc3 = zzhz.zzc(); } return zzc3; } finally { StrictMode.setThreadPolicy(allowThreadDiskReads); } } { this.zza = context; } })); zzi.incrementAndGet(); } } } /* JADX INFO: Access modifiers changed from: package-private */ public static void zze() { zzi.incrementAndGet(); } abstract T zza(Object obj); public final String zzc() { String str = this.zza.zzd; return this.zzb; } /* JADX WARN: Removed duplicated region for block: B:29:0x00bd */ /* JADX WARN: Removed duplicated region for block: B:32:0x00fa A[Catch: all -> 0x0126, TryCatch #0 {, blocks: (B:12:0x001c, B:14:0x0020, B:16:0x0024, B:18:0x003b, B:20:0x0047, B:22:0x0050, B:24:0x005e, B:25:0x006c, B:26:0x0065, B:30:0x00ea, B:32:0x00fa, B:34:0x0110, B:35:0x0113, B:36:0x0117, B:37:0x00be, B:39:0x00c4, B:42:0x00da, B:44:0x00e0, B:46:0x00e8, B:47:0x00d6, B:49:0x0072, B:51:0x0078, B:53:0x0086, B:55:0x00ab, B:57:0x00b5, B:59:0x009d, B:60:0x011c, B:61:0x0123, B:62:0x0124), top: B:11:0x001c }] */ /* JADX WARN: Removed duplicated region for block: B:37:0x00be A[Catch: all -> 0x0126, TryCatch #0 {, blocks: (B:12:0x001c, B:14:0x0020, B:16:0x0024, B:18:0x003b, B:20:0x0047, B:22:0x0050, B:24:0x005e, B:25:0x006c, B:26:0x0065, B:30:0x00ea, B:32:0x00fa, B:34:0x0110, B:35:0x0113, B:36:0x0117, B:37:0x00be, B:39:0x00c4, B:42:0x00da, B:44:0x00e0, B:46:0x00e8, B:47:0x00d6, B:49:0x0072, B:51:0x0078, B:53:0x0086, B:55:0x00ab, B:57:0x00b5, B:59:0x009d, B:60:0x011c, B:61:0x0123, B:62:0x0124), top: B:11:0x001c }] */ /* JADX WARN: Removed duplicated region for block: B:46:0x00e8 A[Catch: all -> 0x0126, TryCatch #0 {, blocks: (B:12:0x001c, B:14:0x0020, B:16:0x0024, B:18:0x003b, B:20:0x0047, B:22:0x0050, B:24:0x005e, B:25:0x006c, B:26:0x0065, B:30:0x00ea, B:32:0x00fa, B:34:0x0110, B:35:0x0113, B:36:0x0117, B:37:0x00be, B:39:0x00c4, B:42:0x00da, B:44:0x00e0, B:46:0x00e8, B:47:0x00d6, B:49:0x0072, B:51:0x0078, B:53:0x0086, B:55:0x00ab, B:57:0x00b5, B:59:0x009d, B:60:0x011c, B:61:0x0123, B:62:0x0124), top: B:11:0x001c }] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final T zzb() { /* Method dump skipped, instructions count: 300 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.measurement.zzhu.zzb():java.lang.Object"); } }