ChatOn v1.35.366360版本的 MD5 值为:cde28447b38d5467efa95e48e7076155
以下内容为反编译后的 c7.java 源代码,内容仅作参考
package ic;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
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.os.ext.SdkExtensions;
import android.text.TextUtils;
import android.util.Log;
import androidx.privacysandbox.ads.adservices.java.measurement.MeasurementManagerFutures$Api33Ext5JavaImpl;
import com.google.android.gms.internal.measurement.f9;
import com.google.android.gms.internal.measurement.g9;
import com.google.android.gms.measurement.internal.zzad;
import com.google.android.gms.measurement.internal.zzbb;
import com.google.android.gms.measurement.internal.zzbg;
import com.google.android.gms.measurement.internal.zznc;
import com.itextpdf.text.Annotation;
import com.itextpdf.text.pdf.PdfContentParser;
import com.itextpdf.text.xml.xmp.DublinCoreProperties;
import com.qonversion.android.sdk.internal.Constants;
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.Random;
import java.util.TreeSet;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;
import kotlin.jvm.internal.Intrinsics;
public final class c7 extends c5 {
public static final String[] B = {"firebase_", "google_", "ga_"};
public static final String[] C = {"_err"};
public Integer A;
public SecureRandom f12289n;
public final AtomicLong f12290v;
public int f12291w;
public MeasurementManagerFutures$Api33Ext5JavaImpl f12292y;
public Boolean f12293z;
public c7(w4 w4Var) {
super(w4Var);
this.A = null;
this.f12290v = new AtomicLong(0L);
}
public static boolean B0(String str) {
bc.y.g(str);
return str.charAt(0) != '_' || str.equals("_ep");
}
public static long C(zzbb zzbbVar) {
long j10 = 0;
if (zzbbVar == null) {
return 0L;
}
androidx.datastore.preferences.protobuf.n1 n1Var = new androidx.datastore.preferences.protobuf.n1(zzbbVar);
while (n1Var.hasNext()) {
Object obj = zzbbVar.f7738d.get((String) n1Var.next());
if (obj instanceof Parcelable[]) {
j10 += ((Parcelable[]) obj).length;
}
}
return j10;
}
public static long D(byte[] bArr) {
bc.y.k(bArr);
int i10 = 0;
bc.y.m(bArr.length > 0);
long j10 = 0;
for (int length = bArr.length - 1; length >= 0 && length >= bArr.length - 8; length--) {
j10 += (bArr[length] & 255) << i10;
i10 += 8;
}
return j10;
}
public static int D0(String str) {
if ("_ldl".equals(str)) {
return 2048;
}
if ("_id".equals(str)) {
return 256;
}
return ("_lgclid".equals(str) || "_gbraid".equals(str)) ? 100 : 36;
}
public static Bundle G(List list) {
Bundle bundle = new Bundle();
if (list == null) {
return bundle;
}
Iterator it = list.iterator();
while (it.hasNext()) {
zznc zzncVar = (zznc) it.next();
String str = zzncVar.f7760v;
String str2 = zzncVar.f7757e;
if (str != null) {
bundle.putString(str2, str);
} else {
Long l10 = zzncVar.f7759n;
if (l10 != null) {
bundle.putLong(str2, l10.longValue());
} else {
Double d10 = zzncVar.f7762y;
if (d10 != null) {
bundle.putDouble(str2, d10.doubleValue());
}
}
}
}
return bundle;
}
public static MessageDigest H0() {
MessageDigest messageDigest;
for (int i10 = 0; i10 < 2; i10++) {
try {
messageDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException unused) {
}
if (messageDigest != null) {
return messageDigest;
}
}
return null;
}
public static String J(String str, int i10, boolean z8) {
if (str == null) {
return null;
}
if (str.codePointCount(0, str.length()) > i10) {
if (z8) {
return androidx.activity.h.j(str.substring(0, str.offsetByCodePoints(0, i10)), "...");
}
return null;
}
return str;
}
public static void K(Bundle bundle, int i10, String str, Object obj) {
if (q0(i10, bundle)) {
bundle.putString("_ev", J(str, 40, true));
if (obj != null) {
if ((obj instanceof String) || (obj instanceof CharSequence)) {
bundle.putLong("_el", String.valueOf(obj).length());
}
}
}
}
public static void V(c6 c6Var, Bundle bundle, boolean z8) {
if (bundle == null || c6Var == null || (bundle.containsKey("_sc") && !z8)) {
if (bundle != null && c6Var == null && z8) {
bundle.remove("_sn");
bundle.remove("_sc");
bundle.remove("_si");
return;
}
return;
}
String str = c6Var.f12283a;
if (str != null) {
bundle.putString("_sn", str);
} else {
bundle.remove("_sn");
}
String str2 = c6Var.f12284b;
if (str2 != null) {
bundle.putString("_sc", str2);
} else {
bundle.remove("_sc");
}
bundle.putLong("_si", c6Var.f12285c);
}
public static void W(e7 e7Var, String str, int i10, String str2, String str3, int i11) {
Bundle bundle = new Bundle();
q0(i10, bundle);
if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
bundle.putString(str2, str3);
}
if (i10 == 6 || i10 == 7 || i10 == 2) {
bundle.putLong("_el", i11);
}
e7Var.b(str, "_err", bundle);
}
public static boolean b0(Context context) {
ActivityInfo receiverInfo;
bc.y.k(context);
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 c0(Intent intent) {
String stringExtra = intent.getStringExtra("android.intent.extra.REFERRER_NAME");
return "android-app://com.google.android.googlequicksearchbox/https/www.google.com".equals(stringExtra) || "https://www.google.com".equals(stringExtra) || "android-app://com.google.appcrawler".equals(stringExtra);
}
public static boolean d0(Object obj) {
return (obj instanceof Parcelable[]) || (obj instanceof ArrayList) || (obj instanceof Bundle);
}
public static boolean g0(String str, String str2, String str3, String str4) {
boolean isEmpty = TextUtils.isEmpty(str);
boolean isEmpty2 = TextUtils.isEmpty(str2);
if (!isEmpty && !isEmpty2) {
bc.y.k(str);
return !str.equals(str2);
} else if (isEmpty && isEmpty2) {
return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
} else if (isEmpty || !isEmpty2) {
return TextUtils.isEmpty(str3) || !str3.equals(str4);
} else if (TextUtils.isEmpty(str4)) {
return false;
} else {
return TextUtils.isEmpty(str3) || !str3.equals(str4);
}
}
public static boolean h0(String str, String[] strArr) {
bc.y.k(strArr);
for (String str2 : strArr) {
if (str == str2) {
return true;
}
if (str != null && str.equals(str2)) {
return true;
}
}
return false;
}
public static byte[] j0(Parcelable parcelable) {
if (parcelable == null) {
return null;
}
Parcel obtain = Parcel.obtain();
try {
parcelable.writeToParcel(obtain, 0);
return obtain.marshall();
} finally {
obtain.recycle();
}
}
public static boolean l0(Context context) {
bc.y.k(context);
return u0(context);
}
public static ArrayList p0(List list) {
if (list == null) {
return new ArrayList(0);
}
ArrayList arrayList = new ArrayList(list.size());
Iterator it = list.iterator();
while (it.hasNext()) {
zzad zzadVar = (zzad) it.next();
Bundle bundle = new Bundle();
bundle.putString("app_id", zzadVar.f7721d);
bundle.putString("origin", zzadVar.f7722e);
bundle.putLong("creation_timestamp", zzadVar.f7724n);
bundle.putString("name", zzadVar.f7723i.f7757e);
Object d10 = zzadVar.f7723i.d();
bc.y.k(d10);
ec.v.y(bundle, d10);
bundle.putBoolean("active", zzadVar.f7725v);
String str = zzadVar.f7726w;
if (str != null) {
bundle.putString("trigger_event_name", str);
}
zzbg zzbgVar = zzadVar.f7727y;
if (zzbgVar != null) {
bundle.putString("timed_out_event_name", zzbgVar.f7739d);
zzbb zzbbVar = zzbgVar.f7740e;
if (zzbbVar != null) {
bundle.putBundle("timed_out_event_params", zzbbVar.f());
}
}
bundle.putLong("trigger_timeout", zzadVar.f7728z);
zzbg zzbgVar2 = zzadVar.A;
if (zzbgVar2 != null) {
bundle.putString("triggered_event_name", zzbgVar2.f7739d);
zzbb zzbbVar2 = zzbgVar2.f7740e;
if (zzbbVar2 != null) {
bundle.putBundle("triggered_event_params", zzbbVar2.f());
}
}
bundle.putLong("triggered_timestamp", zzadVar.f7723i.f7758i);
bundle.putLong("time_to_live", zzadVar.B);
zzbg zzbgVar3 = zzadVar.C;
if (zzbgVar3 != null) {
bundle.putString("expired_event_name", zzbgVar3.f7739d);
zzbb zzbbVar3 = zzbgVar3.f7740e;
if (zzbbVar3 != null) {
bundle.putBundle("expired_event_params", zzbbVar3.f());
}
}
arrayList.add(bundle);
}
return arrayList;
}
public static boolean q0(int i10, Bundle bundle) {
if (bundle != null && bundle.getLong("_err") == 0) {
bundle.putLong("_err", i10);
return true;
}
return false;
}
public static boolean u0(Context context) {
ServiceInfo serviceInfo;
try {
PackageManager packageManager = context.getPackageManager();
if (packageManager != null && (serviceInfo = packageManager.getServiceInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementJobService"), 0)) != null) {
if (serviceInfo.enabled) {
return true;
}
}
} catch (PackageManager.NameNotFoundException unused) {
}
return false;
}
public static boolean w0(String str) {
String str2 = (String) r.Y.a(null);
return str2.equals("*") || Arrays.asList(str2.split(",")).contains(str);
}
public static boolean z0(String str) {
return !TextUtils.isEmpty(str) && str.startsWith(Constants.USER_ID_SEPARATOR);
}
public final int A(String str) {
if (s0("event", str)) {
if (i0("event", f5.f12338a, f5.f12339b, str)) {
return !a0(40, "event", str) ? 2 : 0;
}
return 13;
}
return 2;
}
public final long A0() {
int extensionVersion;
int i10;
long j10;
int extensionVersion2;
Integer num;
u();
if (w0(((w4) this.f13305e).p().F())) {
int i11 = Build.VERSION.SDK_INT;
boolean z8 = false;
Integer num2 = null;
if (i11 < 30) {
j10 = 4;
} else {
extensionVersion = SdkExtensions.getExtensionVersion(30);
if (extensionVersion < 4) {
j10 = 8;
} else {
if (i11 >= 30) {
extensionVersion2 = SdkExtensions.getExtensionVersion(30);
if (extensionVersion2 > 3) {
i10 = SdkExtensions.getExtensionVersion(1000000);
j10 = i10 >= ((Integer) r.U.a(null)).intValue() ? 16L : 0L;
}
}
i10 = 0;
if (i10 >= ((Integer) r.U.a(null)).intValue()) {
}
}
}
if (!x0("android.permission.ACCESS_ADSERVICES_ATTRIBUTION")) {
j10 |= 2;
}
if (j10 == 0) {
if (this.f12293z == null) {
ec.j5 F0 = F0();
if (F0 != null) {
try {
num = (Integer) F0.a().get(10000L, TimeUnit.MILLISECONDS);
if (num != null) {
try {
if (num.intValue() == 1) {
z8 = true;
}
} catch (InterruptedException e10) {
e = e10;
num2 = num;
e().B.c(e, "Measurement manager api exception");
this.f12293z = Boolean.FALSE;
num = num2;
e().G.c(num, "Measurement manager api status result");
} catch (CancellationException e11) {
e = e11;
num2 = num;
e().B.c(e, "Measurement manager api exception");
this.f12293z = Boolean.FALSE;
num = num2;
e().G.c(num, "Measurement manager api status result");
} catch (ExecutionException e12) {
e = e12;
num2 = num;
e().B.c(e, "Measurement manager api exception");
this.f12293z = Boolean.FALSE;
num = num2;
e().G.c(num, "Measurement manager api status result");
} catch (TimeoutException e13) {
e = e13;
num2 = num;
e().B.c(e, "Measurement manager api exception");
this.f12293z = Boolean.FALSE;
num = num2;
e().G.c(num, "Measurement manager api status result");
}
}
this.f12293z = Boolean.valueOf(z8);
} catch (InterruptedException e14) {
e = e14;
} catch (CancellationException e15) {
e = e15;
} catch (ExecutionException e16) {
e = e16;
} catch (TimeoutException e17) {
e = e17;
}
e().G.c(num, "Measurement manager api status result");
}
j10 |= 64;
}
}
if (j10 == 0) {
return 1L;
}
return j10;
}
return 0L;
}
public final int B(String str, String str2, Object obj, Bundle bundle, List list, boolean z8, boolean z10) {
int i10;
Parcelable[] parcelableArr;
int size;
u();
int i11 = 0;
if (d0(obj)) {
if (!z10) {
return 21;
}
if (!h0(str2, f5.f12346i)) {
return 20;
}
e6 r10 = ((w4) this.f13305e).r();
r10.u();
r10.C();
if (r10.Q() && r10.t().y0() < 200900) {
return 25;
}
boolean z11 = obj instanceof Parcelable[];
if (z11) {
size = ((Parcelable[]) obj).length;
} else if (obj instanceof ArrayList) {
size = ((ArrayList) obj).size();
}
if (size > 200) {
e().D.e("Parameter array is too long; discarded. Value kind, name, array length", "param", str2, Integer.valueOf(size));
if (z11) {
Parcelable[] parcelableArr2 = (Parcelable[]) obj;
if (parcelableArr2.length > 200) {
bundle.putParcelableArray(str2, (Parcelable[]) Arrays.copyOf(parcelableArr2, (int) PdfContentParser.COMMAND_TYPE));
}
} else if (obj instanceof ArrayList) {
ArrayList arrayList = (ArrayList) obj;
if (arrayList.size() > 200) {
bundle.putParcelableArrayList(str2, new ArrayList<>(arrayList.subList(0, PdfContentParser.COMMAND_TYPE)));
}
}
i10 = 17;
if (f0("param", str2, (!z0(str) || z0(str2)) ? Math.max(q().y(((w4) this.f13305e).p().F()), 256) : q().y(((w4) this.f13305e).p().F()), obj)) {
if (z10) {
if (obj instanceof Bundle) {
Y(str, str2, (Bundle) obj, list, z8);
} else if (obj instanceof Parcelable[]) {
for (Parcelable parcelable : (Parcelable[]) obj) {
if (!(parcelable instanceof Bundle)) {
e().D.b(parcelable.getClass(), str2, "All Parcelable[] elements must be of type Bundle. Value type, name");
return 4;
}
Y(str, str2, (Bundle) parcelable, list, z8);
}
} else if (!(obj instanceof ArrayList)) {
return 4;
} else {
ArrayList arrayList2 = (ArrayList) obj;
int size2 = arrayList2.size();
while (i11 < size2) {
Object obj2 = arrayList2.get(i11);
int i12 = i11 + 1;
if (!(obj2 instanceof Bundle)) {
e().D.b(obj2 != null ? obj2.getClass() : "null", str2, "All ArrayList elements must be of type Bundle. Value type, name");
return 4;
}
Y(str, str2, (Bundle) obj2, list, z8);
i11 = i12;
}
}
return i10;
}
return 4;
}
return i10;
}
}
i10 = 0;
if (f0("param", str2, (!z0(str) || z0(str2)) ? Math.max(q().y(((w4) this.f13305e).p().F()), 256) : q().y(((w4) this.f13305e).p().F()), obj)) {
}
}
public final boolean C0(String str) {
List<ResolveInfo> queryIntentActivities;
return (TextUtils.isEmpty(str) || (queryIntentActivities = a().getPackageManager().queryIntentActivities(new Intent("android.intent.action.VIEW", Uri.parse(str)), 0)) == null || queryIntentActivities.isEmpty()) ? false : true;
}
public final Bundle E(Uri uri, boolean z8, boolean z10) {
String str;
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
String str8;
String str9;
String str10;
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");
str5 = z10 ? uri.getQueryParameter("gbraid") : null;
str6 = uri.getQueryParameter("utm_id");
str7 = uri.getQueryParameter("dclid");
str8 = uri.getQueryParameter("srsltid");
str9 = z8 ? uri.getQueryParameter("sfmc_id") : null;
} else {
str = null;
str2 = null;
str3 = null;
str4 = null;
str5 = null;
str6 = null;
str7 = null;
str8 = null;
str9 = null;
}
if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && ((!z10 || TextUtils.isEmpty(str5)) && TextUtils.isEmpty(str6) && TextUtils.isEmpty(str7) && TextUtils.isEmpty(str8) && (!z8 || TextUtils.isEmpty(str9)))) {
return null;
}
Bundle bundle = new Bundle();
if (TextUtils.isEmpty(str)) {
str10 = "sfmc_id";
} else {
str10 = "sfmc_id";
bundle.putString("campaign", str);
}
if (!TextUtils.isEmpty(str2)) {
bundle.putString(DublinCoreProperties.SOURCE, str2);
}
if (!TextUtils.isEmpty(str3)) {
bundle.putString("medium", str3);
}
if (!TextUtils.isEmpty(str4)) {
bundle.putString("gclid", str4);
}
if (z10 && !TextUtils.isEmpty(str5)) {
bundle.putString("gbraid", str5);
}
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(Annotation.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 (!TextUtils.isEmpty(str6)) {
bundle.putString("campaign_id", str6);
}
if (!TextUtils.isEmpty(str7)) {
bundle.putString("dclid", str7);
}
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 (!TextUtils.isEmpty(str8)) {
bundle.putString("srsltid", str8);
}
if (z8 && !TextUtils.isEmpty(str9)) {
bundle.putString(str10, str9);
}
return bundle;
} catch (UnsupportedOperationException e10) {
e().B.c(e10, "Install referrer url isn't a hierarchical URI");
return null;
}
}
public final long E0() {
long andIncrement;
long j10;
if (this.f12290v.get() != 0) {
synchronized (this.f12290v) {
this.f12290v.compareAndSet(-1L, 1L);
andIncrement = this.f12290v.getAndIncrement();
}
return andIncrement;
}
synchronized (this.f12290v) {
long nanoTime = System.nanoTime();
((ub.b) k()).getClass();
long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
int i10 = this.f12291w + 1;
this.f12291w = i10;
j10 = nextLong + i10;
}
return j10;
}
public final Bundle F(String str, Bundle bundle, List list, boolean z8) {
int i10;
boolean h02 = h0(str, f5.f12341d);
String[] strArr = null;
if (bundle != null) {
Bundle bundle2 = new Bundle(bundle);
int i11 = q().t().k0(201500000) ? 100 : 25;
Iterator it = new TreeSet(bundle.keySet()).iterator();
int i12 = 0;
while (it.hasNext()) {
String str2 = (String) it.next();
if (list == null || !list.contains(str2)) {
int i13 = 14;
if (!z8) {
if (v0("event param", str2)) {
if (!i0("event param", strArr, strArr, str2)) {
i10 = 14;
if (i10 == 0) {
if (s0("event param", str2)) {
if (i0("event param", strArr, strArr, str2)) {
if (a0(40, "event param", str2)) {
i13 = 0;
}
}
i10 = i13;
}
i13 = 3;
i10 = i13;
}
}
}
i10 = 3;
if (i10 == 0) {
}
}
i10 = 0;
if (i10 == 0) {
}
} else {
i10 = 0;
}
if (i10 != 0) {
K(bundle2, i10, str2, i10 == 3 ? str2 : strArr);
bundle2.remove(str2);
} else {
int B2 = B(str, str2, bundle.get(str2), bundle2, list, z8, h02);
if (B2 == 17) {
K(bundle2, B2, str2, Boolean.FALSE);
} else if (B2 != 0 && !"_ev".equals(str2)) {
K(bundle2, B2, B2 == 21 ? str : str2, bundle.get(str2));
bundle2.remove(str2);
}
if (B0(str2)) {
int i14 = i12 + 1;
if (i14 > i11) {
e().A.b(r().c(str), r().a(bundle), androidx.activity.h.f("Event can't contain more than ", i11, " params"));
q0(5, bundle2);
bundle2.remove(str2);
}
i12 = i14;
}
}
strArr = null;
}
return bundle2;
}
return null;
}
public final ec.j5 F0() {
if (this.f12292y == null) {
Context context = a();
Intrinsics.checkNotNullParameter(context, "context");
Intrinsics.checkNotNullParameter(context, "context");
StringBuilder sb2 = new StringBuilder("AdServicesInfo.version=");
int i10 = Build.VERSION.SDK_INT;
m1.a aVar = m1.a.f16563a;
sb2.append(i10 >= 30 ? aVar.a() : 0);
Log.d("MeasurementManager", sb2.toString());
o1.b bVar = (i10 < 30 || aVar.a() < 5) ? null : new o1.b(context);
this.f12292y = bVar != null ? new MeasurementManagerFutures$Api33Ext5JavaImpl(bVar) : null;
}
return this.f12292y;
}
public final String G0() {
byte[] bArr = new byte[16];
I0().nextBytes(bArr);
return String.format(Locale.US, "%032x", new BigInteger(1, bArr));
}
public final zzbg H(String str, Bundle bundle, String str2, long j10, boolean z8) {
if (TextUtils.isEmpty(str)) {
return null;
}
if (A(str) != 0) {
e().f12749y.c(r().g(str), "Invalid conditional property event name");
throw new IllegalArgumentException();
}
Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
bundle2.putString("_o", str2);
Bundle F = F(str, bundle2, Collections.singletonList("_o"), true);
if (z8) {
F = n0(F);
}
bc.y.k(F);
return new zzbg(str, new zzbb(F), str2, j10);
}
public final Object I(int i10, Object obj, boolean z8, boolean z10) {
Parcelable[] parcelableArr;
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(((Boolean) obj).booleanValue() ? 1L : 0L);
} else if (obj instanceof Float) {
return Double.valueOf(((Float) obj).doubleValue());
} else {
if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
return J(String.valueOf(obj), i10, z8);
}
if (z10 && ((obj instanceof Bundle[]) || (obj instanceof Parcelable[]))) {
ArrayList arrayList = new ArrayList();
for (Parcelable parcelable : (Parcelable[]) obj) {
if (parcelable instanceof Bundle) {
Bundle n02 = n0((Bundle) parcelable);
if (!n02.isEmpty()) {
arrayList.add(n02);
}
}
}
return arrayList.toArray(new Bundle[arrayList.size()]);
}
return null;
}
}
public final SecureRandom I0() {
u();
if (this.f12289n == null) {
this.f12289n = new SecureRandom();
}
return this.f12289n;
}
public final void J0() {
u();
SecureRandom secureRandom = new SecureRandom();
long nextLong = secureRandom.nextLong();
if (nextLong == 0) {
nextLong = secureRandom.nextLong();
if (nextLong == 0) {
e().B.d("Utils falling back to Random for random id");
}
}
this.f12290v.set(nextLong);
}
public final void L(Bundle bundle, long j10) {
long j11 = bundle.getLong("_et");
if (j11 != 0) {
x3 e10 = e();
e10.B.c(Long.valueOf(j11), "Params already contained engagement");
}
bundle.putLong("_et", j10 + j11);
}
public final void M(Bundle bundle, Bundle bundle2) {
if (bundle2 == null) {
return;
}
for (String str : bundle2.keySet()) {
if (!bundle.containsKey(str)) {
t().N(bundle, str, bundle2.get(str));
}
}
}
public final void N(Bundle bundle, String str, Object obj) {
if (bundle == null) {
return;
}
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 if (obj instanceof Bundle[]) {
bundle.putParcelableArray(str, (Bundle[]) obj);
} else if (str != null) {
String simpleName = obj != null ? obj.getClass().getSimpleName() : null;
e().D.b(r().f(str), simpleName, "Not putting event parameter. Invalid value type. name, type");
}
}
public final void O(com.google.android.gms.internal.measurement.r0 r0Var, int i10) {
Bundle bundle = new Bundle();
bundle.putInt("r", i10);
try {
r0Var.h(bundle);
} catch (RemoteException e10) {
x3 x3Var = ((w4) this.f13305e).A;
w4.h(x3Var);
x3Var.B.c(e10, "Error returning int value to wrapper");
}
}
public final void P(com.google.android.gms.internal.measurement.r0 r0Var, long j10) {
Bundle bundle = new Bundle();
bundle.putLong("r", j10);
try {
r0Var.h(bundle);
} catch (RemoteException e10) {
x3 x3Var = ((w4) this.f13305e).A;
w4.h(x3Var);
x3Var.B.c(e10, "Error returning long value to wrapper");
}
}
public final void Q(com.google.android.gms.internal.measurement.r0 r0Var, Bundle bundle) {
try {
r0Var.h(bundle);
} catch (RemoteException e10) {
x3 x3Var = ((w4) this.f13305e).A;
w4.h(x3Var);
x3Var.B.c(e10, "Error returning bundle value to wrapper");
}
}
public final void R(com.google.android.gms.internal.measurement.r0 r0Var, ArrayList arrayList) {
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("r", arrayList);
try {
r0Var.h(bundle);
} catch (RemoteException e10) {
x3 x3Var = ((w4) this.f13305e).A;
w4.h(x3Var);
x3Var.B.c(e10, "Error returning bundle list to wrapper");
}
}
public final void S(com.google.android.gms.internal.measurement.r0 r0Var, boolean z8) {
Bundle bundle = new Bundle();
bundle.putBoolean("r", z8);
try {
r0Var.h(bundle);
} catch (RemoteException e10) {
x3 x3Var = ((w4) this.f13305e).A;
w4.h(x3Var);
x3Var.B.c(e10, "Error returning boolean value to wrapper");
}
}
public final void T(com.google.android.gms.internal.measurement.r0 r0Var, byte[] bArr) {
Bundle bundle = new Bundle();
bundle.putByteArray("r", bArr);
try {
r0Var.h(bundle);
} catch (RemoteException e10) {
x3 x3Var = ((w4) this.f13305e).A;
w4.h(x3Var);
x3Var.B.c(e10, "Error returning byte array to wrapper");
}
}
public final void U(a4 a4Var, int i10) {
Iterator it = new TreeSet(((Bundle) a4Var.f12251v).keySet()).iterator();
int i11 = 0;
while (it.hasNext()) {
String str = (String) it.next();
if (B0(str) && (i11 = i11 + 1) > i10) {
e().A.b(r().c((String) a4Var.f12249i), r().a((Bundle) a4Var.f12251v), androidx.activity.h.f("Event can't contain more than ", i10, " params"));
q0(5, (Bundle) a4Var.f12251v);
((Bundle) a4Var.f12251v).remove(str);
}
}
}
public final void X(String str, com.google.android.gms.internal.measurement.r0 r0Var) {
Bundle bundle = new Bundle();
bundle.putString("r", str);
try {
r0Var.h(bundle);
} catch (RemoteException e10) {
x3 x3Var = ((w4) this.f13305e).A;
w4.h(x3Var);
x3Var.B.c(e10, "Error returning string value to wrapper");
}
}
public final void Y(String str, String str2, Bundle bundle, List list, boolean z8) {
int i10;
String str3;
int B2;
if (bundle == null) {
return;
}
e q10 = q();
q10.getClass();
((f9) g9.f6303e.get()).getClass();
int i11 = (q10.q().F(null, r.f12612z0) && q10.t().k0(231100000)) ? 35 : 0;
Iterator it = new TreeSet(bundle.keySet()).iterator();
int i12 = 0;
while (it.hasNext()) {
String str4 = (String) it.next();
if (list == null || !list.contains(str4)) {
int i13 = 14;
if (!z8) {
if (v0("event param", str4)) {
if (!i0("event param", null, null, str4)) {
i10 = 14;
if (i10 == 0) {
if (s0("event param", str4)) {
if (i0("event param", null, null, str4)) {
if (a0(40, "event param", str4)) {
i13 = 0;
}
}
i10 = i13;
}
i13 = 3;
i10 = i13;
}
}
}
i10 = 3;
if (i10 == 0) {
}
}
i10 = 0;
if (i10 == 0) {
}
} else {
i10 = 0;
}
if (i10 != 0) {
K(bundle, i10, str4, i10 == 3 ? str4 : null);
bundle.remove(str4);
} else {
if (d0(bundle.get(str4))) {
e().D.e("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str4);
B2 = 22;
str3 = str4;
} else {
str3 = str4;
B2 = B(str, str4, bundle.get(str4), bundle, list, z8, false);
}
if (B2 != 0 && !"_ev".equals(str3)) {
K(bundle, B2, str3, bundle.get(str3));
bundle.remove(str3);
} else if (B0(str3) && !h0(str3, f5.f12347j)) {
int i14 = i12 + 1;
if (!k0(231100000)) {
e().A.b(r().c(str), r().a(bundle), "Item array not supported on client's version of Google Play Services (Android Only)");
q0(23, bundle);
bundle.remove(str3);
} else if (i14 > i11) {
((f9) g9.f6303e.get()).getClass();
if (q().F(null, r.f12612z0)) {
e().A.b(r().c(str), r().a(bundle), androidx.activity.h.f("Item can't contain more than ", i11, " item-scoped custom params"));
q0(28, bundle);
bundle.remove(str3);
} else {
e().A.b(r().c(str), r().a(bundle), "Item cannot contain custom parameters");
q0(23, bundle);
bundle.remove(str3);
}
}
i12 = i14;
}
}
}
}
public final void Z(Parcelable[] parcelableArr, int i10, boolean z8) {
bc.y.k(parcelableArr);
for (Parcelable parcelable : parcelableArr) {
Bundle bundle = (Bundle) parcelable;
Iterator it = new TreeSet(bundle.keySet()).iterator();
int i11 = 0;
while (it.hasNext()) {
String str = (String) it.next();
if (B0(str) && !h0(str, f5.f12347j) && (i11 = i11 + 1) > i10) {
if (z8) {
e().A.b(r().f(str), r().a(bundle), androidx.activity.h.f("Param can't contain more than ", i10, " item-scoped custom parameters"));
q0(28, bundle);
} else {
e().A.b(r().f(str), r().a(bundle), "Param cannot contain item-scoped custom parameters");
q0(23, bundle);
}
bundle.remove(str);
}
}
}
}
public final boolean a0(int i10, String str, String str2) {
if (str2 == null) {
e().A.c(str, "Name is required and can't be null. Type");
return false;
} else if (str2.codePointCount(0, str2.length()) > i10) {
x3 e10 = e();
e10.A.e("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
return false;
} else {
return true;
}
}
public final boolean e0(String str, String str2) {
if (!TextUtils.isEmpty(str)) {
bc.y.k(str);
if (str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
return true;
}
if (TextUtils.isEmpty(((w4) this.f13305e).f12728e)) {
x3 e10 = e();
e10.A.c(x3.y(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
}
return false;
} else if (TextUtils.isEmpty(str2)) {
if (TextUtils.isEmpty(((w4) this.f13305e).f12728e)) {
e().A.d("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
}
return false;
} else {
bc.y.k(str2);
if (str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
return true;
}
x3 e11 = e();
e11.A.c(x3.y(str2), "Invalid admob_app_id. Analytics disabled.");
return false;
}
}
public final boolean f0(String str, String str2, int i10, 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()) > i10) {
x3 e10 = e();
e10.D.e("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(valueOf.length()));
return false;
}
}
return true;
}
public final boolean i0(String str, String[] strArr, String[] strArr2, String str2) {
if (str2 == null) {
e().A.c(str, "Name is required and can't be null. Type");
return false;
}
String[] strArr3 = B;
for (int i10 = 0; i10 < 3; i10++) {
if (str2.startsWith(strArr3[i10])) {
e().A.b(str, str2, "Name starts with reserved prefix. Type, name");
return false;
}
}
if (strArr == null || !h0(str2, strArr)) {
return true;
}
if (strArr2 == null || !h0(str2, strArr2)) {
e().A.b(str, str2, "Name is reserved. Type, name");
return false;
}
return true;
}
public final boolean k0(int i10) {
Boolean bool = ((w4) this.f13305e).r().f12326w;
if (y0() < i10 / 1000) {
return (bool == null || bool.booleanValue()) ? false : true;
}
return true;
}
public final int m0(String str) {
if (s0("user property", str)) {
if (i0("user property", f5.f12342e, null, str)) {
return !a0(24, "user property", str) ? 6 : 0;
}
return 15;
}
return 6;
}
public final Bundle n0(Bundle bundle) {
Bundle bundle2 = new Bundle();
if (bundle != null) {
for (String str : bundle.keySet()) {
Object o02 = o0(bundle.get(str), str);
if (o02 == null) {
x3 e10 = e();
e10.D.c(r().f(str), "Param value can't be null");
} else {
N(bundle2, str, o02);
}
}
}
return bundle2;
}
public final Object o0(Object obj, String str) {
if ("_ev".equals(str)) {
return I(Math.max(q().y(((w4) this.f13305e).p().F()), 256), obj, true, true);
}
return I(z0(str) ? Math.max(q().y(((w4) this.f13305e).p().F()), 256) : q().y(((w4) this.f13305e).p().F()), obj, false, true);
}
public final boolean r0(Context context, String str) {
Signature[] signatureArr;
X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
try {
PackageInfo d10 = vb.b.a(context).d(64, str);
if (d10 == null || (signatureArr = d10.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 e10) {
e().f12749y.c(e10, "Package name not found");
return true;
} catch (CertificateException e11) {
e().f12749y.c(e11, "Error obtaining certificate");
return true;
}
}
public final boolean s0(String str, String str2) {
if (str2 == null) {
e().A.c(str, "Name is required and can't be null. Type");
return false;
} else if (str2.length() == 0) {
e().A.c(str, "Name is required and can't be empty. Type");
return false;
} else {
int codePointAt = str2.codePointAt(0);
if (!Character.isLetter(codePointAt) && codePointAt != 95) {
e().A.b(str, str2, "Name must start with a letter or _ (underscore). Type, name");
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)) {
e().A.b(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
return false;
}
charCount += Character.charCount(codePointAt2);
}
return true;
}
}
public final Object t0(Object obj, String str) {
return "_ldl".equals(str) ? I(D0(str), obj, true, false) : I(D0(str), obj, false, false);
}
public final boolean v0(String str, String str2) {
if (str2 == null) {
e().A.c(str, "Name is required and can't be null. Type");
return false;
} else if (str2.length() == 0) {
e().A.c(str, "Name is required and can't be empty. Type");
return false;
} else {
int codePointAt = str2.codePointAt(0);
if (!Character.isLetter(codePointAt)) {
e().A.b(str, str2, "Name must start with a letter. Type, name");
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)) {
e().A.b(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
return false;
}
charCount += Character.charCount(codePointAt2);
}
return true;
}
}
@Override
public final boolean x() {
return true;
}
public final boolean x0(String str) {
u();
if (vb.b.a(a()).f10088e.checkCallingOrSelfPermission(str) == 0) {
return true;
}
e().F.c(str, "Permission not granted");
return false;
}
public final int y(Object obj, String str) {
return "_ldl".equals(str) ? f0("user property referrer", str, D0(str), obj) : f0("user property", str, D0(str), obj) ? 0 : 7;
}
public final int y0() {
if (this.A == null) {
nb.d dVar = nb.d.f16847b;
Context a10 = a();
dVar.getClass();
this.A = Integer.valueOf(nb.d.a(a10) / 1000);
}
return this.A.intValue();
}
}