Shinigami ID v1.1.3版本的 MD5 值为:c381e85feac697f048c400ae89b7b92d
以下内容为反编译后的 u6.java 源代码,内容仅作参考
package i4;
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.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;
import c4.na;
import com.unity3d.ads.metadata.MediationMetaData;
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;
public final class u6 extends m4 {
public static final String[] f7261u = {"firebase_", "google_", "ga_"};
public static final String[] v = {"_err"};
public SecureRandom f7262q;
public final AtomicLong f7263r;
public int f7264s;
public Integer f7265t;
public u6(g4 g4Var) {
super(g4Var);
this.f7265t = null;
this.f7263r = new AtomicLong(0L);
}
public static boolean Y(String str) {
return !TextUtils.isEmpty(str) && str.startsWith("_");
}
public static boolean Z(String str) {
l3.p.e(str);
return str.charAt(0) != '_' || str.equals("_ep");
}
public static boolean a0(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 b0(Context context) {
Objects.requireNonNull(context, "null reference");
return i0(context);
}
public static final boolean e0(Bundle bundle, int i10) {
if (bundle == null || bundle.getLong("_err") != 0) {
return false;
}
bundle.putLong("_err", i10);
return true;
}
public static boolean h0(String str, String[] strArr) {
Objects.requireNonNull(strArr, "null reference");
for (int i10 = 0; i10 < strArr.length; i10++) {
Object obj = strArr[i10];
if (str == obj || (str != null && str.equals(obj))) {
return true;
}
}
return false;
}
public static boolean i0(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 long p0(byte[] bArr) {
Objects.requireNonNull(bArr, "null reference");
int length = bArr.length;
int i10 = 0;
l3.p.j(length > 0);
long j10 = 0;
while (true) {
length--;
if (length < 0 || length < bArr.length - 8) {
break;
}
j10 += (bArr[length] & 255) << i10;
i10 += 8;
}
return j10;
}
public static MessageDigest t() {
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 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.f6824o);
bundle.putString("origin", cVar.f6825p);
bundle.putLong("creation_timestamp", cVar.f6827r);
bundle.putString(MediationMetaData.KEY_NAME, cVar.f6826q.f7150p);
Object E = cVar.f6826q.E();
Objects.requireNonNull(E, "null reference");
h6.b.E(bundle, E);
bundle.putBoolean("active", cVar.f6828s);
String str = cVar.f6829t;
if (str != null) {
bundle.putString("trigger_event_name", str);
}
s sVar = cVar.f6830u;
if (sVar != null) {
bundle.putString("timed_out_event_name", sVar.f7173o);
q qVar = sVar.f7174p;
if (qVar != null) {
bundle.putBundle("timed_out_event_params", qVar.E());
}
}
bundle.putLong("trigger_timeout", cVar.v);
s sVar2 = cVar.f6831w;
if (sVar2 != null) {
bundle.putString("triggered_event_name", sVar2.f7173o);
q qVar2 = sVar2.f7174p;
if (qVar2 != null) {
bundle.putBundle("triggered_event_params", qVar2.E());
}
}
bundle.putLong("triggered_timestamp", cVar.f6826q.f7151q);
bundle.putLong("time_to_live", cVar.x);
s sVar3 = cVar.f6832y;
if (sVar3 != null) {
bundle.putString("expired_event_name", sVar3.f7173o);
q qVar3 = sVar3.f7174p;
if (qVar3 != null) {
bundle.putBundle("expired_event_params", qVar3.E());
}
}
arrayList.add(bundle);
}
return arrayList;
}
public static void y(h5 h5Var, Bundle bundle, boolean z10) {
if (bundle != null && h5Var != null) {
if (!bundle.containsKey("_sc") || z10) {
String str = h5Var.f6945a;
if (str != null) {
bundle.putString("_sn", str);
} else {
bundle.remove("_sn");
}
String str2 = h5Var.f6946b;
if (str2 != null) {
bundle.putString("_sc", str2);
} else {
bundle.remove("_sc");
}
bundle.putLong("_si", h5Var.c);
return;
}
z10 = false;
}
if (bundle != null && h5Var == null && z10) {
bundle.remove("_sn");
bundle.remove("_sc");
bundle.remove("_si");
}
}
public final void A(Parcelable[] parcelableArr, int i10, boolean z10) {
Objects.requireNonNull(parcelableArr, "null reference");
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 (Z(str) && !h0(str, h1.u.B) && (i11 = i11 + 1) > i10) {
if (z10) {
this.f6903o.a().v.d(aa.p.t("Param can't contain more than ", i10, " item-scoped custom parameters"), this.f6903o.A.e(str), this.f6903o.A.b(bundle));
e0(bundle, 28);
} else {
this.f6903o.a().v.d("Param cannot contain item-scoped custom parameters", this.f6903o.A.e(str), this.f6903o.A.b(bundle));
e0(bundle, 23);
}
bundle.remove(str);
}
}
}
}
public final void B(f3 f3Var, int i10) {
Iterator it = new TreeSet(f3Var.f6902d.keySet()).iterator();
int i11 = 0;
while (it.hasNext()) {
String str = (String) it.next();
if (Z(str) && (i11 = i11 + 1) > i10) {
this.f6903o.a().v.d(aa.p.t("Event can't contain more than ", i10, " params"), this.f6903o.A.d(f3Var.f6900a), this.f6903o.A.b(f3Var.f6902d));
e0(f3Var.f6902d, 5);
f3Var.f6902d.remove(str);
}
}
}
public final void C(t6 t6Var, String str, int i10, String str2, String str3, int i11) {
Bundle bundle = new Bundle();
e0(bundle, i10);
if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
bundle.putString(str2, str3);
}
if (i10 == 6 || i10 == 7 || i10 == 2) {
bundle.putLong("_el", i11);
}
t6Var.a(str, bundle);
}
public final void D(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) {
this.f6903o.a().f6877y.d("Not putting event parameter. Invalid value type. name, type", this.f6903o.A.e(str), obj != null ? obj.getClass().getSimpleName() : null);
}
}
public final void E(c4.p0 p0Var, boolean z10) {
Bundle bundle = new Bundle();
bundle.putBoolean("r", z10);
try {
p0Var.s(bundle);
} catch (RemoteException e10) {
this.f6903o.a().f6876w.c("Error returning boolean value to wrapper", e10);
}
}
public final void F(c4.p0 p0Var, ArrayList arrayList) {
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("r", arrayList);
try {
p0Var.s(bundle);
} catch (RemoteException e10) {
this.f6903o.a().f6876w.c("Error returning bundle list to wrapper", e10);
}
}
public final void G(c4.p0 p0Var, Bundle bundle) {
try {
p0Var.s(bundle);
} catch (RemoteException e10) {
this.f6903o.a().f6876w.c("Error returning bundle value to wrapper", e10);
}
}
public final void H(c4.p0 p0Var, byte[] bArr) {
Bundle bundle = new Bundle();
bundle.putByteArray("r", bArr);
try {
p0Var.s(bundle);
} catch (RemoteException e10) {
this.f6903o.a().f6876w.c("Error returning byte array to wrapper", e10);
}
}
public final void I(c4.p0 p0Var, int i10) {
Bundle bundle = new Bundle();
bundle.putInt("r", i10);
try {
p0Var.s(bundle);
} catch (RemoteException e10) {
this.f6903o.a().f6876w.c("Error returning int value to wrapper", e10);
}
}
public final void J(c4.p0 p0Var, long j10) {
Bundle bundle = new Bundle();
bundle.putLong("r", j10);
try {
p0Var.s(bundle);
} catch (RemoteException e10) {
this.f6903o.a().f6876w.c("Error returning long value to wrapper", e10);
}
}
public final void K(c4.p0 p0Var, String str) {
Bundle bundle = new Bundle();
bundle.putString("r", str);
try {
p0Var.s(bundle);
} catch (RemoteException e10) {
this.f6903o.a().f6876w.c("Error returning string value to wrapper", e10);
}
}
public final void L(String str, String str2, String str3, Bundle bundle, List list, boolean z10) {
int m02;
String str4;
int O;
char c;
String str5;
if (bundle == null) {
return;
}
f fVar = this.f6903o.f6924u;
na.b();
String str6 = null;
char c10 = 20064;
int i10 = (fVar.f6903o.f6924u.v(null, s2.f7214s0) && fVar.f6903o.B().X(231100000)) ? 35 : 0;
Iterator it = new TreeSet(bundle.keySet()).iterator();
int i11 = 0;
while (it.hasNext()) {
String str7 = (String) it.next();
if (list == null || !list.contains(str7)) {
m02 = !z10 ? m0(str7) : 0;
if (m02 == 0) {
m02 = l0(str7);
}
} else {
m02 = 0;
}
if (m02 != 0) {
x(bundle, m02, str7, m02 == 3 ? str7 : str6);
bundle.remove(str7);
c = c10;
} else {
if (V(bundle.get(str7))) {
this.f6903o.a().f6877y.e("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str2, str3, str7);
O = 22;
str4 = str7;
} else {
str4 = str7;
O = O(str, str2, str7, bundle.get(str7), bundle, list, z10, false);
}
if (O != 0 && !"_ev".equals(str4)) {
x(bundle, O, str4, bundle.get(str4));
bundle.remove(str4);
} else if (Z(str4) && !h0(str4, h1.u.B)) {
int i12 = i11 + 1;
c = 20064;
if (!X(231100000)) {
this.f6903o.a().v.d("Item array not supported on client's version of Google Play Services (Android Only)", this.f6903o.A.d(str2), this.f6903o.A.b(bundle));
e0(bundle, 23);
bundle.remove(str4);
} else if (i12 > i10) {
na.b();
str5 = null;
if (this.f6903o.f6924u.v(null, s2.f7214s0)) {
this.f6903o.a().v.d(aa.p.t("Item can't contain more than ", i10, " item-scoped custom params"), this.f6903o.A.d(str2), this.f6903o.A.b(bundle));
e0(bundle, 28);
bundle.remove(str4);
} else {
this.f6903o.a().v.d("Item cannot contain custom parameters", this.f6903o.A.d(str2), this.f6903o.A.b(bundle));
e0(bundle, 23);
bundle.remove(str4);
}
i11 = i12;
str6 = str5;
}
str5 = null;
i11 = i12;
str6 = str5;
}
c = 20064;
str6 = null;
}
c10 = c;
}
}
public final boolean M(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 (this.f6903o.i()) {
this.f6903o.a().v.c("Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id", e3.u(str));
}
return false;
}
if (TextUtils.isEmpty(str2)) {
if (this.f6903o.i()) {
this.f6903o.a().v.b("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;
}
this.f6903o.a().v.c("Invalid admob_app_id. Analytics disabled.", e3.u(str2));
return false;
}
public final boolean N(String str, int i10, String str2) {
if (str2 == null) {
this.f6903o.a().v.c("Name is required and can't be null. Type", str);
return false;
}
if (str2.codePointCount(0, str2.length()) <= i10) {
return true;
}
this.f6903o.a().v.e("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
return false;
}
public final int O(String str, String str2, String str3, Object obj, Bundle bundle, List list, boolean z10, boolean z11) {
int i10;
int i11;
int size;
i();
if (V(obj)) {
if (!z11) {
return 21;
}
if (!h0(str3, h1.u.A)) {
return 20;
}
t5 z12 = this.f6903o.z();
z12.i();
z12.j();
if (z12.r() && z12.f6903o.B().o0() < 200900) {
return 25;
}
Objects.requireNonNull(this.f6903o);
boolean z13 = obj instanceof Parcelable[];
if (z13) {
size = ((Parcelable[]) obj).length;
} else if (obj instanceof ArrayList) {
size = ((ArrayList) obj).size();
}
if (size > 200) {
this.f6903o.a().f6877y.e("Parameter array is too long; discarded. Value kind, name, array length", "param", str3, Integer.valueOf(size));
Objects.requireNonNull(this.f6903o);
if (z13) {
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)));
}
}
i10 = 17;
if (!Y(str2) || Y(str3)) {
Objects.requireNonNull(this.f6903o);
i11 = 256;
} else {
Objects.requireNonNull(this.f6903o);
i11 = 100;
}
if (!Q("param", str3, i11, obj)) {
return i10;
}
if (!z11) {
return 4;
}
if (obj instanceof Bundle) {
L(str, str2, str3, (Bundle) obj, list, z10);
} else if (obj instanceof Parcelable[]) {
for (Parcelable parcelable : (Parcelable[]) obj) {
if (!(parcelable instanceof Bundle)) {
this.f6903o.a().f6877y.d("All Parcelable[] elements must be of type Bundle. Value type, name", parcelable.getClass(), str3);
return 4;
}
L(str, str2, str3, (Bundle) parcelable, list, z10);
}
} else {
if (!(obj instanceof ArrayList)) {
return 4;
}
ArrayList arrayList2 = (ArrayList) obj;
int size2 = arrayList2.size();
for (int i12 = 0; i12 < size2; i12++) {
Object obj2 = arrayList2.get(i12);
if (!(obj2 instanceof Bundle)) {
this.f6903o.a().f6877y.d("All ArrayList elements must be of type Bundle. Value type, name", obj2 != null ? obj2.getClass() : "null", str3);
return 4;
}
L(str, str2, str3, (Bundle) obj2, list, z10);
}
}
return i10;
}
}
i10 = 0;
if (Y(str2)) {
}
Objects.requireNonNull(this.f6903o);
i11 = 256;
if (!Q("param", str3, i11, obj)) {
}
}
public final boolean P(String str, String[] strArr, String[] strArr2, String str2) {
if (str2 == null) {
this.f6903o.a().v.c("Name is required and can't be null. Type", str);
return false;
}
String[] strArr3 = f7261u;
for (int i10 = 0; i10 < 3; i10++) {
if (str2.startsWith(strArr3[i10])) {
this.f6903o.a().v.d("Name starts with reserved prefix. Type, name", str, str2);
return false;
}
}
if (strArr == null || !h0(str2, strArr)) {
return true;
}
if (strArr2 != null && h0(str2, strArr2)) {
return true;
}
this.f6903o.a().v.d("Name is reserved. Type, name", str, str2);
return false;
}
public final boolean Q(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 obj2 = obj.toString();
if (obj2.codePointCount(0, obj2.length()) > i10) {
this.f6903o.a().f6877y.e("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
return false;
}
}
return true;
}
public final boolean R(String str, String str2) {
if (str2 == null) {
this.f6903o.a().v.c("Name is required and can't be null. Type", str);
return false;
}
if (str2.length() == 0) {
this.f6903o.a().v.c("Name is required and can't be empty. Type", str);
return false;
}
int codePointAt = str2.codePointAt(0);
if (!Character.isLetter(codePointAt)) {
if (codePointAt != 95) {
this.f6903o.a().v.d("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)) {
this.f6903o.a().v.d("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, String str2) {
if (str2 == null) {
this.f6903o.a().v.c("Name is required and can't be null. Type", str);
return false;
}
if (str2.length() == 0) {
this.f6903o.a().v.c("Name is required and can't be empty. Type", str);
return false;
}
int codePointAt = str2.codePointAt(0);
if (!Character.isLetter(codePointAt)) {
this.f6903o.a().v.d("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)) {
this.f6903o.a().v.d("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
return false;
}
charCount += Character.charCount(codePointAt2);
}
return true;
}
public final boolean T(String str) {
i();
if (s3.c.a(this.f6903o.f6918o).f11867a.checkCallingOrSelfPermission(str) == 0) {
return true;
}
this.f6903o.a().A.c("Permission not granted", str);
return false;
}
public final boolean U(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
String k10 = this.f6903o.f6924u.k("debug.firebase.analytics.app");
Objects.requireNonNull(this.f6903o);
return k10.equals(str);
}
public final boolean V(Object obj) {
return (obj instanceof Parcelable[]) || (obj instanceof ArrayList) || (obj instanceof Bundle);
}
public final boolean W(Context context, String str) {
Signature[] signatureArr;
X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
try {
PackageInfo b10 = s3.c.a(context).b(str, 64);
if (b10 == null || (signatureArr = b10.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) {
this.f6903o.a().f6874t.c("Package name not found", e10);
return true;
} catch (CertificateException e11) {
this.f6903o.a().f6874t.c("Error obtaining certificate", e11);
return true;
}
}
public final boolean X(int i10) {
Boolean bool = this.f6903o.z().f7248s;
return o0() >= i10 / 1000 || !(bool == null || bool.booleanValue());
}
public final boolean c0(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[] d0(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 f0(String str) {
if ("_ldl".equals(str)) {
Objects.requireNonNull(this.f6903o);
return 2048;
}
if ("_id".equals(str)) {
Objects.requireNonNull(this.f6903o);
return 256;
}
if ("_lgclid".equals(str)) {
Objects.requireNonNull(this.f6903o);
return 100;
}
Objects.requireNonNull(this.f6903o);
return 36;
}
public final Object g0(int i10, Object obj, boolean z10, boolean z11) {
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(), i10, z10);
}
if (!z11 || (!(obj instanceof Bundle[]) && !(obj instanceof Parcelable[]))) {
return null;
}
ArrayList arrayList = new ArrayList();
for (Parcelable parcelable : (Parcelable[]) obj) {
if (parcelable instanceof Bundle) {
Bundle t02 = t0((Bundle) parcelable);
if (!t02.isEmpty()) {
arrayList.add(t02);
}
}
}
return arrayList.toArray(new Bundle[arrayList.size()]);
}
@Override
public final void j() {
i();
SecureRandom secureRandom = new SecureRandom();
long nextLong = secureRandom.nextLong();
if (nextLong == 0) {
nextLong = secureRandom.nextLong();
if (nextLong == 0) {
this.f6903o.a().f6876w.b("Utils falling back to Random for random id");
}
}
this.f7263r.set(nextLong);
}
public final int j0(String str, Object obj) {
return "_ldl".equals(str) ? Q("user property referrer", str, f0(str), obj) : Q("user property", str, f0(str), obj) ? 0 : 7;
}
@Override
public final boolean k() {
return true;
}
public final int k0(String str) {
if (!R("event", str)) {
return 2;
}
if (!P("event", de.t.f5455t, de.t.f5456u, str)) {
return 13;
}
Objects.requireNonNull(this.f6903o);
return !N("event", 40, str) ? 2 : 0;
}
public final int l0(String str) {
if (!R("event param", str)) {
return 3;
}
if (!P("event param", null, null, str)) {
return 14;
}
Objects.requireNonNull(this.f6903o);
return !N("event param", 40, str) ? 3 : 0;
}
public final int m0(String str) {
if (!S("event param", str)) {
return 3;
}
if (!P("event param", null, null, str)) {
return 14;
}
Objects.requireNonNull(this.f6903o);
return !N("event param", 40, str) ? 3 : 0;
}
public final int n0(String str) {
if (!R("user property", str)) {
return 6;
}
if (!P("user property", h6.b.f6480u, null, str)) {
return 15;
}
Objects.requireNonNull(this.f6903o);
return !N("user property", 24, str) ? 6 : 0;
}
public final int o0() {
if (this.f7265t == null) {
i3.f fVar = i3.f.f6751b;
Context context = this.f6903o.f6918o;
Objects.requireNonNull(fVar);
AtomicBoolean atomicBoolean = i3.j.f6753a;
int i10 = 0;
try {
i10 = context.getPackageManager().getPackageInfo("com.google.android.gms", 0).versionCode;
} catch (PackageManager.NameNotFoundException unused) {
Log.w("GooglePlayServicesUtil", "Google Play services is missing.");
}
this.f7265t = Integer.valueOf(i10 / 1000);
}
return this.f7265t.intValue();
}
public final Object p(String str, Object obj) {
int i10 = 256;
if ("_ev".equals(str)) {
Objects.requireNonNull(this.f6903o);
return g0(256, obj, true, true);
}
if (Y(str)) {
Objects.requireNonNull(this.f6903o);
} else {
Objects.requireNonNull(this.f6903o);
i10 = 100;
}
return g0(i10, obj, false, true);
}
public final Object q(String str, Object obj) {
return "_ldl".equals(str) ? g0(f0(str), obj, true, false) : g0(f0(str), obj, false, false);
}
public final long q0() {
long andIncrement;
long j10;
if (this.f7263r.get() != 0) {
synchronized (this.f7263r) {
this.f7263r.compareAndSet(-1L, 1L);
andIncrement = this.f7263r.getAndIncrement();
}
return andIncrement;
}
synchronized (this.f7263r) {
long nanoTime = System.nanoTime();
Objects.requireNonNull(this.f6903o.B);
long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
int i10 = this.f7264s + 1;
this.f7264s = i10;
j10 = nextLong + i10;
}
return j10;
}
public final String r() {
byte[] bArr = new byte[16];
u().nextBytes(bArr);
return String.format(Locale.US, "%032x", new BigInteger(1, bArr));
}
public final long r0(long j10, long j11) {
return ((j11 * 60000) + j10) / 86400000;
}
public final String s(String str, int i10, boolean z10) {
if (str == null) {
return null;
}
if (str.codePointCount(0, str.length()) <= i10) {
return str;
}
if (z10) {
return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i10))).concat("...");
}
return null;
}
public final Bundle s0(Uri uri, boolean z10) {
String str;
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
String str8;
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 = uri.getQueryParameter("utm_id");
str6 = uri.getQueryParameter("dclid");
str7 = uri.getQueryParameter("srsltid");
str8 = z10 ? uri.getQueryParameter("sfmc_id") : null;
} else {
str = null;
str2 = null;
str3 = null;
str4 = null;
str5 = null;
str6 = null;
str7 = null;
str8 = null;
}
if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6) && TextUtils.isEmpty(str7) && (!z10 || TextUtils.isEmpty(str8))) {
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 (!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 (!TextUtils.isEmpty(str7)) {
bundle.putString("srsltid", str7);
}
if (z10 && !TextUtils.isEmpty(str8)) {
bundle.putString("sfmc_id", str8);
}
return bundle;
} catch (UnsupportedOperationException e10) {
this.f6903o.a().f6876w.c("Install referrer url isn't a hierarchical URI", e10);
return null;
}
}
public final Bundle t0(Bundle bundle) {
Bundle bundle2 = new Bundle();
if (bundle != null) {
for (String str : bundle.keySet()) {
Object p10 = p(str, bundle.get(str));
if (p10 == null) {
this.f6903o.a().f6877y.c("Param value can't be null", this.f6903o.A.e(str));
} else {
D(bundle2, str, p10);
}
}
}
return bundle2;
}
public final SecureRandom u() {
i();
if (this.f7262q == null) {
this.f7262q = new SecureRandom();
}
return this.f7262q;
}
public final Bundle u0(String str, String str2, Bundle bundle, List list, boolean z10) {
int m02;
List list2 = list;
boolean h02 = h0(str2, de.t.f5457w);
if (bundle == null) {
return null;
}
Bundle bundle2 = new Bundle(bundle);
int n10 = this.f6903o.f6924u.n();
Iterator it = new TreeSet(bundle.keySet()).iterator();
int i10 = 0;
while (it.hasNext()) {
String str3 = (String) it.next();
if (list2 == null || !list2.contains(str3)) {
m02 = !z10 ? m0(str3) : 0;
if (m02 == 0) {
m02 = l0(str3);
}
} else {
m02 = 0;
}
if (m02 != 0) {
x(bundle2, m02, str3, m02 == 3 ? str3 : null);
bundle2.remove(str3);
} else {
int O = O(str, str2, str3, bundle.get(str3), bundle2, list, z10, h02);
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 (Z(str3)) {
int i11 = i10 + 1;
if (i11 > n10) {
this.f6903o.a().v.d(aa.p.t("Event can't contain more than ", n10, " params"), this.f6903o.A.d(str2), this.f6903o.A.b(bundle));
e0(bundle2, 5);
bundle2.remove(str3);
}
i10 = i11;
}
}
list2 = list;
}
return bundle2;
}
public final s v0(String str, String str2, Bundle bundle, String str3, long j10, boolean z10) {
if (TextUtils.isEmpty(str2)) {
return null;
}
if (k0(str2) != 0) {
this.f6903o.a().f6874t.c("Invalid conditional property event name", this.f6903o.A.f(str2));
throw new IllegalArgumentException();
}
Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
bundle2.putString("_o", str3);
Bundle u0 = u0(str, str2, bundle2, Collections.singletonList("_o"), true);
if (z10) {
u0 = t0(u0);
}
l3.p.h(u0);
return new s(str2, new q(u0), str3, j10);
}
public final void w(Bundle bundle, long j10) {
long j11 = bundle.getLong("_et");
if (j11 != 0) {
this.f6903o.a().f6876w.c("Params already contained engagement", Long.valueOf(j11));
} else {
j11 = 0;
}
bundle.putLong("_et", j10 + j11);
}
public final void x(Bundle bundle, int i10, String str, Object obj) {
if (e0(bundle, i10)) {
Objects.requireNonNull(this.f6903o);
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)) {
this.f6903o.B().D(bundle, str, bundle2.get(str));
}
}
}
}