MD5 校验值:a9a821418db4ad35214aeeb08c2f5902
h7.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package z2; import android.content.ComponentName; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ServiceInfo; import android.content.pm.Signature; 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 android.util.Log; import java.io.ByteArrayInputStream; import java.math.BigInteger; 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.Objects; import java.util.Random; import java.util.TreeSet; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import javax.security.auth.x500.X500Principal; import org.checkerframework.checker.nullness.qual.EnsuresNonNull; public final class h7 extends w4 { public static final String[] f10564q = {"firebase_", "google_", "ga_"}; public static final String[] f10565r = {"_err"}; public SecureRandom f10566m; public final AtomicLong f10567n; public int f10568o; public Integer f10569p; public h7(n4 n4Var) { super(n4Var); this.f10569p = null; this.f10567n = new AtomicLong(0L); } public static boolean W(String str) { return !TextUtils.isEmpty(str) && str.startsWith("_"); } public static boolean X(String str) { g2.m.e(str); return str.charAt(0) != '_' || str.equals("_ep"); } public static boolean Y(Context context) { ActivityInfo receiverInfo; Objects.requireNonNull(context, "null reference"); try { PackageManager packageManager = context.getPackageManager(); if (packageManager != null && (receiverInfo = packageManager.getReceiverInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementReceiver"), 0)) != null) { if (receiverInfo.enabled) { return true; } } } catch (PackageManager.NameNotFoundException unused) { } return false; } public static boolean Z(Context context) { Objects.requireNonNull(context, "null reference"); return g0(context, Build.VERSION.SDK_INT >= 24 ? "com.google.android.gms.measurement.AppMeasurementJobService" : "com.google.android.gms.measurement.AppMeasurementService"); } public static final boolean c0(Bundle bundle, int i9) { if (bundle.getLong("_err") != 0) { return false; } bundle.putLong("_err", i9); return true; } public static boolean f0(String str, String[] strArr) { for (String str2 : strArr) { if (t2.g4.w(str, str2)) { return true; } } return false; } public static boolean g0(Context context, String str) { ServiceInfo serviceInfo; try { PackageManager packageManager = context.getPackageManager(); if (packageManager != null && (serviceInfo = packageManager.getServiceInfo(new ComponentName(context, str), 0)) != null) { if (serviceInfo.enabled) { return true; } } } catch (PackageManager.NameNotFoundException unused) { } return false; } public static long n0(byte[] bArr) { Objects.requireNonNull(bArr, "null reference"); int length = bArr.length; int i9 = 0; g2.m.j(length > 0); long j9 = 0; for (int i10 = length - 1; i10 >= 0 && i10 >= bArr.length - 8; i10--) { j9 += (bArr[i10] & 255) << i9; i9 += 8; } return j9; } public static MessageDigest t() { MessageDigest messageDigest; for (int i9 = 0; i9 < 2; i9++) { try { messageDigest = MessageDigest.getInstance("MD5"); } catch (NoSuchAlgorithmException unused) { } if (messageDigest != null) { return messageDigest; } } return null; } public static ArrayList v(List list) { if (list == null) { return new ArrayList(0); } ArrayList arrayList = new ArrayList(list.size()); Iterator it = list.iterator(); while (it.hasNext()) { c cVar = (c) it.next(); Bundle bundle = new Bundle(); bundle.putString("app_id", cVar.f10432k); bundle.putString("origin", cVar.f10433l); bundle.putLong("creation_timestamp", cVar.f10435n); bundle.putString("name", cVar.f10434m.f10473l); Object y8 = cVar.f10434m.y(); Objects.requireNonNull(y8, "null reference"); t2.g4.y(bundle, y8); bundle.putBoolean("active", cVar.f10436o); String str = cVar.f10437p; if (str != null) { bundle.putString("trigger_event_name", str); } t tVar = cVar.f10438q; if (tVar != null) { bundle.putString("timed_out_event_name", tVar.f10853k); r rVar = tVar.f10854l; if (rVar != null) { bundle.putBundle("timed_out_event_params", rVar.y()); } } bundle.putLong("trigger_timeout", cVar.f10439r); t tVar2 = cVar.s; if (tVar2 != null) { bundle.putString("triggered_event_name", tVar2.f10853k); r rVar2 = tVar2.f10854l; if (rVar2 != null) { bundle.putBundle("triggered_event_params", rVar2.y()); } } bundle.putLong("triggered_timestamp", cVar.f10434m.f10474m); bundle.putLong("time_to_live", cVar.f10440t); t tVar3 = cVar.u; if (tVar3 != null) { bundle.putString("expired_event_name", tVar3.f10853k); r rVar3 = tVar3.f10854l; if (rVar3 != null) { bundle.putBundle("expired_event_params", rVar3.y()); } } arrayList.add(bundle); } return arrayList; } public static void y(v5 v5Var, Bundle bundle, boolean z8) { if (bundle != null && v5Var != null) { if (!bundle.containsKey("_sc") || z8) { String str = v5Var.f10893a; if (str != null) { bundle.putString("_sn", str); } else { bundle.remove("_sn"); } String str2 = v5Var.f10894b; if (str2 != null) { bundle.putString("_sc", str2); } else { bundle.remove("_sc"); } bundle.putLong("_si", v5Var.f10895c); return; } z8 = false; } if (bundle != null && v5Var == null && z8) { bundle.remove("_sn"); bundle.remove("_sc"); bundle.remove("_si"); } } public final void A(k3 k3Var, int i9) { Iterator it = new TreeSet(k3Var.f10647d.keySet()).iterator(); int i10 = 0; while (it.hasNext()) { String str = (String) it.next(); if (X(str) && (i10 = i10 + 1) > i9) { ((n4) this.f10892k).f().f10604r.c(androidx.activity.b.u("Event can't contain more than ", i9, " params").toString(), ((n4) this.f10892k).f10734w.d(k3Var.f10644a), ((n4) this.f10892k).f10734w.b(k3Var.f10647d)); c0(k3Var.f10647d, 5); k3Var.f10647d.remove(str); } } } public final void B(g7 g7Var, String str, int i9, String str2, String str3, int i10) { Bundle bundle = new Bundle(); c0(bundle, i9); if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) { bundle.putString(str2, str3); } if (i9 == 6 || i9 == 7 || i9 == 2) { bundle.putLong("_el", i10); } g7Var.e(str, "_err", bundle); } public final void C(Bundle bundle, String str, Object obj) { if (bundle == null) { return; } if (obj instanceof Long) { bundle.putLong(str, ((Long) obj).longValue()); return; } if (obj instanceof String) { bundle.putString(str, String.valueOf(obj)); return; } if (obj instanceof Double) { bundle.putDouble(str, ((Double) obj).doubleValue()); } else if (obj instanceof Bundle[]) { bundle.putParcelableArray(str, (Bundle[]) obj); } else if (str != null) { ((n4) this.f10892k).f().u.c("Not putting event parameter. Invalid value type. name, type", ((n4) this.f10892k).f10734w.e(str), obj != null ? obj.getClass().getSimpleName() : null); } } public final void D(t2.r0 r0Var, boolean z8) { Bundle bundle = new Bundle(); bundle.putBoolean("r", z8); try { r0Var.e(bundle); } catch (RemoteException e9) { ((n4) this.f10892k).f().s.b("Error returning boolean value to wrapper", e9); } } public final void E(t2.r0 r0Var, ArrayList arrayList) { Bundle bundle = new Bundle(); bundle.putParcelableArrayList("r", arrayList); try { r0Var.e(bundle); } catch (RemoteException e9) { ((n4) this.f10892k).f().s.b("Error returning bundle list to wrapper", e9); } } public final void F(t2.r0 r0Var, Bundle bundle) { try { r0Var.e(bundle); } catch (RemoteException e9) { ((n4) this.f10892k).f().s.b("Error returning bundle value to wrapper", e9); } } public final void G(t2.r0 r0Var, byte[] bArr) { Bundle bundle = new Bundle(); bundle.putByteArray("r", bArr); try { r0Var.e(bundle); } catch (RemoteException e9) { ((n4) this.f10892k).f().s.b("Error returning byte array to wrapper", e9); } } public final void H(t2.r0 r0Var, int i9) { Bundle bundle = new Bundle(); bundle.putInt("r", i9); try { r0Var.e(bundle); } catch (RemoteException e9) { ((n4) this.f10892k).f().s.b("Error returning int value to wrapper", e9); } } public final void I(t2.r0 r0Var, long j9) { Bundle bundle = new Bundle(); bundle.putLong("r", j9); try { r0Var.e(bundle); } catch (RemoteException e9) { ((n4) this.f10892k).f().s.b("Error returning long value to wrapper", e9); } } public final void J(t2.r0 r0Var, String str) { Bundle bundle = new Bundle(); bundle.putString("r", str); try { r0Var.e(bundle); } catch (RemoteException e9) { ((n4) this.f10892k).f().s.b("Error returning string value to wrapper", e9); } } public final void K(String str, String str2, String str3, Bundle bundle, List list, boolean z8) { int k02; String str4; int O; if (bundle == null) { return; } Objects.requireNonNull((n4) this.f10892k); Iterator it = new TreeSet(bundle.keySet()).iterator(); int i9 = 0; while (it.hasNext()) { String str5 = (String) it.next(); if (list == null || !list.contains(str5)) { k02 = !z8 ? k0(str5) : 0; if (k02 == 0) { k02 = j0(str5); } } else { k02 = 0; } if (k02 != 0) { x(bundle, k02, str5, k02 == 3 ? str5 : null); bundle.remove(str5); } else { if (U(bundle.get(str5))) { ((n4) this.f10892k).f().u.d("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str2, str3, str5); O = 22; str4 = str5; } else { str4 = str5; O = O(str, str2, str5, bundle.get(str5), bundle, list, z8, false); } if (O != 0 && !"_ev".equals(str4)) { x(bundle, O, str4, bundle.get(str4)); } else if (X(str4) && !f0(str4, o4.a.E) && (i9 = i9 + 1) > 0) { ((n4) this.f10892k).f().f10604r.c("Item cannot contain custom parameters", ((n4) this.f10892k).f10734w.d(str2), ((n4) this.f10892k).f10734w.b(bundle)); c0(bundle, 23); } bundle.remove(str4); } } } public final boolean L(String str, String str2) { if (!TextUtils.isEmpty(str)) { Objects.requireNonNull(str, "null reference"); if (str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) { return true; } if (((n4) this.f10892k).h()) { ((n4) this.f10892k).f().f10604r.b("Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id", j3.u(str)); } return false; } if (TextUtils.isEmpty(str2)) { if (((n4) this.f10892k).h()) { ((n4) this.f10892k).f().f10604r.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI"); } return false; } Objects.requireNonNull(str2, "null reference"); if (str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) { return true; } ((n4) this.f10892k).f().f10604r.b("Invalid admob_app_id. Analytics disabled.", j3.u(str2)); return false; } public final boolean M(String str, int i9, String str2) { if (str2 == null) { ((n4) this.f10892k).f().f10604r.b("Name is required and can't be null. Type", str); return false; } if (str2.codePointCount(0, str2.length()) <= i9) { return true; } ((n4) this.f10892k).f().f10604r.d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i9), str2); return false; } public final boolean N(String str, String[] strArr, String[] strArr2, String str2) { if (str2 == null) { ((n4) this.f10892k).f().f10604r.b("Name is required and can't be null. Type", str); return false; } String[] strArr3 = f10564q; for (int i9 = 0; i9 < 3; i9++) { if (str2.startsWith(strArr3[i9])) { ((n4) this.f10892k).f().f10604r.c("Name starts with reserved prefix. Type, name", str, str2); return false; } } if (strArr == null || !f0(str2, strArr)) { return true; } if (strArr2 != null && f0(str2, strArr2)) { return true; } ((n4) this.f10892k).f().f10604r.c("Name is reserved. Type, name", str, str2); return false; } public final int O(String str, String str2, String str3, Object obj, Bundle bundle, List list, boolean z8, boolean z9) { int i9; int i10; h3 h3Var; String str4; String str5; int size; i(); if (U(obj)) { if (!z9) { return 21; } if (!f0(str3, o4.a.D)) { return 20; } i6 y8 = ((n4) this.f10892k).y(); y8.i(); y8.j(); if (y8.q() && ((n4) y8.f10892k).A().m0() < 200900) { return 25; } Objects.requireNonNull((n4) this.f10892k); boolean z10 = obj instanceof Parcelable[]; if (z10) { size = ((Parcelable[]) obj).length; } else if (obj instanceof ArrayList) { size = ((ArrayList) obj).size(); } if (size > 200) { ((n4) this.f10892k).f().u.d("Parameter array is too long; discarded. Value kind, name, array length", "param", str3, Integer.valueOf(size)); Objects.requireNonNull((n4) this.f10892k); if (z10) { 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))); } } i9 = 17; if (!W(str2) || W(str3)) { Objects.requireNonNull((n4) this.f10892k); i10 = 256; } else { Objects.requireNonNull((n4) this.f10892k); i10 = 100; } if (!P("param", str3, i10, obj)) { return i9; } if (!z9) { return 4; } if (obj instanceof Bundle) { K(str, str2, str3, (Bundle) obj, list, z8); } else if (obj instanceof Parcelable[]) { for (Parcelable parcelable : (Parcelable[]) obj) { if (!(parcelable instanceof Bundle)) { h3Var = ((n4) this.f10892k).f().u; str4 = parcelable.getClass(); str5 = "All Parcelable[] elements must be of type Bundle. Value type, name"; h3Var.c(str5, str4, str3); return 4; } K(str, str2, str3, (Bundle) parcelable, list, z8); } } else { if (!(obj instanceof ArrayList)) { return 4; } ArrayList arrayList2 = (ArrayList) obj; int size2 = arrayList2.size(); for (int i11 = 0; i11 < size2; i11++) { Object obj2 = arrayList2.get(i11); if (!(obj2 instanceof Bundle)) { h3Var = ((n4) this.f10892k).f().u; str4 = obj2 != null ? obj2.getClass() : "null"; str5 = "All ArrayList elements must be of type Bundle. Value type, name"; h3Var.c(str5, str4, str3); return 4; } K(str, str2, str3, (Bundle) obj2, list, z8); } } return i9; } } i9 = 0; if (W(str2)) { } Objects.requireNonNull((n4) this.f10892k); i10 = 256; if (!P("param", str3, i10, obj)) { } } public final boolean P(String str, String str2, int i9, 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 obj2 = obj.toString(); if (obj2.codePointCount(0, obj2.length()) > i9) { ((n4) this.f10892k).f().u.d("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length())); return false; } } return true; } public final boolean Q(String str, String str2) { if (str2 == null) { ((n4) this.f10892k).f().f10604r.b("Name is required and can't be null. Type", str); return false; } if (str2.length() == 0) { ((n4) this.f10892k).f().f10604r.b("Name is required and can't be empty. Type", str); return false; } int codePointAt = str2.codePointAt(0); if (!Character.isLetter(codePointAt)) { if (codePointAt != 95) { ((n4) this.f10892k).f().f10604r.c("Name must start with a letter or _ (underscore). Type, name", str, str2); return false; } 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)) { ((n4) this.f10892k).f().f10604r.c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2); return false; } charCount += Character.charCount(codePointAt2); } return true; } public final boolean R(String str, String str2) { if (str2 == null) { ((n4) this.f10892k).f().f10604r.b("Name is required and can't be null. Type", str); return false; } if (str2.length() == 0) { ((n4) this.f10892k).f().f10604r.b("Name is required and can't be empty. Type", str); return false; } int codePointAt = str2.codePointAt(0); if (!Character.isLetter(codePointAt)) { ((n4) this.f10892k).f().f10604r.c("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)) { ((n4) this.f10892k).f().f10604r.c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2); return false; } charCount += Character.charCount(codePointAt2); } return true; } public final boolean S(String str) { i(); if (m2.c.a(((n4) this.f10892k).f10724k).f7363a.checkCallingOrSelfPermission(str) == 0) { return true; } ((n4) this.f10892k).f().f10607w.b("Permission not granted", str); return false; } public final boolean T(String str) { if (TextUtils.isEmpty(str)) { return false; } String k9 = ((n4) this.f10892k).f10730q.k("debug.firebase.analytics.app", ""); Objects.requireNonNull((n4) this.f10892k); return k9.equals(str); } public final boolean U(Object obj) { return (obj instanceof Parcelable[]) || (obj instanceof ArrayList) || (obj instanceof Bundle); } public final boolean V(Context context, String str) { h3 h3Var; String str2; Signature[] signatureArr; X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US"); try { PackageInfo packageInfo = m2.c.a(context).f7363a.getPackageManager().getPackageInfo(str, 64); if (packageInfo == null || (signatureArr = packageInfo.signatures) == null || signatureArr.length <= 0) { return true; } return ((X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(signatureArr[0].toByteArray()))).getSubjectX500Principal().equals(x500Principal); } catch (PackageManager.NameNotFoundException e9) { e = e9; h3Var = ((n4) this.f10892k).f().f10602p; str2 = "Package name not found"; h3Var.b(str2, e); return true; } catch (CertificateException e10) { e = e10; h3Var = ((n4) this.f10892k).f().f10602p; str2 = "Error obtaining certificate"; h3Var.b(str2, e); return true; } } public final boolean a0(String str, String str2, String str3, String str4) { boolean isEmpty = TextUtils.isEmpty(str); boolean isEmpty2 = TextUtils.isEmpty(str2); if (!isEmpty && !isEmpty2) { Objects.requireNonNull(str, "null reference"); return !str.equals(str2); } if (isEmpty && isEmpty2) { return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4); } if (isEmpty) { return TextUtils.isEmpty(str3) || !str3.equals(str4); } if (TextUtils.isEmpty(str4)) { return false; } return TextUtils.isEmpty(str3) || !str3.equals(str4); } public final byte[] b0(Parcelable parcelable) { if (parcelable == null) { return null; } Parcel obtain = Parcel.obtain(); try { parcelable.writeToParcel(obtain, 0); return obtain.marshall(); } finally { obtain.recycle(); } } public final int d0(String str) { if ("_ldl".equals(str)) { Objects.requireNonNull((n4) this.f10892k); return 2048; } if ("_id".equals(str)) { Objects.requireNonNull((n4) this.f10892k); return 256; } if ("_lgclid".equals(str)) { Objects.requireNonNull((n4) this.f10892k); return 100; } Objects.requireNonNull((n4) this.f10892k); return 36; } public final Object e0(int i9, Object obj, boolean z8, boolean z9) { if (obj == null) { return null; } if ((obj instanceof Long) || (obj instanceof Double)) { return obj; } if (obj instanceof Integer) { return Long.valueOf(((Integer) obj).intValue()); } if (obj instanceof Byte) { return Long.valueOf(((Byte) obj).byteValue()); } if (obj instanceof Short) { return Long.valueOf(((Short) obj).shortValue()); } if (obj instanceof Boolean) { return Long.valueOf(true != ((Boolean) obj).booleanValue() ? 0L : 1L); } if (obj instanceof Float) { return Double.valueOf(((Float) obj).doubleValue()); } if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) { return s(obj.toString(), i9, z8); } if (!z9 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) { return null; } ArrayList arrayList = new ArrayList(); for (Parcelable parcelable : (Parcelable[]) obj) { if (parcelable instanceof Bundle) { Bundle r02 = r0((Bundle) parcelable); if (!r02.isEmpty()) { arrayList.add(r02); } } } return arrayList.toArray(new Bundle[arrayList.size()]); } public final int h0(String str, Object obj) { int d02; String str2; if ("_ldl".equals(str)) { d02 = d0(str); str2 = "user property referrer"; } else { d02 = d0(str); str2 = "user property"; } return P(str2, str, d02, obj) ? 0 : 7; } public final int i0(String str) { if (!Q("event", str)) { return 2; } if (!N("event", o2.b.f7944q, o2.b.f7945r, str)) { return 13; } Objects.requireNonNull((n4) this.f10892k); return !M("event", 40, str) ? 2 : 0; } @Override public final void j() { i(); SecureRandom secureRandom = new SecureRandom(); long nextLong = secureRandom.nextLong(); if (nextLong == 0) { nextLong = secureRandom.nextLong(); if (nextLong == 0) { ((n4) this.f10892k).f().s.a("Utils falling back to Random for random id"); } } this.f10567n.set(nextLong); } public final int j0(String str) { if (!Q("event param", str)) { return 3; } if (!N("event param", null, null, str)) { return 14; } Objects.requireNonNull((n4) this.f10892k); return !M("event param", 40, str) ? 3 : 0; } @Override public final boolean k() { return true; } public final int k0(String str) { if (!R("event param", str)) { return 3; } if (!N("event param", null, null, str)) { return 14; } Objects.requireNonNull((n4) this.f10892k); return !M("event param", 40, str) ? 3 : 0; } public final int l0(String str) { if (!Q("user property", str)) { return 6; } if (!N("user property", o8.t.f8157x, null, str)) { return 15; } Objects.requireNonNull((n4) this.f10892k); return !M("user property", 24, str) ? 6 : 0; } @EnsuresNonNull({"this.apkVersion"}) public final int m0() { if (this.f10569p == null) { d2.f fVar = d2.f.f3723b; Context context = ((n4) this.f10892k).f10724k; Objects.requireNonNull(fVar); AtomicBoolean atomicBoolean = d2.j.f3725a; int i9 = 0; try { i9 = context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode; } catch (PackageManager.NameNotFoundException unused) { Log.w("GooglePlayServicesUtil", "Google Play services is missing."); } this.f10569p = Integer.valueOf(i9 / 1000); } return this.f10569p.intValue(); } public final long o0() { long andIncrement; long j9; if (this.f10567n.get() != 0) { synchronized (this.f10567n) { this.f10567n.compareAndSet(-1L, 1L); andIncrement = this.f10567n.getAndIncrement(); } return andIncrement; } synchronized (this.f10567n) { long nanoTime = System.nanoTime(); Objects.requireNonNull((t2.g4) ((n4) this.f10892k).f10735x); long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong(); int i9 = this.f10568o + 1; this.f10568o = i9; j9 = nextLong + i9; } return j9; } public final Object p(String str, Object obj) { int i9 = 256; if ("_ev".equals(str)) { Objects.requireNonNull((n4) this.f10892k); return e0(256, obj, true, true); } if (W(str)) { Objects.requireNonNull((n4) this.f10892k); } else { Objects.requireNonNull((n4) this.f10892k); i9 = 100; } return e0(i9, obj, false, true); } public final long p0(long j9, long j10) { return ((j10 * 60000) + j9) / 86400000; } public final Object q(String str, Object obj) { boolean equals = "_ldl".equals(str); int d02 = d0(str); return equals ? e0(d02, obj, true, false) : e0(d02, obj, false, false); } public final Bundle q0(Uri uri, boolean z8, boolean z9) { String str; String str2; String str3; String str4; String str5; String str6; String str7; if (uri != null) { try { if (uri.isHierarchical()) { str = uri.getQueryParameter("utm_campaign"); str2 = uri.getQueryParameter("utm_source"); str3 = uri.getQueryParameter("utm_medium"); str4 = uri.getQueryParameter("gclid"); if (z8) { str5 = uri.getQueryParameter("utm_id"); str6 = uri.getQueryParameter("dclid"); } else { str5 = null; str6 = null; } str7 = z9 ? uri.getQueryParameter("srsltid") : null; } else { str = null; str2 = null; str3 = null; str4 = null; str5 = null; str6 = null; str7 = null; } if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && ((!z8 || (TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6))) && (!z9 || TextUtils.isEmpty(str7)))) { 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); } if (z8) { if (!TextUtils.isEmpty(str5)) { bundle.putString("campaign_id", str5); } if (!TextUtils.isEmpty(str6)) { bundle.putString("dclid", str6); } String queryParameter6 = uri.getQueryParameter("utm_source_platform"); if (!TextUtils.isEmpty(queryParameter6)) { bundle.putString("source_platform", queryParameter6); } String queryParameter7 = uri.getQueryParameter("utm_creative_format"); if (!TextUtils.isEmpty(queryParameter7)) { bundle.putString("creative_format", queryParameter7); } String queryParameter8 = uri.getQueryParameter("utm_marketing_tactic"); if (!TextUtils.isEmpty(queryParameter8)) { bundle.putString("marketing_tactic", queryParameter8); } } if (z9 && !TextUtils.isEmpty(str7)) { bundle.putString("srsltid", str7); } return bundle; } catch (UnsupportedOperationException e9) { ((n4) this.f10892k).f().s.b("Install referrer url isn't a hierarchical URI", e9); } } return null; } public final String r() { byte[] bArr = new byte[16]; u().nextBytes(bArr); return String.format(Locale.US, "%032x", new BigInteger(1, bArr)); } public final Bundle r0(Bundle bundle) { Bundle bundle2 = new Bundle(); if (bundle != null) { for (String str : bundle.keySet()) { Object p8 = p(str, bundle.get(str)); if (p8 == null) { ((n4) this.f10892k).f().u.b("Param value can't be null", ((n4) this.f10892k).f10734w.e(str)); } else { C(bundle2, str, p8); } } } return bundle2; } public final String s(String str, int i9, boolean z8) { if (str == null) { return null; } if (str.codePointCount(0, str.length()) <= i9) { return str; } if (z8) { return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i9))).concat("..."); } return null; } public final Bundle s0(String str, String str2, Bundle bundle, List list, boolean z8) { int k02; List list2 = list; boolean f02 = f0(str2, o2.b.f7946t); Bundle bundle2 = new Bundle(bundle); int m9 = ((n4) this.f10892k).f10730q.m(); Iterator it = new TreeSet(bundle.keySet()).iterator(); int i9 = 0; while (it.hasNext()) { String str3 = (String) it.next(); if (list2 == null || !list2.contains(str3)) { k02 = !z8 ? k0(str3) : 0; if (k02 == 0) { k02 = j0(str3); } } else { k02 = 0; } if (k02 != 0) { x(bundle2, k02, str3, k02 == 3 ? str3 : null); bundle2.remove(str3); } else { int O = O(str, str2, str3, bundle.get(str3), bundle2, list, z8, f02); if (O == 17) { x(bundle2, 17, str3, Boolean.FALSE); } else if (O != 0 && !"_ev".equals(str3)) { x(bundle2, O, O == 21 ? str2 : str3, bundle.get(str3)); bundle2.remove(str3); } if (X(str3)) { int i10 = i9 + 1; if (i10 > m9) { ((n4) this.f10892k).f().f10604r.c(androidx.activity.b.u("Event can't contain more than ", m9, " params").toString(), ((n4) this.f10892k).f10734w.d(str2), ((n4) this.f10892k).f10734w.b(bundle)); c0(bundle2, 5); bundle2.remove(str3); } i9 = i10; } } list2 = list; } return bundle2; } public final t t0(String str, String str2, Bundle bundle, String str3, long j9, boolean z8, boolean z9) { if (TextUtils.isEmpty(str2)) { return null; } if (i0(str2) == 0) { Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle(); bundle2.putString("_o", str3); Bundle s02 = s0(str, str2, bundle2, Collections.singletonList("_o"), true); if (z8) { s02 = r0(s02); } return new t(str2, new r(s02), str3, j9); } ((n4) this.f10892k).f().f10602p.b("Invalid conditional property event name", ((n4) this.f10892k).f10734w.f(str2)); throw new IllegalArgumentException(); } @EnsuresNonNull({"this.secureRandom"}) public final SecureRandom u() { i(); if (this.f10566m == null) { this.f10566m = new SecureRandom(); } return this.f10566m; } public final void w(Bundle bundle, long j9) { long j10 = bundle.getLong("_et"); if (j10 != 0) { ((n4) this.f10892k).f().s.b("Params already contained engagement", Long.valueOf(j10)); } else { j10 = 0; } bundle.putLong("_et", j9 + j10); } public final void x(Bundle bundle, int i9, String str, Object obj) { if (c0(bundle, i9)) { Objects.requireNonNull((n4) this.f10892k); bundle.putString("_ev", s(str, 40, true)); if (obj != null) { if ((obj instanceof String) || (obj instanceof CharSequence)) { bundle.putLong("_el", obj.toString().length()); } } } } public final void z(Bundle bundle, Bundle bundle2) { if (bundle2 == null) { return; } for (String str : bundle2.keySet()) { if (!bundle.containsKey(str)) { ((n4) this.f10892k).A().C(bundle, str, bundle2.get(str)); } } } }