PicWish v1.6.8版本的 MD5 值为:7e8bab240f03cf6dad8952f8374c4ed1
以下内容为反编译后的 d7.java 源代码,内容仅作参考
package l6;
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 androidx.annotation.WorkerThread;
import androidx.core.app.NotificationCompat;
import com.alibaba.sdk.android.oss.common.OSSHeaders;
import com.facebook.AuthenticationTokenClaims;
import com.google.android.gms.measurement.internal.zzac;
import com.google.android.gms.measurement.internal.zzau;
import com.google.android.gms.measurement.internal.zzaw;
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 d7 extends f4 {
public static final String[] f10266r = {"firebase_", "google_", "ga_"};
public static final String[] f10267s = {"_err"};
public SecureRandom f10268n;
public final AtomicLong f10269o;
public int p;
public Integer f10270q;
public d7(p3 p3Var) {
super(p3Var);
this.f10270q = null;
this.f10269o = new AtomicLong(0L);
}
public static boolean W(String str) {
return !TextUtils.isEmpty(str) && str.startsWith("_");
}
public static boolean X(String str) {
h5.l.f(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 Build.VERSION.SDK_INT >= 24 ? g0(context, "com.google.android.gms.measurement.AppMeasurementJobService") : g0(context, "com.google.android.gms.measurement.AppMeasurementService");
}
public static final boolean c0(Bundle bundle, int i10) {
if (bundle.getLong("_err") == 0) {
bundle.putLong("_err", i10);
return true;
}
return false;
}
public static boolean f0(String str, String[] strArr) {
Objects.requireNonNull(strArr, "null reference");
int length = strArr.length;
for (int i10 = 0; i10 < length; i10++) {
String str2 = strArr[i10];
if (str == str2 || (str != null && str.equals(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 i10 = 0;
h5.l.k(length > 0);
long j10 = 0;
for (int i11 = length - 1; i11 >= 0 && i11 >= bArr.length - 8; i11--) {
j10 += (bArr[i11] & 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()) {
zzac zzacVar = (zzac) it.next();
Bundle bundle = new Bundle();
bundle.putString("app_id", zzacVar.zza);
bundle.putString(OSSHeaders.ORIGIN, zzacVar.zzb);
bundle.putLong("creation_timestamp", zzacVar.zzd);
bundle.putString(AuthenticationTokenClaims.JSON_KEY_NAME, zzacVar.zzc.zzb);
Object zza = zzacVar.zzc.zza();
Objects.requireNonNull(zza, "null reference");
i4.c(bundle, zza);
bundle.putBoolean("active", zzacVar.zze);
String str = zzacVar.zzf;
if (str != null) {
bundle.putString("trigger_event_name", str);
}
zzaw zzawVar = zzacVar.zzg;
if (zzawVar != null) {
bundle.putString("timed_out_event_name", zzawVar.zza);
zzau zzauVar = zzawVar.zzb;
if (zzauVar != null) {
bundle.putBundle("timed_out_event_params", zzauVar.zzc());
}
}
bundle.putLong("trigger_timeout", zzacVar.zzh);
zzaw zzawVar2 = zzacVar.zzi;
if (zzawVar2 != null) {
bundle.putString("triggered_event_name", zzawVar2.zza);
zzau zzauVar2 = zzawVar2.zzb;
if (zzauVar2 != null) {
bundle.putBundle("triggered_event_params", zzauVar2.zzc());
}
}
bundle.putLong("triggered_timestamp", zzacVar.zzc.zzc);
bundle.putLong("time_to_live", zzacVar.zzj);
zzaw zzawVar3 = zzacVar.zzk;
if (zzawVar3 != null) {
bundle.putString("expired_event_name", zzawVar3.zza);
zzau zzauVar3 = zzawVar3.zzb;
if (zzauVar3 != null) {
bundle.putBundle("expired_event_params", zzauVar3.zzc());
}
}
arrayList.add(bundle);
}
return arrayList;
}
@WorkerThread
public static void y(h5 h5Var, Bundle bundle, boolean z10) {
if (bundle != null && h5Var != null) {
if (!bundle.containsKey("_sc") || z10) {
String str = h5Var.f10361a;
if (str != null) {
bundle.putString("_sn", str);
} else {
bundle.remove("_sn");
}
String str2 = h5Var.f10362b;
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(j2 j2Var, int i10) {
Iterator it = new TreeSet(j2Var.f10398d.keySet()).iterator();
int i11 = 0;
while (it.hasNext()) {
String str = (String) it.next();
if (X(str) && (i11 = i11 + 1) > i10) {
((p3) this.f10277l).b().f10377s.c(android.support.v4.media.a.a("Event can't contain more than ", i10, " params").toString(), ((p3) this.f10277l).f10556x.d(j2Var.f10396a), ((p3) this.f10277l).f10556x.b(j2Var.f10398d));
c0(j2Var.f10398d, 5);
j2Var.f10398d.remove(str);
}
}
}
public final void B(c7 c7Var, String str, int i10, String str2, String str3, int i11) {
Bundle bundle = new Bundle();
c0(bundle, i10);
if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
bundle.putString(str2, str3);
}
if (i10 == 6 || i10 == 7 || i10 == 2) {
bundle.putLong("_el", i11);
}
c7Var.a(str, 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());
} 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) {
((p3) this.f10277l).b().f10380v.c("Not putting event parameter. Invalid value type. name, type", ((p3) this.f10277l).f10556x.e(str), obj != null ? obj.getClass().getSimpleName() : null);
}
}
public final void D(c6.x0 x0Var, boolean z10) {
Bundle bundle = new Bundle();
bundle.putBoolean("r", z10);
try {
x0Var.b(bundle);
} catch (RemoteException e10) {
((p3) this.f10277l).b().f10378t.b("Error returning boolean value to wrapper", e10);
}
}
public final void E(c6.x0 x0Var, ArrayList arrayList) {
Bundle bundle = new Bundle();
bundle.putParcelableArrayList("r", arrayList);
try {
x0Var.b(bundle);
} catch (RemoteException e10) {
((p3) this.f10277l).b().f10378t.b("Error returning bundle list to wrapper", e10);
}
}
public final void F(c6.x0 x0Var, Bundle bundle) {
try {
x0Var.b(bundle);
} catch (RemoteException e10) {
((p3) this.f10277l).b().f10378t.b("Error returning bundle value to wrapper", e10);
}
}
public final void G(c6.x0 x0Var, byte[] bArr) {
Bundle bundle = new Bundle();
bundle.putByteArray("r", bArr);
try {
x0Var.b(bundle);
} catch (RemoteException e10) {
((p3) this.f10277l).b().f10378t.b("Error returning byte array to wrapper", e10);
}
}
public final void H(c6.x0 x0Var, int i10) {
Bundle bundle = new Bundle();
bundle.putInt("r", i10);
try {
x0Var.b(bundle);
} catch (RemoteException e10) {
((p3) this.f10277l).b().f10378t.b("Error returning int value to wrapper", e10);
}
}
public final void I(c6.x0 x0Var, long j10) {
Bundle bundle = new Bundle();
bundle.putLong("r", j10);
try {
x0Var.b(bundle);
} catch (RemoteException e10) {
((p3) this.f10277l).b().f10378t.b("Error returning long value to wrapper", e10);
}
}
public final void J(c6.x0 x0Var, String str) {
Bundle bundle = new Bundle();
bundle.putString("r", str);
try {
x0Var.b(bundle);
} catch (RemoteException e10) {
((p3) this.f10277l).b().f10378t.b("Error returning string value to wrapper", e10);
}
}
public final void K(String str, String str2, String str3, Bundle bundle, List list, boolean z10) {
int k02;
String str4;
int O;
if (bundle == null) {
return;
}
Objects.requireNonNull((p3) this.f10277l);
Iterator it = new TreeSet(bundle.keySet()).iterator();
int i10 = 0;
while (it.hasNext()) {
String str5 = (String) it.next();
if (list == null || !list.contains(str5)) {
k02 = !z10 ? 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))) {
((p3) this.f10277l).b().f10380v.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, z10, false);
}
if (O != 0 && !"_ev".equals(str4)) {
x(bundle, O, str4, bundle.get(str4));
bundle.remove(str4);
} else if (X(str4) && !f0(str4, x.p) && (i10 = i10 + 1) > 0) {
((p3) this.f10277l).b().f10377s.c("Item cannot contain custom parameters", ((p3) this.f10277l).f10556x.d(str2), ((p3) this.f10277l).f10556x.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 (((p3) this.f10277l).i()) {
((p3) this.f10277l).b().f10377s.b("Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id", i2.u(str));
}
return false;
} else if (TextUtils.isEmpty(str2)) {
if (((p3) this.f10277l).i()) {
((p3) this.f10277l).b().f10377s.a("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
}
return false;
} else {
Objects.requireNonNull(str2, "null reference");
if (str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
return true;
}
((p3) this.f10277l).b().f10377s.b("Invalid admob_app_id. Analytics disabled.", i2.u(str2));
return false;
}
}
public final boolean M(String str, int i10, String str2) {
if (str2 == null) {
((p3) this.f10277l).b().f10377s.b("Name is required and can't be null. Type", str);
return false;
} else if (str2.codePointCount(0, str2.length()) > i10) {
((p3) this.f10277l).b().f10377s.d("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i10), str2);
return false;
} else {
return true;
}
}
public final boolean N(String str, String[] strArr, String[] strArr2, String str2) {
if (str2 == null) {
((p3) this.f10277l).b().f10377s.b("Name is required and can't be null. Type", str);
return false;
}
String[] strArr3 = f10266r;
for (int i10 = 0; i10 < 3; i10++) {
if (str2.startsWith(strArr3[i10])) {
((p3) this.f10277l).b().f10377s.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)) {
((p3) this.f10277l).b().f10377s.c("Name is reserved. Type, name", str, str2);
return false;
}
return true;
}
@WorkerThread
public final int O(String str, String str2, String str3, Object obj, Bundle bundle, List list, boolean z10, boolean z11) {
int i10;
int i11;
Parcelable[] parcelableArr;
int size;
i();
if (U(obj)) {
if (!z11) {
return 21;
}
if (!f0(str3, x.f10776o)) {
return 20;
}
x5 z12 = ((p3) this.f10277l).z();
z12.i();
z12.j();
if (z12.r() && ((p3) z12.f10277l).B().m0() < 200900) {
return 25;
}
Objects.requireNonNull((p3) this.f10277l);
boolean z13 = obj instanceof Parcelable[];
if (z13) {
size = ((Parcelable[]) obj).length;
} else if (obj instanceof ArrayList) {
size = ((ArrayList) obj).size();
}
if (size > 200) {
((p3) this.f10277l).b().f10380v.d("Parameter array is too long; discarded. Value kind, name, array length", "param", str3, Integer.valueOf(size));
Objects.requireNonNull((p3) this.f10277l);
if (z13) {
Parcelable[] parcelableArr2 = (Parcelable[]) obj;
if (parcelableArr2.length > 200) {
bundle.putParcelableArray(str3, (Parcelable[]) Arrays.copyOf(parcelableArr2, 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 (!W(str2) || W(str3)) {
Objects.requireNonNull((p3) this.f10277l);
i11 = 256;
} else {
Objects.requireNonNull((p3) this.f10277l);
i11 = 100;
}
if (P("param", str3, i11, obj)) {
if (z11) {
if (obj instanceof Bundle) {
K(str, str2, str3, (Bundle) obj, list, z10);
} else if (obj instanceof Parcelable[]) {
for (Parcelable parcelable : (Parcelable[]) obj) {
if (!(parcelable instanceof Bundle)) {
((p3) this.f10277l).b().f10380v.c("All Parcelable[] elements must be of type Bundle. Value type, name", parcelable.getClass(), str3);
return 4;
}
K(str, str2, str3, (Bundle) parcelable, list, z10);
}
} else if (!(obj instanceof ArrayList)) {
return 4;
} else {
ArrayList arrayList2 = (ArrayList) obj;
int size2 = arrayList2.size();
for (int i12 = 0; i12 < size2; i12++) {
Object obj2 = arrayList2.get(i12);
if (!(obj2 instanceof Bundle)) {
((p3) this.f10277l).b().f10380v.c("All ArrayList elements must be of type Bundle. Value type, name", obj2 != null ? obj2.getClass() : "null", str3);
return 4;
}
K(str, str2, str3, (Bundle) obj2, list, z10);
}
}
return i10;
}
return 4;
}
return i10;
}
}
i10 = 0;
if (W(str2)) {
}
Objects.requireNonNull((p3) this.f10277l);
i11 = 256;
if (P("param", str3, i11, obj)) {
}
}
public final boolean P(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) {
((p3) this.f10277l).b().f10380v.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) {
((p3) this.f10277l).b().f10377s.b("Name is required and can't be null. Type", str);
return false;
} else if (str2.length() == 0) {
((p3) this.f10277l).b().f10377s.b("Name is required and can't be empty. Type", str);
return false;
} else {
int codePointAt = str2.codePointAt(0);
if (!Character.isLetter(codePointAt)) {
if (codePointAt != 95) {
((p3) this.f10277l).b().f10377s.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)) {
((p3) this.f10277l).b().f10377s.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) {
((p3) this.f10277l).b().f10377s.b("Name is required and can't be null. Type", str);
return false;
} else if (str2.length() == 0) {
((p3) this.f10277l).b().f10377s.b("Name is required and can't be empty. Type", str);
return false;
} else {
int codePointAt = str2.codePointAt(0);
if (!Character.isLetter(codePointAt)) {
((p3) this.f10277l).b().f10377s.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)) {
((p3) this.f10277l).b().f10377s.c("Name must consist of letters, digits or _ (underscores). Type, name", str, str2);
return false;
}
charCount += Character.charCount(codePointAt2);
}
return true;
}
}
@WorkerThread
public final boolean S(String str) {
i();
if (r5.c.a(((p3) this.f10277l).f10545l).f12504a.checkCallingOrSelfPermission(str) == 0) {
return true;
}
((p3) this.f10277l).b().f10382x.b("Permission not granted", str);
return false;
}
public final boolean T(String str) {
if (TextUtils.isEmpty(str)) {
return false;
}
String k10 = ((p3) this.f10277l).f10550r.k("debug.firebase.analytics.app");
Objects.requireNonNull((p3) this.f10277l);
return k10.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) {
Signature[] signatureArr;
X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
try {
PackageInfo b10 = r5.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) {
((p3) this.f10277l).b().f10375q.b("Package name not found", e10);
return true;
} catch (CertificateException e11) {
((p3) this.f10277l).b().f10375q.b("Error obtaining certificate", e11);
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);
} else if (isEmpty && isEmpty2) {
return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
} else if (isEmpty) {
return TextUtils.isEmpty(str3) || !str3.equals(str4);
} else if (TextUtils.isEmpty(str4)) {
return false;
} else {
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((p3) this.f10277l);
return 2048;
} else if ("_id".equals(str)) {
Objects.requireNonNull((p3) this.f10277l);
return 256;
} else if ("_lgclid".equals(str)) {
Objects.requireNonNull((p3) this.f10277l);
return 100;
} else {
Objects.requireNonNull((p3) this.f10277l);
return 36;
}
}
public final Object e0(int i10, Object obj, boolean z10, boolean z11) {
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(true != ((Boolean) obj).booleanValue() ? 0L : 1L);
} else if (obj instanceof Float) {
return Double.valueOf(((Float) obj).doubleValue());
} else {
if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
return s(obj.toString(), i10, z10);
}
if (z11 && ((obj instanceof Bundle[]) || (obj instanceof Parcelable[]))) {
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()]);
}
return null;
}
}
public final int h0(String str, Object obj) {
return "_ldl".equals(str) ? P("user property referrer", str, d0(str), obj) : P("user property", str, d0(str), obj) ? 0 : 7;
}
public final int i0(String str) {
if (Q(NotificationCompat.CATEGORY_EVENT, str)) {
if (N(NotificationCompat.CATEGORY_EVENT, j3.a.p, j3.a.f9307q, str)) {
Objects.requireNonNull((p3) this.f10277l);
return !M(NotificationCompat.CATEGORY_EVENT, 40, str) ? 2 : 0;
}
return 13;
}
return 2;
}
@Override
@WorkerThread
public final void j() {
i();
SecureRandom secureRandom = new SecureRandom();
long nextLong = secureRandom.nextLong();
if (nextLong == 0) {
nextLong = secureRandom.nextLong();
if (nextLong == 0) {
((p3) this.f10277l).b().f10378t.a("Utils falling back to Random for random id");
}
}
this.f10269o.set(nextLong);
}
public final int j0(String str) {
if (Q("event param", str)) {
if (N("event param", null, null, str)) {
Objects.requireNonNull((p3) this.f10277l);
return !M("event param", 40, str) ? 3 : 0;
}
return 14;
}
return 3;
}
@Override
public final boolean k() {
return true;
}
public final int k0(String str) {
if (R("event param", str)) {
if (N("event param", null, null, str)) {
Objects.requireNonNull((p3) this.f10277l);
return !M("event param", 40, str) ? 3 : 0;
}
return 14;
}
return 3;
}
public final int l0(String str) {
if (Q("user property", str)) {
if (N("user property", y.f10810m, null, str)) {
Objects.requireNonNull((p3) this.f10277l);
return !M("user property", 24, str) ? 6 : 0;
}
return 15;
}
return 6;
}
@EnsuresNonNull({"this.apkVersion"})
public final int m0() {
if (this.f10270q == null) {
d5.d dVar = d5.d.f6458b;
Context context = ((p3) this.f10277l).f10545l;
Objects.requireNonNull(dVar);
AtomicBoolean atomicBoolean = d5.h.f6460a;
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.f10270q = Integer.valueOf(i10 / 1000);
}
return this.f10270q.intValue();
}
public final long o0() {
long andIncrement;
long j10;
if (this.f10269o.get() != 0) {
synchronized (this.f10269o) {
this.f10269o.compareAndSet(-1L, 1L);
andIncrement = this.f10269o.getAndIncrement();
}
return andIncrement;
}
synchronized (this.f10269o) {
long nanoTime = System.nanoTime();
Objects.requireNonNull(((p3) this.f10277l).f10557y);
long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
int i10 = this.p + 1;
this.p = i10;
j10 = nextLong + i10;
}
return j10;
}
public final Object p(String str, Object obj) {
int i10 = 256;
if ("_ev".equals(str)) {
Objects.requireNonNull((p3) this.f10277l);
return e0(256, obj, true, true);
}
if (W(str)) {
Objects.requireNonNull((p3) this.f10277l);
} else {
Objects.requireNonNull((p3) this.f10277l);
i10 = 100;
}
return e0(i10, obj, false, true);
}
public final long p0(long j10, long j11) {
return ((j11 * 60000) + j10) / 86400000;
}
public final Object q(String str, Object obj) {
return "_ldl".equals(str) ? e0(d0(str), obj, true, false) : e0(d0(str), obj, false, false);
}
public final Bundle q0(Uri uri, boolean z10, boolean z11) {
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 (z10) {
str5 = uri.getQueryParameter("utm_id");
str6 = uri.getQueryParameter("dclid");
} else {
str5 = null;
str6 = null;
}
str7 = z11 ? 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) && ((!z10 || (TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6))) && (!z11 || 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 (z10) {
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 (z11 && !TextUtils.isEmpty(str7)) {
bundle.putString("srsltid", str7);
}
return bundle;
} catch (UnsupportedOperationException e10) {
((p3) this.f10277l).b().f10378t.b("Install referrer url isn't a hierarchical URI", e10);
}
}
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 p = p(str, bundle.get(str));
if (p == null) {
((p3) this.f10277l).b().f10380v.b("Param value can't be null", ((p3) this.f10277l).f10556x.e(str));
} else {
C(bundle2, str, p);
}
}
}
return bundle2;
}
public final String s(String str, int i10, boolean z10) {
if (str == null) {
return null;
}
if (str.codePointCount(0, str.length()) > i10) {
if (z10) {
return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i10))).concat("...");
}
return null;
}
return str;
}
public final Bundle s0(String str, String str2, Bundle bundle, List list, boolean z10) {
int k02;
List list2 = list;
boolean f02 = f0(str2, j3.a.f9309s);
if (bundle != null) {
Bundle bundle2 = new Bundle(bundle);
int n10 = ((p3) this.f10277l).f10550r.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)) {
k02 = !z10 ? 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, z10, 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 i11 = i10 + 1;
if (i11 > n10) {
((p3) this.f10277l).b().f10377s.c(android.support.v4.media.a.a("Event can't contain more than ", n10, " params").toString(), ((p3) this.f10277l).f10556x.d(str2), ((p3) this.f10277l).f10556x.b(bundle));
c0(bundle2, 5);
bundle2.remove(str3);
}
i10 = i11;
}
}
list2 = list;
}
return bundle2;
}
return null;
}
public final zzaw t0(String str, String str2, Bundle bundle, String str3, long j10, boolean z10) {
if (TextUtils.isEmpty(str2)) {
return null;
}
if (i0(str2) != 0) {
((p3) this.f10277l).b().f10375q.b("Invalid conditional property event name", ((p3) this.f10277l).f10556x.f(str2));
throw new IllegalArgumentException();
}
Bundle bundle2 = bundle != null ? new Bundle(bundle) : new Bundle();
bundle2.putString("_o", str3);
Bundle s02 = s0(str, str2, bundle2, Collections.singletonList("_o"), true);
if (z10) {
s02 = r0(s02);
}
h5.l.i(s02);
return new zzaw(str2, new zzau(s02), str3, j10);
}
@EnsuresNonNull({"this.secureRandom"})
@WorkerThread
public final SecureRandom u() {
i();
if (this.f10268n == null) {
this.f10268n = new SecureRandom();
}
return this.f10268n;
}
@WorkerThread
public final void w(Bundle bundle, long j10) {
long j11 = bundle.getLong("_et");
if (j11 != 0) {
((p3) this.f10277l).b().f10378t.b("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 (c0(bundle, i10)) {
Objects.requireNonNull((p3) this.f10277l);
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)) {
((p3) this.f10277l).B().C(bundle, str, bundle2.get(str));
}
}
}
}