package X; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.os.RemoteException; import android.text.TextUtils; import com.bytedance.covode.number.Covode; import com.google.android.gms.measurement.internal.zzan; import com.google.android.gms.measurement.internal.zzao; import com.google.android.gms.measurement.internal.zzkr; import com.google.android.gms.measurement.internal.zzw; import com.kakao.usermgmt.StringSet; import com.swift.sandhook.utils.FileUtils; import java.io.ByteArrayInputStream; import java.math.BigInteger; import java.net.MalformedURLException; import java.net.URL; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Random; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicLong; import javax.security.auth.x500.X500Principal; /* renamed from: X.Fpu reason: case insensitive filesystem */ public final class C40161Fpu extends AbstractC40286Frv { public static final String[] LIZ = {"firebase_", "google_", "ga_"}; public static final String[] LIZIZ = {"_err"}; public SecureRandom LIZJ; public final AtomicLong LIZLLL = new AtomicLong(0); public int LJ; public Integer LJFF; static { Covode.recordClassIndex(37247); } public C40161Fpu(C40167Fq0 fq0) { super(fq0); } /* JADX WARNING: Removed duplicated region for block: B:39:0x00ac A[RETURN] */ /* JADX WARNING: Removed duplicated region for block: B:41:0x00b0 */ private final int LIZ(String str, String str2, String str3, Object obj, Bundle bundle, List<String> list, boolean z, boolean z2) { int i2; LIZJ(); C65212Piz.LIZIZ(); if (LJIJ().LIZ(C65111PhM.LJLJLJ)) { if (LIZ(obj)) { if (!z2) { return 21; } if (!LIZ(str3, C40184FqH.LIZJ)) { return 20; } if (!this.LJJIFFI.LJIIIIZZ().LJJIJIIJIL()) { return 25; } if (!LIZIZ("param", str3, 200, obj)) { if (obj instanceof Parcelable[]) { Parcelable[] parcelableArr = (Parcelable[]) obj; if (parcelableArr.length > 200) { bundle.putParcelableArray(str3, (Parcelable[]) Arrays.copyOf(parcelableArr, 200)); } } else if (obj instanceof ArrayList) { ArrayList arrayList = (ArrayList) obj; if (arrayList.size() > 200) { bundle.putParcelableArrayList(str3, new ArrayList<>(arrayList.subList(0, 200))); } } i2 = 17; if (!LIZ("param", str3, ((LJIJ().LIZLLL(str, C65111PhM.LJJJJ) || !LJ(str2)) && !LJ(str3)) ? 100 : 256, obj)) { return i2; } if (!z2) { return 4; } C65212Piz.LIZIZ(); boolean LIZ2 = LJIJ().LIZ(C65111PhM.LJLJL); if (obj instanceof Bundle) { if (LIZ2) { LIZ(str, str2, str3, (Bundle) obj, list, z); } } else if (obj instanceof Parcelable[]) { Parcelable[] parcelableArr2 = (Parcelable[]) obj; for (Parcelable parcelable : parcelableArr2) { if (!(parcelable instanceof Bundle)) { LJIILLIIL().LJII.LIZ("All Parcelable[] elements must be of type Bundle. Value type, name", parcelable.getClass(), str3); return 4; } if (LIZ2) { LIZ(str, str2, str3, (Bundle) parcelable, list, z); } } } else if (!(obj instanceof ArrayList)) { return 4; } else { ArrayList arrayList2 = (ArrayList) obj; int size = arrayList2.size(); int i3 = 0; while (i3 < size) { Object obj2 = arrayList2.get(i3); i3++; if (!(obj2 instanceof Bundle)) { LJIILLIIL().LJII.LIZ("All ArrayList elements must be of type Bundle. Value type, name", obj2.getClass(), str3); return 4; } else if (LIZ2) { LIZ(str, str2, str3, (Bundle) obj2, list, z); } } } return i2; } } } else if (z2 && !LIZIZ("param", str3, 1000, obj)) { return 17; } i2 = 0; if (!LIZ("param", str3, ((LJIJ().LIZLLL(str, C65111PhM.LJJJJ) || !LJ(str2)) && !LJ(str3)) ? 100 : 256, obj)) { } } public static long LIZ(long j, long j2) { return (j + (j2 * 60000)) / 86400000; } public static long LIZ(zzan zzan) { long j = 0; if (zzan == null) { return 0; } Iterator<String> it = zzan.iterator(); while (it.hasNext()) { Object LIZ2 = zzan.LIZ(it.next()); if (LIZ2 instanceof Parcelable[]) { j += (long) ((Parcelable[]) LIZ2).length; } } return j; } public static long LIZ(byte[] bArr) { F6B.LIZ(bArr); int i2 = 0; F6B.LIZ(bArr.length > 0); long j = 0; int length = bArr.length - 1; while (length >= 0 && length >= bArr.length - 8) { j += (((long) bArr[length]) & 255) << i2; i2 += 8; length--; } return j; } public static Bundle LIZ(List<zzkr> list) { Bundle bundle = new Bundle(); if (list == null) { return bundle; } for (zzkr zzkr : list) { if (zzkr.LIZLLL != null) { bundle.putString(zzkr.LIZ, zzkr.LIZLLL); } else if (zzkr.LIZJ != null) { bundle.putLong(zzkr.LIZ, zzkr.LIZJ.longValue()); } else if (zzkr.LJFF != null) { bundle.putDouble(zzkr.LIZ, zzkr.LJFF.doubleValue()); } } return bundle; } private final Object LIZ(int i2, Object obj, boolean z, boolean z2) { if (obj == null) { return null; } if ((obj instanceof Long) || (obj instanceof Double)) { return obj; } if (obj instanceof Integer) { return Long.valueOf((long) ((Integer) obj).intValue()); } if (obj instanceof Byte) { return Long.valueOf((long) ((Byte) obj).byteValue()); } if (obj instanceof Short) { return Long.valueOf((long) ((Short) obj).shortValue()); } if (obj instanceof Boolean) { return Long.valueOf(((Boolean) obj).booleanValue() ? 1 : 0); } else if (obj instanceof Float) { return Double.valueOf(((Float) obj).doubleValue()); } else { if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) { return LIZ(String.valueOf(obj), i2, z); } C65212Piz.LIZIZ(); if (!LJIJ().LIZ(C65111PhM.LJLJL) || !LJIJ().LIZ(C65111PhM.LJLJJLL) || !z2 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) { return null; } ArrayList arrayList = new ArrayList(); Parcelable[] parcelableArr = (Parcelable[]) obj; for (Parcelable parcelable : parcelableArr) { if (parcelable instanceof Bundle) { Bundle LIZ2 = LIZ((Bundle) parcelable); if (!LIZ2.isEmpty()) { arrayList.add(LIZ2); } } } return arrayList.toArray(new Bundle[arrayList.size()]); } } public static Object LIZ(Bundle bundle, String str) { try { return bundle.get(str); } catch (Exception | OutOfMemoryError unused) { return null; } } public static String LIZ(Intent intent, String str) { try { return intent.getStringExtra(str); } catch (Exception unused) { return null; } } public static String LIZ(String str, int i2, boolean z) { if (str == null) { return null; } if (str.codePointCount(0, str.length()) <= i2) { return str; } if (z) { return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i2))).concat("..."); } return null; } public static void LIZ(Bundle bundle, int i2, String str, Object obj) { if (LIZIZ(bundle, i2)) { bundle.putString("_ev", LIZ(str, 40, true)); if (obj != null) { F6B.LIZ(bundle); if (obj == null) { return; } if ((obj instanceof String) || (obj instanceof CharSequence)) { bundle.putLong("_el", (long) String.valueOf(obj).length()); } } } } /* JADX WARNING: Code restructure failed: missing block: B:30:0x0098, code lost: if (r2 != 0) goto L_0x0070; */ private final void LIZ(String str, String str2, String str3, Bundle bundle, List<String> list, boolean z) { int LIZ2; int i2; if (bundle != null) { boolean LIZ3 = LJIJ().LIZ(C65111PhM.LJLJLJ); int LIZLLL2 = LIZ3 ? 0 : LJIJ().LIZLLL(); int i3 = 0; for (String str4 : new TreeSet(bundle.keySet())) { if (list == null || !list.contains(str4)) { if (!z || (i2 = LJII(str4)) == 0) { i2 = LJIIIIZZ(str4); } if (i2 != 0) { LIZ(bundle, i2, str4, i2 == 3 ? str4 : null); bundle.remove(str4); } } if (LIZ(LIZ(bundle, str4))) { LJIILLIIL().LJII.LIZ("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str2, str3, str4); LIZ2 = 22; } else { LIZ2 = LIZ(str, str2, str4, LIZ(bundle, str4), bundle, list, z, false); } if (!"_ev".equals(str4)) { LIZ(bundle, LIZ2, str4, LIZ(bundle, str4)); bundle.remove(str4); } if (LIZ(str4) && ((!LIZ3 || !LIZ(str4, C40184FqH.LIZLLL)) && (i3 = i3 + 1) > LIZLLL2)) { LJIILLIIL().LJ.LIZ(LIZ3 ? "Item cannot contain custom parameters" : new StringBuilder(63).append("Child bundles can't contain more than ").append(LIZLLL2).append(" custom params").toString(), LJIILIIL().LIZ(str2), LJIILIIL().LIZ(bundle)); LIZIZ(bundle, LIZ3 ? 23 : 5); bundle.remove(str4); } } } } public static boolean LIZ(Context context) { F6B.LIZ(context); return Build.VERSION.SDK_INT >= 24 ? LIZIZ(context, "com.google.android.gms.measurement.AppMeasurementJobService") : LIZIZ(context, "com.google.android.gms.measurement.AppMeasurementService"); } public static boolean LIZ(Bundle bundle, int i2) { int i3 = 0; if (bundle.size() <= i2) { return false; } for (String str : new TreeSet(bundle.keySet())) { i3++; if (i3 > i2) { bundle.remove(str); } } return true; } public static boolean LIZ(Object obj) { return (obj instanceof Parcelable[]) || (obj instanceof ArrayList) || (obj instanceof Bundle); } public static boolean LIZ(String str) { F6B.LIZ(str); return str.charAt(0) != '_' || str.equals("_ep"); } public static boolean LIZ(String str, String str2, String str3, String str4) { boolean isEmpty = TextUtils.isEmpty(str); boolean isEmpty2 = TextUtils.isEmpty(str2); if (!isEmpty && !isEmpty2) { return !str.equals(str2); } if (isEmpty && isEmpty2) { return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4); } if (isEmpty || !isEmpty2) { return TextUtils.isEmpty(str3) || !str3.equals(str4); } if (TextUtils.isEmpty(str4)) { return false; } return TextUtils.isEmpty(str3) || !str3.equals(str4); } public static boolean LIZ(String str, String[] strArr) { F6B.LIZ(strArr); for (String str2 : strArr) { if (LIZJ(str, str2)) { return true; } } return false; } public static byte[] LIZ(Parcelable parcelable) { if (parcelable == null) { return null; } Parcel obtain = Parcel.obtain(); try { parcelable.writeToParcel(obtain, 0); return obtain.marshall(); } finally { obtain.recycle(); } } public static Bundle LIZIZ(Bundle bundle) { if (bundle == null) { return new Bundle(); } Bundle bundle2 = new Bundle(bundle); for (String str : bundle2.keySet()) { Object LIZ2 = LIZ(bundle2, str); if (LIZ2 instanceof Bundle) { bundle2.putBundle(str, new Bundle((Bundle) LIZ2)); } else { int i2 = 0; if (LIZ2 instanceof Parcelable[]) { Parcelable[] parcelableArr = (Parcelable[]) LIZ2; while (i2 < parcelableArr.length) { if (parcelableArr[i2] instanceof Bundle) { parcelableArr[i2] = new Bundle((Bundle) parcelableArr[i2]); } i2++; } } else if (LIZ2 instanceof List) { List list = (List) LIZ2; while (i2 < list.size()) { Object obj = list.get(i2); if (obj instanceof Bundle) { list.set(i2, new Bundle((Bundle) obj)); } i2++; } } } } return bundle2; } public static ArrayList<Bundle> LIZIZ(List<zzw> list) { if (list == null) { return new ArrayList<>(0); } ArrayList<Bundle> arrayList = new ArrayList<>(list.size()); for (zzw zzw : list) { Bundle bundle = new Bundle(); bundle.putString("app_id", zzw.LIZ); bundle.putString("origin", zzw.LIZIZ); bundle.putLong("creation_timestamp", zzw.LIZLLL); bundle.putString(StringSet.name, zzw.LIZJ.LIZ); C534428v.LIZ(bundle, zzw.LIZJ.LIZ()); bundle.putBoolean("active", zzw.LJ); if (zzw.LJFF != null) { bundle.putString("trigger_event_name", zzw.LJFF); } if (zzw.LJI != null) { bundle.putString("timed_out_event_name", zzw.LJI.LIZ); if (zzw.LJI.LIZIZ != null) { bundle.putBundle("timed_out_event_params", zzw.LJI.LIZIZ.LIZ()); } } bundle.putLong("trigger_timeout", zzw.LJII); if (zzw.LJIIIIZZ != null) { bundle.putString("triggered_event_name", zzw.LJIIIIZZ.LIZ); if (zzw.LJIIIIZZ.LIZIZ != null) { bundle.putBundle("triggered_event_params", zzw.LJIIIIZZ.LIZIZ.LIZ()); } } bundle.putLong("triggered_timestamp", zzw.LIZJ.LIZIZ); bundle.putLong("time_to_live", zzw.LJIIIZ); if (zzw.LJIIJ != null) { bundle.putString("expired_event_name", zzw.LJIIJ.LIZ); if (zzw.LJIIJ.LIZIZ != null) { bundle.putBundle("expired_event_params", zzw.LJIIJ.LIZIZ.LIZ()); } } arrayList.add(bundle); } return arrayList; } public static boolean LIZIZ(Context context, String str) { ServiceInfo serviceInfo; try { PackageManager packageManager = context.getPackageManager(); return (packageManager == null || (serviceInfo = packageManager.getServiceInfo(new ComponentName(context, str), 0)) == null || !serviceInfo.enabled) ? false : true; } catch (PackageManager.NameNotFoundException unused) { } } public static boolean LIZIZ(Bundle bundle, int i2) { if (bundle == null || bundle.getLong("_err") != 0) { return false; } bundle.putLong("_err", (long) i2); return true; } private final boolean LIZIZ(String str, String str2, int i2, Object obj) { int size; if (obj instanceof Parcelable[]) { size = ((Parcelable[]) obj).length; } else { if (obj instanceof ArrayList) { size = ((ArrayList) obj).size(); } return true; } if (size > i2) { LJIILLIIL().LJII.LIZ("Parameter array is too long; discarded. Value kind, name, array length", str, str2, Integer.valueOf(size)); return false; } return true; } /* JADX DEBUG: Multi-variable search result rejected for r1v1, resolved type: android.os.Bundle[] */ /* JADX WARN: Multi-variable type inference failed */ public static Bundle[] LIZIZ(Object obj) { if (obj instanceof Bundle) { return new Bundle[]{obj}; } else if (obj instanceof Parcelable[]) { Parcelable[] parcelableArr = (Parcelable[]) obj; return (Bundle[]) Arrays.copyOf(parcelableArr, parcelableArr.length, Bundle[].class); } else if (!(obj instanceof ArrayList)) { return null; } else { ArrayList arrayList = (ArrayList) obj; return (Bundle[]) arrayList.toArray(new Bundle[arrayList.size()]); } } private final boolean LIZJ(Context context, String str) { X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US"); try { PackageInfo LIZIZ2 = C38327F3k.LIZ.LIZ(context).LIZIZ(str, 64); if (!(LIZIZ2 == null || LIZIZ2.signatures == null || LIZIZ2.signatures.length <= 0)) { return ((X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(LIZIZ2.signatures[0].toByteArray()))).getSubjectX500Principal().equals(x500Principal); } } catch (CertificateException e) { LJIILLIIL().LIZJ.LIZ("Error obtaining certificate", e); } catch (PackageManager.NameNotFoundException e2) { LJIILLIIL().LIZJ.LIZ("Package name not found", e2); } return true; } public static boolean LIZJ(String str, String str2) { if (str == null && str2 == null) { return true; } if (str == null) { return false; } return str.equals(str2); } public static boolean LJ(String str) { return !TextUtils.isEmpty(str) && str.startsWith("_"); } public static boolean LJI(String str) { for (String str2 : LIZIZ) { if (str2.equals(str)) { return false; } } return true; } private final int LJII(String str) { if (!LIZ("event param", str)) { return 3; } if (!LIZ("event param", (String[]) null, str)) { return 14; } return !LIZ("event param", 40, str) ? 3 : 0; } public static MessageDigest LJII() { for (int i2 = 0; i2 < 2; i2++) { try { MessageDigest instance = MessageDigest.getInstance("MD5"); if (instance != null) { return instance; } } catch (NoSuchAlgorithmException unused) { } } return null; } private final int LJIIIIZZ(String str) { if (!LIZIZ("event param", str)) { return 3; } if (!LIZ("event param", (String[]) null, str)) { return 14; } return !LIZ("event param", 40, str) ? 3 : 0; } public static boolean LJIIIZ(String str) { F6B.LIZ((Object) str); return str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$"); } private final int LJIIJ(String str) { if ("_ldl".equals(str)) { return FileUtils.FileMode.MODE_ISUID; } if ("_id".equals(str)) { return 256; } return (!LJIJ().LIZ(C65111PhM.LJJLIIIJJIZ) || !"_lgclid".equals(str)) ? 36 : 100; } public final long LIZ(Context context, String str) { LIZJ(); F6B.LIZ(context); F6B.LIZ(str); PackageManager packageManager = context.getPackageManager(); MessageDigest LJII = LJII(); if (LJII == null) { LJIILLIIL().LIZJ.LIZ("Could not get MD5 instance"); return -1; } if (packageManager != null) { try { if (!LIZJ(context, str)) { PackageInfo LIZIZ2 = C38327F3k.LIZ.LIZ(context).LIZIZ(LJIIL().getPackageName(), 64); if (LIZIZ2.signatures != null && LIZIZ2.signatures.length > 0) { return LIZ(LJII.digest(LIZIZ2.signatures[0].toByteArray())); } LJIILLIIL().LJFF.LIZ("Could not get signatures"); return -1; } } catch (PackageManager.NameNotFoundException e) { LJIILLIIL().LIZJ.LIZ("Package name not found", e); } } return 0; } public final Bundle LIZ(Uri uri) { String str; String str2; String str3; String str4; if (uri == null) { return null; } try { if (uri.isHierarchical()) { str = uri.getQueryParameter("utm_campaign"); str2 = uri.getQueryParameter("utm_source"); str3 = uri.getQueryParameter("utm_medium"); str4 = uri.getQueryParameter("gclid"); } else { str = null; str2 = null; str3 = null; str4 = null; } if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4)) { return null; } Bundle bundle = new Bundle(); if (!TextUtils.isEmpty(str)) { bundle.putString("campaign", str); } if (!TextUtils.isEmpty(str2)) { bundle.putString("source", str2); } if (!TextUtils.isEmpty(str3)) { bundle.putString("medium", str3); } if (!TextUtils.isEmpty(str4)) { bundle.putString("gclid", str4); } String queryParameter = uri.getQueryParameter("utm_term"); if (!TextUtils.isEmpty(queryParameter)) { bundle.putString("term", queryParameter); } String queryParameter2 = uri.getQueryParameter("utm_content"); if (!TextUtils.isEmpty(queryParameter2)) { bundle.putString("content", queryParameter2); } String queryParameter3 = uri.getQueryParameter("aclid"); if (!TextUtils.isEmpty(queryParameter3)) { bundle.putString("aclid", queryParameter3); } String queryParameter4 = uri.getQueryParameter("cp1"); if (!TextUtils.isEmpty(queryParameter4)) { bundle.putString("cp1", queryParameter4); } String queryParameter5 = uri.getQueryParameter("anid"); if (!TextUtils.isEmpty(queryParameter5)) { bundle.putString("anid", queryParameter5); } return bundle; } catch (UnsupportedOperationException e) { LJIILLIIL().LJFF.LIZ("Install referrer url isn't a hierarchical URI", e); return null; } } public final Bundle LIZ(Bundle bundle) { Bundle bundle2 = new Bundle(); if (bundle != null) { for (String str : bundle.keySet()) { Object LIZ2 = LIZ(str, LIZ(bundle, str)); if (LIZ2 == null) { LJIILLIIL().LJII.LIZ("Param value can't be null", LJIILIIL().LIZIZ(str)); } else { LIZ(bundle2, str, LIZ2); } } } return bundle2; } public final Bundle LIZ(String str, String str2, Bundle bundle, List<String> list, boolean z, boolean z2) { int i2; boolean z3 = z2; C40161Fpu fpu = this; C65212Piz.LIZIZ(); boolean LIZ2 = LJIJ().LIZ(C65111PhM.LJLJLJ); if (LIZ2) { z3 = LIZ(str2, FFG.LIZJ); } if (bundle == null) { return null; } Bundle bundle2 = new Bundle(bundle); int LIZLLL2 = LJIJ().LIZLLL(); int i3 = 0; for (String str3 : LJIJ().LIZLLL(str, C65111PhM.LJJJLIIL) ? new TreeSet<>(bundle.keySet()) : bundle.keySet()) { if (list == null || !list.contains(str3)) { if (!z || (i2 = fpu.LJII(str3)) == 0) { i2 = fpu.LJIIIIZZ(str3); } if (i2 != 0) { LIZ(bundle2, i2, str3, i2 == 3 ? str3 : null); bundle2.remove(str3); fpu = this; } } int LIZ3 = LIZ(str, str2, str3, LIZ(bundle, str3), bundle2, list, z, z3); if (LIZ2 && LIZ3 == 17) { LIZ(bundle2, LIZ3, str3, (Object) false); } else if (LIZ3 != 0 && !"_ev".equals(str3)) { LIZ(bundle2, LIZ3, LIZ3 == 21 ? str2 : str3, LIZ(bundle, str3)); bundle2.remove(str3); fpu = this; } if (LIZ(str3) && (i3 = i3 + 1) > LIZLLL2) { LJIILLIIL().LJ.LIZ(new StringBuilder(48).append("Event can't contain more than ").append(LIZLLL2).append(" params").toString(), LJIILIIL().LIZ(str2), LJIILIIL().LIZ(bundle)); LIZIZ(bundle2, 5); bundle2.remove(str3); } fpu = this; } return bundle2; } public final zzao LIZ(String str, String str2, Bundle bundle, String str3, long j) { Bundle bundle2; if (TextUtils.isEmpty(str2)) { return null; } if (LIZIZ(str2) == 0) { if (bundle == null) { bundle2 = new Bundle(); } bundle2.putString("_o", str3); return new zzao(str2, new zzan(LIZ(LIZ(str, str2, bundle2, Collections.singletonList("_o"), false, false))), str3, j); } LJIILLIIL().LIZJ.LIZ("Invalid conditional property event name", LJIILIIL().LIZJ(str2)); throw new IllegalArgumentException(); } public final Object LIZ(String str, Object obj) { int i2 = 256; if ("_ev".equals(str)) { return LIZ(256, obj, true, true); } if (!LJ(str)) { i2 = 100; } return LIZ(i2, obj, false, true); } public final URL LIZ(String str, String str2, long j) { try { F6B.LIZ(str2); F6B.LIZ(str); String LIZ2 = AnonymousClass0EJ.LIZ("https://www.googleadservices.com/pagead/conversion/app/deeplink?id_type=adid&sdk_version=%s&rdid=%s&bundleid=%s&retry=%s", new Object[]{AnonymousClass0EJ.LIZ("v%s.%s", new Object[]{31000L, Integer.valueOf(LJIIIIZZ())}), str2, str, Long.valueOf(j)}); if (str.equals(LJIJ().LIZ("debug.deferred.deeplink", ""))) { LIZ2 = LIZ2.concat("&ddl_test=1"); } return new URL(LIZ2); } catch (IllegalArgumentException | MalformedURLException e) { LJIILLIIL().LIZJ.LIZ("Failed to create BOW URL for Deferred Deep Link. exception", e.getMessage()); return null; } } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ void LIZ() { super.LIZ(); } public final void LIZ(int i2, String str, String str2, int i3) { LIZIZ(i2, str, str2, i3); } public final void LIZ(FCW fcw, int i2) { int i3 = 0; for (String str : new TreeSet(fcw.LIZIZ.keySet())) { if (LIZ(str) && (i3 = i3 + 1) > i2) { LJIILLIIL().LJ.LIZ(new StringBuilder(48).append("Event can't contain more than ").append(i2).append(" params").toString(), LJIILIIL().LIZ(fcw.LIZ), LJIILIIL().LIZ(fcw.LIZIZ)); LIZIZ(fcw.LIZIZ, 5); fcw.LIZIZ.remove(str); } } } public final void LIZ(AbstractC40165Fpy fpy, int i2) { Bundle bundle = new Bundle(); bundle.putInt("r", i2); try { fpy.LIZ(bundle); } catch (RemoteException e) { this.LJJIFFI.LJIILLIIL().LJFF.LIZ("Error returning int value to wrapper", e); } } public final void LIZ(AbstractC40165Fpy fpy, long j) { Bundle bundle = new Bundle(); bundle.putLong("r", j); try { fpy.LIZ(bundle); } catch (RemoteException e) { this.LJJIFFI.LJIILLIIL().LJFF.LIZ("Error returning long value to wrapper", e); } } public final void LIZ(AbstractC40165Fpy fpy, Bundle bundle) { try { fpy.LIZ(bundle); } catch (RemoteException e) { this.LJJIFFI.LJIILLIIL().LJFF.LIZ("Error returning bundle value to wrapper", e); } } public final void LIZ(AbstractC40165Fpy fpy, String str) { Bundle bundle = new Bundle(); bundle.putString("r", str); try { fpy.LIZ(bundle); } catch (RemoteException e) { this.LJJIFFI.LJIILLIIL().LJFF.LIZ("Error returning string value to wrapper", e); } } public final void LIZ(AbstractC40165Fpy fpy, ArrayList<Bundle> arrayList) { Bundle bundle = new Bundle(); bundle.putParcelableArrayList("r", arrayList); try { fpy.LIZ(bundle); } catch (RemoteException e) { this.LJJIFFI.LJIILLIIL().LJFF.LIZ("Error returning bundle list to wrapper", e); } } public final void LIZ(AbstractC40165Fpy fpy, boolean z) { Bundle bundle = new Bundle(); bundle.putBoolean("r", z); try { fpy.LIZ(bundle); } catch (RemoteException e) { this.LJJIFFI.LJIILLIIL().LJFF.LIZ("Error returning boolean value to wrapper", e); } } public final void LIZ(AbstractC40165Fpy fpy, byte[] bArr) { Bundle bundle = new Bundle(); bundle.putByteArray("r", bArr); try { fpy.LIZ(bundle); } catch (RemoteException e) { this.LJJIFFI.LJIILLIIL().LJFF.LIZ("Error returning byte array to wrapper", e); } } public final void LIZ(Bundle bundle, long j) { long j2 = bundle.getLong("_et"); if (j2 != 0) { LJIILLIIL().LJFF.LIZ("Params already contained engagement", Long.valueOf(j2)); } bundle.putLong("_et", j + j2); } public final void LIZ(Bundle bundle, Bundle bundle2) { if (bundle2 != null) { for (String str : bundle2.keySet()) { if (!bundle.containsKey(str)) { LJIILJJIL().LIZ(bundle, str, LIZ(bundle2, str)); } } } } public final void LIZ(Bundle bundle, String str, Object obj) { if (bundle != null) { if (obj instanceof Long) { bundle.putLong(str, ((Long) obj).longValue()); } else if (obj instanceof String) { bundle.putString(str, String.valueOf(obj)); } else if (obj instanceof Double) { bundle.putDouble(str, ((Double) obj).doubleValue()); } else { C65212Piz.LIZIZ(); if (LJIJ().LIZ(C65111PhM.LJLJL) && LJIJ().LIZ(C65111PhM.LJLJJLL) && (obj instanceof Bundle[])) { bundle.putParcelableArray(str, (Bundle[]) obj); } else if (str != null) { LJIILLIIL().LJII.LIZ("Not putting event parameter. Invalid value type. name, type", LJIILIIL().LIZIZ(str), obj != null ? obj.getClass().getSimpleName() : null); } } } } public final boolean LIZ(String str, double d) { try { SharedPreferences.Editor edit = C13630ga.LIZ(LJIIL(), "google.analytics.deferred.deeplink.prefs", 0).edit(); edit.putString("deeplink", str); edit.putLong("timestamp", Double.doubleToRawLongBits(d)); return edit.commit(); } catch (Exception e) { LJIILLIIL().LIZJ.LIZ("Failed to persist Deferred Deep Link. exception", e); return false; } } public final boolean LIZ(String str, int i2, String str2) { if (str2 == null) { LJIILLIIL().LJ.LIZ("Name is required and can't be null. Type", str); return false; } else if (str2.codePointCount(0, str2.length()) <= i2) { return true; } else { LJIILLIIL().LJ.LIZ("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i2), str2); return false; } } public final boolean LIZ(String str, String str2) { if (str2 == null) { LJIILLIIL().LJ.LIZ("Name is required and can't be null. Type", str); return false; } else if (str2.length() == 0) { LJIILLIIL().LJ.LIZ("Name is required and can't be empty. Type", str); return false; } else { int codePointAt = str2.codePointAt(0); if (!Character.isLetter(codePointAt)) { LJIILLIIL().LJ.LIZ("Name must start with a letter. Type, name", str, str2); return false; } int length = str2.length(); int charCount = Character.charCount(codePointAt); while (charCount < length) { int codePointAt2 = str2.codePointAt(charCount); if (codePointAt2 == 95 || Character.isLetterOrDigit(codePointAt2)) { charCount += Character.charCount(codePointAt2); } else { LJIILLIIL().LJ.LIZ("Name must consist of letters, digits or _ (underscores). Type, name", str, str2); return false; } } return true; } } public final boolean LIZ(String str, String str2, int i2, Object obj) { if (obj != null && !(obj instanceof Long) && !(obj instanceof Float) && !(obj instanceof Integer) && !(obj instanceof Byte) && !(obj instanceof Short) && !(obj instanceof Boolean) && !(obj instanceof Double)) { if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) { return false; } String valueOf = String.valueOf(obj); if (valueOf.codePointCount(0, valueOf.length()) > i2) { LJIILLIIL().LJII.LIZ("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(valueOf.length())); return false; } } return true; } public final boolean LIZ(String str, String str2, String str3) { if (TextUtils.isEmpty(str)) { C65191Pie.LIZIZ(); if (LJIJ().LIZ(C65111PhM.LJJLIIIJLLLLLLLZ) && !TextUtils.isEmpty(str3)) { return true; } if (TextUtils.isEmpty(str2)) { if (TextUtils.isEmpty(this.LJJIFFI.LIZ)) { LJIILLIIL().LJ.LIZ("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI"); } return false; } else if (LJIIIZ(str2)) { return true; } else { LJIILLIIL().LJ.LIZ("Invalid admob_app_id. Analytics disabled.", C40159Fps.LIZ(str2)); return false; } } else if (LJIIIZ(str)) { return true; } else { if (TextUtils.isEmpty(this.LJJIFFI.LIZ)) { LJIILLIIL().LJ.LIZ("Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id", C40159Fps.LIZ(str)); } return false; } } public final boolean LIZ(String str, String[] strArr, String str2) { if (str2 == null) { LJIILLIIL().LJ.LIZ("Name is required and can't be null. Type", str); return false; } F6B.LIZ((Object) str2); for (String str3 : LIZ) { if (str2.startsWith(str3)) { LJIILLIIL().LJ.LIZ("Name starts with reserved prefix. Type, name", str, str2); return false; } } if (strArr == null || !LIZ(str2, strArr)) { return true; } LJIILLIIL().LJ.LIZ("Name is reserved. Type, name", str, str2); return false; } public final int LIZIZ(String str) { if (!LIZIZ(C59681Nby.LJIIIIZZ, str)) { return 2; } if (!LIZ(C59681Nby.LJIIIIZZ, FFG.LIZ, str)) { return 13; } return !LIZ(C59681Nby.LJIIIIZZ, 40, str) ? 2 : 0; } public final int LIZIZ(String str, Object obj) { return "_ldl".equals(str) ? LIZ("user property referrer", str, LJIIJ(str), obj) : LIZ("user property", str, LJIIJ(str), obj) ? 0 : 7; } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ void LIZIZ() { super.LIZIZ(); } public final void LIZIZ(int i2, String str, String str2, int i3) { Bundle bundle = new Bundle(); LIZIZ(bundle, i2); if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2)) { bundle.putString(str, str2); } if (i2 == 6 || i2 == 7 || i2 == 2) { bundle.putLong("_el", (long) i3); } this.LJJIFFI.LJIJI(); this.LJJIFFI.LIZLLL().LIZ("auto", "_err", bundle); } public final boolean LIZIZ(String str, String str2) { if (str2 == null) { LJIILLIIL().LJ.LIZ("Name is required and can't be null. Type", str); return false; } else if (str2.length() == 0) { LJIILLIIL().LJ.LIZ("Name is required and can't be empty. Type", str); return false; } else { int codePointAt = str2.codePointAt(0); if (Character.isLetter(codePointAt) || codePointAt == 95) { int length = str2.length(); int charCount = Character.charCount(codePointAt); while (charCount < length) { int codePointAt2 = str2.codePointAt(charCount); if (codePointAt2 == 95 || Character.isLetterOrDigit(codePointAt2)) { charCount += Character.charCount(codePointAt2); } else { LJIILLIIL().LJ.LIZ("Name must consist of letters, digits or _ (underscores). Type, name", str, str2); return false; } } return true; } LJIILLIIL().LJ.LIZ("Name must start with a letter or _ (underscore). Type, name", str, str2); return false; } } public final int LIZJ(String str) { if (!LIZIZ("user property", str)) { return 6; } if (!LIZ("user property", C40274Frj.LIZ, str)) { return 15; } return !LIZ("user property", 24, str) ? 6 : 0; } public final Object LIZJ(String str, Object obj) { return "_ldl".equals(str) ? LIZ(LJIIJ(str), obj, true, false) : LIZ(LJIIJ(str), obj, false, false); } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ void LIZJ() { super.LIZJ(); } @Override // X.AbstractC40286Frv public final boolean LIZLLL() { return true; } public final boolean LIZLLL(String str) { LIZJ(); if (C38327F3k.LIZ.LIZ(LJIIL()).LIZ(str) == 0) { return true; } LJIILLIIL().LJIIIZ.LIZ("Permission not granted", str); return false; } public final long LJFF() { long andIncrement; long j; if (this.LIZLLL.get() == 0) { synchronized (this.LIZLLL) { try { long nextLong = new Random(System.nanoTime() ^ LJIIJJI().LIZ()).nextLong(); int i2 = this.LJ + 1; this.LJ = i2; j = nextLong + ((long) i2); } finally { } } return j; } synchronized (this.LIZLLL) { try { this.LIZLLL.compareAndSet(-1, 1); andIncrement = this.LIZLLL.getAndIncrement(); } finally { } } return andIncrement; } public final boolean LJFF(String str) { if (TextUtils.isEmpty(str)) { return false; } String LJIJJ = LJIJ().LJIJJ(); LJIJI(); return LJIJJ.equals(str); } public final SecureRandom LJI() { LIZJ(); if (this.LIZJ == null) { this.LIZJ = new SecureRandom(); } return this.LIZJ; } public final int LJIIIIZZ() { if (this.LJFF == null) { this.LJFF = Integer.valueOf(C38320F3d.getInstance().getApkVersion(LJIIL()) / 1000); } return this.LJFF.intValue(); } public final int LJIIIZ() { return C38320F3d.getInstance().isGooglePlayServicesAvailable(LJIIL(), 12451000); } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ C40139FpY LJIIJ() { return super.LJIIJ(); } @Override // X.C40186FqJ, X.AbstractC40429FuE public final /* bridge */ /* synthetic */ AbstractC40150Fpj LJIIJJI() { return super.LJIIJJI(); } @Override // X.C40186FqJ, X.AbstractC40429FuE public final /* bridge */ /* synthetic */ Context LJIIL() { return super.LJIIL(); } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ C40140FpZ LJIILIIL() { return super.LJIILIIL(); } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ C40161Fpu LJIILJJIL() { return super.LJIILJJIL(); } @Override // X.C40186FqJ, X.AbstractC40429FuE public final /* bridge */ /* synthetic */ C40137FpW LJIILL() { return super.LJIILL(); } @Override // X.C40186FqJ, X.AbstractC40429FuE public final /* bridge */ /* synthetic */ C40159Fps LJIILLIIL() { return super.LJIILLIIL(); } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ C40172Fq5 LJIIZILJ() { return super.LJIIZILJ(); } @Override // X.C40186FqJ public final /* bridge */ /* synthetic */ C40187FqK LJIJ() { return super.LJIJ(); } @Override // X.C40186FqJ, X.AbstractC40429FuE public final /* bridge */ /* synthetic */ C40430FuF LJIJI() { return super.LJIJI(); } public final String LJIJJ() { byte[] bArr = new byte[16]; LJI().nextBytes(bArr); return AnonymousClass0EJ.LIZ(Locale.US, "%032x", new Object[]{new BigInteger(1, bArr)}); } public final boolean LJIJJLI() { try { LJIIL().getClassLoader().loadClass("com.google.firebase.remoteconfig.FirebaseRemoteConfig"); return true; } catch (ClassNotFoundException unused) { return false; } } @Override // X.AbstractC40286Frv public final void Y_() { LIZJ(); SecureRandom secureRandom = new SecureRandom(); long nextLong = secureRandom.nextLong(); if (nextLong == 0) { nextLong = secureRandom.nextLong(); if (nextLong == 0) { LJIILLIIL().LJFF.LIZ("Utils falling back to Random for random id"); } } this.LIZLLL.set(nextLong); } }