PicWish v1.6.8版本的 MD5 值为:7e8bab240f03cf6dad8952f8374c4ed1

以下内容为反编译后的 c5.java 源代码,内容仅作参考


package l6;

import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Pair;
import androidx.annotation.GuardedBy;
import androidx.annotation.WorkerThread;
import androidx.core.app.NotificationCompat;
import c6.ac;
import c6.bb;
import c6.sa;
import c6.xb;
import com.alibaba.sdk.android.oss.common.OSSHeaders;
import com.apowersoft.plugin.asm.privacy.AsmPrivacyHookHelper;
import com.facebook.AuthenticationTokenClaims;
import com.google.android.gms.measurement.internal.AppMeasurementDynamiteService;
import com.google.android.gms.measurement.internal.zzau;
import com.google.android.gms.measurement.internal.zzaw;
import com.google.android.gms.measurement.internal.zzli;
import com.google.android.gms.measurement.internal.zzq;
import java.net.MalformedURLException;
import java.net.URL;
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.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import l6.c5;
import l6.d7;
import l6.f5;
import l6.g5;
import l6.n3;
import l6.p3;
import l6.w1;
import l6.w2;
import u4.a;
public final class c5 extends n2 {
    public final n3 A;
    public b5 f10245n;
    public f7 f10246o;
    public final CopyOnWriteArraySet p;
    public boolean f10247q;
    public final AtomicReference f10248r;
    public final Object f10249s;
    @GuardedBy("consentLock")
    public g f10250t;
    @GuardedBy("consentLock")
    public int f10251u;
    public final AtomicLong f10252v;
    public long f10253w;
    public int f10254x;
    public final i7 f10255y;
    public boolean f10256z;

    public c5(p3 p3Var) {
        super(p3Var);
        this.p = new CopyOnWriteArraySet();
        this.f10249s = new Object();
        this.f10256z = true;
        this.A = new n3(this);
        this.f10248r = new AtomicReference();
        this.f10250t = new g(null, null);
        this.f10251u = 100;
        this.f10253w = -1L;
        this.f10254x = 100;
        this.f10252v = new AtomicLong(0L);
        this.f10255y = new i7(p3Var);
    }

    public static void J(c5 c5Var, g gVar, g gVar2) {
        boolean z10;
        f fVar = f.AD_STORAGE;
        f fVar2 = f.ANALYTICS_STORAGE;
        f[] fVarArr = {fVar2, fVar};
        int i10 = 0;
        while (true) {
            if (i10 >= 2) {
                z10 = false;
                break;
            }
            f fVar3 = fVarArr[i10];
            if (!gVar2.f(fVar3) && gVar.f(fVar3)) {
                z10 = true;
                break;
            }
            i10++;
        }
        boolean g10 = gVar.g(gVar2, fVar2, fVar);
        if (z10 || g10) {
            ((p3) c5Var.f10277l).r().p();
        }
    }

    public static void K(c5 c5Var, g gVar, int i10, long j10, boolean z10, boolean z11) {
        c5Var.i();
        c5Var.j();
        if (j10 <= c5Var.f10253w) {
            int i11 = c5Var.f10254x;
            g gVar2 = g.f10309b;
            if (i11 <= i10) {
                ((p3) c5Var.f10277l).b().f10381w.b("Dropped out-of-date consent setting, proposed settings", gVar);
                return;
            }
        }
        w2 u10 = ((p3) c5Var.f10277l).u();
        g4 g4Var = u10.f10277l;
        u10.i();
        if (!u10.v(i10)) {
            ((p3) c5Var.f10277l).b().f10381w.b("Lower precedence consent source ignored, proposed source", Integer.valueOf(i10));
            return;
        }
        SharedPreferences.Editor edit = u10.p().edit();
        edit.putString("consent_settings", gVar.e());
        edit.putInt("consent_source", i10);
        edit.apply();
        c5Var.f10253w = j10;
        c5Var.f10254x = i10;
        x5 z12 = ((p3) c5Var.f10277l).z();
        z12.i();
        z12.j();
        if (z10) {
            z12.w();
            ((p3) z12.f10277l).s().n();
        }
        if (z12.q()) {
            z12.v(new w3(z12, z12.s(false), 1));
        }
        if (z11) {
            ((p3) c5Var.f10277l).z().B(new AtomicReference());
        }
    }

    @WorkerThread
    public final void A(f7 f7Var) {
        f7 f7Var2;
        i();
        j();
        if (f7Var != null && f7Var != (f7Var2 = this.f10246o)) {
            h5.l.l(f7Var2 == null, "EventInterceptor already set.");
        }
        this.f10246o = f7Var;
    }

    public final void B(Boolean bool) {
        j();
        ((p3) this.f10277l).a().s(new n4(this, (Object) bool, 1));
    }

    @WorkerThread
    public final void C(g gVar) {
        i();
        boolean z10 = (gVar.f(f.ANALYTICS_STORAGE) && gVar.f(f.AD_STORAGE)) || ((p3) this.f10277l).z().q();
        p3 p3Var = (p3) this.f10277l;
        p3Var.a().i();
        if (z10 != p3Var.O) {
            p3 p3Var2 = (p3) this.f10277l;
            p3Var2.a().i();
            p3Var2.O = z10;
            w2 u10 = ((p3) this.f10277l).u();
            g4 g4Var = u10.f10277l;
            u10.i();
            Boolean valueOf = u10.p().contains("measurement_enabled_from_api") ? Boolean.valueOf(u10.p().getBoolean("measurement_enabled_from_api", true)) : null;
            if (!z10 || valueOf == null || valueOf.booleanValue()) {
                G(Boolean.valueOf(z10), false);
            }
        }
    }

    public final void D(Object obj) {
        Objects.requireNonNull(((p3) this.f10277l).f10557y);
        E("auto", "_ldl", obj, true, System.currentTimeMillis());
    }

    public final void E(String str, String str2, Object obj, boolean z10, long j10) {
        int i10;
        String str3 = str == null ? "app" : str;
        if (z10) {
            i10 = ((p3) this.f10277l).B().l0(str2);
        } else {
            d7 B = ((p3) this.f10277l).B();
            if (B.R("user property", str2)) {
                if (B.N("user property", y.f10810m, null, str2)) {
                    Objects.requireNonNull((p3) B.f10277l);
                    if (B.M("user property", 24, str2)) {
                        i10 = 0;
                    }
                } else {
                    i10 = 15;
                }
            }
            i10 = 6;
        }
        if (i10 != 0) {
            d7 B2 = ((p3) this.f10277l).B();
            Objects.requireNonNull((p3) this.f10277l);
            ((p3) this.f10277l).B().B(this.A, null, i10, "_ev", B2.s(str2, 24, true), str2 != null ? str2.length() : 0);
        } else if (obj == null) {
            v(str3, str2, j10, null);
        } else {
            int h02 = ((p3) this.f10277l).B().h0(str2, obj);
            if (h02 != 0) {
                d7 B3 = ((p3) this.f10277l).B();
                Objects.requireNonNull((p3) this.f10277l);
                ((p3) this.f10277l).B().B(this.A, null, h02, "_ev", B3.s(str2, 24, true), ((obj instanceof String) || (obj instanceof CharSequence)) ? obj.toString().length() : 0);
                return;
            }
            Object q10 = ((p3) this.f10277l).B().q(str2, obj);
            if (q10 != null) {
                v(str3, str2, j10, q10);
            }
        }
    }

    @WorkerThread
    public final void F(String str, String str2, Object obj, long j10) {
        h5.l.f(str);
        h5.l.f(str2);
        i();
        j();
        if ("allow_personalized_ads".equals(str2)) {
            if (obj instanceof String) {
                String str3 = (String) obj;
                if (!TextUtils.isEmpty(str3)) {
                    Long valueOf = Long.valueOf(true != "false".equals(str3.toLowerCase(Locale.ENGLISH)) ? 0L : 1L);
                    ((p3) this.f10277l).u().f10759w.b(valueOf.longValue() == 1 ? "true" : "false");
                    obj = valueOf;
                    str2 = "_npa";
                }
            }
            if (obj == null) {
                ((p3) this.f10277l).u().f10759w.b("unset");
                str2 = "_npa";
            }
        }
        String str4 = str2;
        Object obj2 = obj;
        if (!((p3) this.f10277l).h()) {
            ((p3) this.f10277l).b().f10383y.a("User property not set since app measurement is disabled");
        } else if (((p3) this.f10277l).j()) {
            zzli zzliVar = new zzli(str4, j10, obj2, str);
            x5 z10 = ((p3) this.f10277l).z();
            z10.i();
            z10.j();
            z10.w();
            c2 s10 = ((p3) z10.f10277l).s();
            Objects.requireNonNull(s10);
            Parcel obtain = Parcel.obtain();
            boolean z11 = false;
            a7.a(zzliVar, obtain);
            byte[] marshall = obtain.marshall();
            obtain.recycle();
            if (marshall.length > 131072) {
                ((p3) s10.f10277l).b().f10376r.a("User property too long for local database. Sending directly to service");
            } else {
                z11 = s10.q(1, marshall);
            }
            z10.v(new p5(z10, z10.s(true), z11, zzliVar));
        }
    }

    @WorkerThread
    public final void G(Boolean bool, boolean z10) {
        i();
        j();
        ((p3) this.f10277l).b().f10382x.b("Setting app measurement enabled (FE)", bool);
        ((p3) this.f10277l).u().s(bool);
        if (z10) {
            w2 u10 = ((p3) this.f10277l).u();
            g4 g4Var = u10.f10277l;
            u10.i();
            SharedPreferences.Editor edit = u10.p().edit();
            if (bool != null) {
                edit.putBoolean("measurement_enabled_from_api", bool.booleanValue());
            } else {
                edit.remove("measurement_enabled_from_api");
            }
            edit.apply();
        }
        p3 p3Var = (p3) this.f10277l;
        p3Var.a().i();
        if (p3Var.O || !(bool == null || bool.booleanValue())) {
            H();
        }
    }

    @WorkerThread
    public final void H() {
        i();
        String a10 = ((p3) this.f10277l).u().f10759w.a();
        if (a10 != null) {
            if ("unset".equals(a10)) {
                Objects.requireNonNull(((p3) this.f10277l).f10557y);
                F("app", "_npa", null, System.currentTimeMillis());
            } else {
                Long valueOf = Long.valueOf(true != "true".equals(a10) ? 0L : 1L);
                Objects.requireNonNull(((p3) this.f10277l).f10557y);
                F("app", "_npa", valueOf, System.currentTimeMillis());
            }
        }
        if (!((p3) this.f10277l).h() || !this.f10256z) {
            ((p3) this.f10277l).b().f10382x.a("Updating Scion state (FE)");
            x5 z10 = ((p3) this.f10277l).z();
            z10.i();
            z10.j();
            z10.v(new q5(z10, z10.s(true), 1));
            return;
        }
        ((p3) this.f10277l).b().f10382x.a("Recording app launch after enabling measurement for the first time (FE)");
        L();
        bb.c();
        if (((p3) this.f10277l).f10550r.v(null, w1.f10707d0)) {
            ((p3) this.f10277l).A().f10440o.a();
        }
        ((p3) this.f10277l).a().s(new n.g(this, 1));
    }

    public final String I() {
        return (String) this.f10248r.get();
    }

    @WorkerThread
    public final void L() {
        i();
        j();
        if (((p3) this.f10277l).j()) {
            if (((p3) this.f10277l).f10550r.v(null, w1.X)) {
                e eVar = ((p3) this.f10277l).f10550r;
                Objects.requireNonNull((p3) eVar.f10277l);
                Boolean u10 = eVar.u("google_analytics_deferred_deep_link_enabled");
                if (u10 != null && u10.booleanValue()) {
                    ((p3) this.f10277l).b().f10382x.a("Deferred Deep Link feature enabled.");
                    ((p3) this.f10277l).a().s(new Runnable() {
                        @Override
                        public final void run() {
                            Pair pair;
                            NetworkInfo activeNetworkInfo;
                            c5 c5Var = (c5) this;
                            c5Var.i();
                            if (((p3) c5Var.f10277l).u().B.b()) {
                                ((p3) c5Var.f10277l).b().f10382x.a("Deferred Deep Link already retrieved. Not fetching again.");
                                return;
                            }
                            long a10 = ((p3) c5Var.f10277l).u().C.a();
                            ((p3) c5Var.f10277l).u().C.b(1 + a10);
                            Objects.requireNonNull((p3) c5Var.f10277l);
                            if (a10 >= 5) {
                                ((p3) c5Var.f10277l).b().f10378t.a("Permanently failed to retrieve Deferred Deep Link. Reached maximum retries.");
                                ((p3) c5Var.f10277l).u().B.a(true);
                                return;
                            }
                            p3 p3Var = (p3) c5Var.f10277l;
                            p3Var.a().i();
                            p3.m(p3Var.x());
                            String n10 = p3Var.r().n();
                            w2 u11 = p3Var.u();
                            u11.i();
                            Objects.requireNonNull(((p3) u11.f10277l).f10557y);
                            long elapsedRealtime = SystemClock.elapsedRealtime();
                            String str = u11.f10754r;
                            if (str == null || elapsedRealtime >= u11.f10756t) {
                                u11.f10756t = ((p3) u11.f10277l).f10550r.s(n10, w1.f10703b) + elapsedRealtime;
                                try {
                                    a.C0253a a11 = u4.a.a(((p3) u11.f10277l).f10545l);
                                    u11.f10754r = "";
                                    String str2 = a11.f13312a;
                                    if (str2 != null) {
                                        u11.f10754r = str2;
                                    }
                                    u11.f10755s = a11.f13313b;
                                } catch (Exception e10) {
                                    ((p3) u11.f10277l).b().f10382x.b("Unable to get advertising id", e10);
                                    u11.f10754r = "";
                                }
                                pair = new Pair(u11.f10754r, Boolean.valueOf(u11.f10755s));
                            } else {
                                pair = new Pair(str, Boolean.valueOf(u11.f10755s));
                            }
                            Boolean u12 = p3Var.f10550r.u("google_analytics_adid_collection_enabled");
                            if (!(u12 == null || u12.booleanValue()) || ((Boolean) pair.second).booleanValue() || TextUtils.isEmpty((CharSequence) pair.first)) {
                                p3Var.b().f10382x.a("ADID unavailable to retrieve Deferred Deep Link. Skipping");
                                return;
                            }
                            g5 x10 = p3Var.x();
                            x10.l();
                            ConnectivityManager connectivityManager = (ConnectivityManager) ((p3) x10.f10277l).f10545l.getSystemService("connectivity");
                            URL url = null;
                            if (connectivityManager != null) {
                                try {
                                    activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
                                } catch (SecurityException unused) {
                                }
                                if (activeNetworkInfo != null || !activeNetworkInfo.isConnected()) {
                                    p3Var.b().f10378t.a("Network is not available for Deferred Deep Link request. Skipping");
                                }
                                d7 B = p3Var.B();
                                ((p3) p3Var.r().f10277l).f10550r.r();
                                String str3 = (String) pair.first;
                                long a12 = p3Var.u().C.a() - 1;
                                Objects.requireNonNull(B);
                                try {
                                    h5.l.f(str3);
                                    h5.l.f(n10);
                                    String format = String.format("https://www.googleadservices.com/pagead/conversion/app/deeplink?id_type=adid&sdk_version=%s&rdid=%s&bundleid=%s&retry=%s", String.format("v%s.%s", 68000L, Integer.valueOf(B.m0())), str3, n10, Long.valueOf(a12));
                                    if (n10.equals(((p3) B.f10277l).f10550r.k("debug.deferred.deeplink"))) {
                                        format = format.concat("&ddl_test=1");
                                    }
                                    url = new URL(format);
                                } catch (IllegalArgumentException | MalformedURLException e11) {
                                    ((p3) B.f10277l).b().f10375q.b("Failed to create BOW URL for Deferred Deep Link. exception", e11.getMessage());
                                }
                                if (url != null) {
                                    g5 x11 = p3Var.x();
                                    n3 n3Var = new n3(p3Var);
                                    x11.i();
                                    x11.l();
                                    ((p3) x11.f10277l).a().r(new f5(x11, n10, url, n3Var));
                                    return;
                                }
                                return;
                            }
                            activeNetworkInfo = null;
                            if (activeNetworkInfo != null) {
                            }
                            p3Var.b().f10378t.a("Network is not available for Deferred Deep Link request. Skipping");
                        }
                    });
                }
            }
            x5 z10 = ((p3) this.f10277l).z();
            z10.i();
            z10.j();
            zzq s10 = z10.s(true);
            ((p3) z10.f10277l).s().q(3, new byte[0]);
            z10.v(new x3(z10, s10, 2));
            this.f10256z = false;
            w2 u11 = ((p3) this.f10277l).u();
            u11.i();
            String string = u11.p().getString("previous_os_version", null);
            ((p3) u11.f10277l).q().l();
            String str = Build.VERSION.RELEASE;
            if (!TextUtils.isEmpty(str) && !str.equals(string)) {
                SharedPreferences.Editor edit = u11.p().edit();
                edit.putString("previous_os_version", str);
                edit.apply();
            }
            if (TextUtils.isEmpty(string)) {
                return;
            }
            ((p3) this.f10277l).q().l();
            if (string.equals(str)) {
                return;
            }
            Bundle bundle = new Bundle();
            bundle.putString("_po", string);
            q("auto", "_ou", bundle);
        }
    }

    @Override
    public final boolean l() {
        return false;
    }

    public final void m(String str, String str2, Bundle bundle) {
        Objects.requireNonNull(((p3) this.f10277l).f10557y);
        long currentTimeMillis = System.currentTimeMillis();
        h5.l.f(str);
        Bundle bundle2 = new Bundle();
        bundle2.putString(AuthenticationTokenClaims.JSON_KEY_NAME, str);
        bundle2.putLong("creation_timestamp", currentTimeMillis);
        if (str2 != null) {
            bundle2.putString("expired_event_name", str2);
            bundle2.putBundle("expired_event_params", bundle);
        }
        ((p3) this.f10277l).a().s(new m4(this, bundle2, 1));
    }

    public final void n() {
        if (!(((p3) this.f10277l).f10545l.getApplicationContext() instanceof Application) || this.f10245n == null) {
            return;
        }
        ((Application) ((p3) this.f10277l).f10545l.getApplicationContext()).unregisterActivityLifecycleCallbacks(this.f10245n);
    }

    public final void o(String str, String str2, Bundle bundle) {
        Objects.requireNonNull(((p3) this.f10277l).f10557y);
        p(str, str2, bundle, true, true, System.currentTimeMillis());
    }

    public final void p(String str, String str2, Bundle bundle, boolean z10, boolean z11, long j10) {
        String str3;
        String str4 = str == null ? "app" : str;
        Bundle bundle2 = bundle == null ? new Bundle() : bundle;
        if (str2 != "screen_view" && (str2 == null || !str2.equals("screen_view"))) {
            u(str4, str2, j10, bundle2, z11, !z11 || this.f10246o == null || d7.W(str2), z10);
            return;
        }
        n5 y10 = ((p3) this.f10277l).y();
        synchronized (y10.f10513w) {
            if (!y10.f10512v) {
                ((p3) y10.f10277l).b().f10380v.a("Cannot log screen view event when the app is in the background.");
                return;
            }
            String string = bundle2.getString("screen_name");
            if (string != null) {
                if (string.length() > 0) {
                    int length = string.length();
                    Objects.requireNonNull((p3) y10.f10277l);
                }
                ((p3) y10.f10277l).b().f10380v.b("Invalid screen name length for screen view. Length", Integer.valueOf(string.length()));
                return;
            }
            String string2 = bundle2.getString("screen_class");
            if (string2 != null) {
                if (string2.length() > 0) {
                    int length2 = string2.length();
                    Objects.requireNonNull((p3) y10.f10277l);
                }
                ((p3) y10.f10277l).b().f10380v.b("Invalid screen class length for screen view. Length", Integer.valueOf(string2.length()));
                return;
            }
            if (string2 == null) {
                Activity activity = y10.f10508r;
                str3 = activity != null ? y10.q(activity.getClass()) : "Activity";
            } else {
                str3 = string2;
            }
            h5 h5Var = y10.f10505n;
            if (y10.f10509s && h5Var != null) {
                y10.f10509s = false;
                boolean B = c0.b.B(h5Var.f10362b, str3);
                boolean B2 = c0.b.B(h5Var.f10361a, string);
                if (B && B2) {
                    ((p3) y10.f10277l).b().f10380v.a("Ignoring call to log screen view event with duplicate parameters.");
                    return;
                }
            }
            ((p3) y10.f10277l).b().f10383y.c("Logging screen view with name, class", string == null ? "null" : string, str3 == null ? "null" : str3);
            h5 h5Var2 = y10.f10505n == null ? y10.f10506o : y10.f10505n;
            h5 h5Var3 = new h5(string, str3, ((p3) y10.f10277l).B().o0(), true, j10);
            y10.f10505n = h5Var3;
            y10.f10506o = h5Var2;
            y10.f10510t = h5Var3;
            Objects.requireNonNull(((p3) y10.f10277l).f10557y);
            ((p3) y10.f10277l).a().s(new i5(y10, bundle2, h5Var3, h5Var2, SystemClock.elapsedRealtime()));
        }
    }

    @WorkerThread
    public final void q(String str, String str2, Bundle bundle) {
        i();
        Objects.requireNonNull(((p3) this.f10277l).f10557y);
        r(str, str2, System.currentTimeMillis(), bundle);
    }

    @WorkerThread
    public final void r(String str, String str2, long j10, Bundle bundle) {
        i();
        s(str, str2, j10, bundle, true, this.f10246o == null || d7.W(str2), true, null);
    }

    @WorkerThread
    public final void s(String str, String str2, long j10, Bundle bundle, boolean z10, boolean z11, boolean z12, String str3) {
        boolean z13;
        String str4;
        long j11;
        String str5;
        String str6;
        boolean q10;
        boolean z14;
        Bundle[] bundleArr;
        h5.l.f(str);
        Objects.requireNonNull(bundle, "null reference");
        i();
        j();
        if (!((p3) this.f10277l).h()) {
            ((p3) this.f10277l).b().f10382x.a("Event not sent since app measurement is disabled");
            return;
        }
        List list = ((p3) this.f10277l).r().f10193t;
        if (list != null && !list.contains(str2)) {
            ((p3) this.f10277l).b().f10382x.c("Dropping non-safelisted event. event name, origin", str2, str);
            return;
        }
        if (!this.f10247q) {
            this.f10247q = true;
            try {
                g4 g4Var = this.f10277l;
                try {
                    AsmPrivacyHookHelper.invoke((!((p3) g4Var).p ? Class.forName("com.google.android.gms.tagmanager.TagManagerService", true, ((p3) g4Var).f10545l.getClassLoader()) : Class.forName("com.google.android.gms.tagmanager.TagManagerService")).getDeclaredMethod("initialize", Context.class), null, new Object[]{((p3) this.f10277l).f10545l});
                } catch (Exception e10) {
                    ((p3) this.f10277l).b().f10378t.b("Failed to invoke Tag Manager's initialize() method", e10);
                }
            } catch (ClassNotFoundException unused) {
                ((p3) this.f10277l).b().f10381w.a("Tag Manager is not found and thus will not be used");
            }
        }
        if ("_cmp".equals(str2) && bundle.containsKey("gclid")) {
            Objects.requireNonNull((p3) this.f10277l);
            String string = bundle.getString("gclid");
            Objects.requireNonNull(((p3) this.f10277l).f10557y);
            F("auto", "_lgclid", string, System.currentTimeMillis());
        }
        Objects.requireNonNull((p3) this.f10277l);
        if (z10 && (!d7.f10267s[0].equals(str2))) {
            ((p3) this.f10277l).B().z(bundle, ((p3) this.f10277l).u().G.a());
        }
        if (!z12) {
            Objects.requireNonNull((p3) this.f10277l);
            if (!"_iap".equals(str2)) {
                d7 B = ((p3) this.f10277l).B();
                int i10 = 2;
                if (B.R(NotificationCompat.CATEGORY_EVENT, str2)) {
                    if (B.N(NotificationCompat.CATEGORY_EVENT, j3.a.p, j3.a.f9307q, str2)) {
                        Objects.requireNonNull((p3) B.f10277l);
                        if (B.M(NotificationCompat.CATEGORY_EVENT, 40, str2)) {
                            i10 = 0;
                        }
                    } else {
                        i10 = 13;
                    }
                }
                if (i10 != 0) {
                    ((p3) this.f10277l).b().f10377s.b("Invalid public event name. Event will not be logged (FE)", ((p3) this.f10277l).f10556x.d(str2));
                    d7 B2 = ((p3) this.f10277l).B();
                    Objects.requireNonNull((p3) this.f10277l);
                    ((p3) this.f10277l).B().B(this.A, null, i10, "_ev", B2.s(str2, 40, true), str2 != null ? str2.length() : 0);
                    return;
                }
            }
        }
        xb.c();
        if (((p3) this.f10277l).f10550r.v(null, w1.f10715h0)) {
            Objects.requireNonNull((p3) this.f10277l);
            h5 p = ((p3) this.f10277l).y().p(false);
            if (p != null && !bundle.containsKey("_sc")) {
                p.f10363d = true;
            }
            d7.y(p, bundle, z10 && !z12);
        } else {
            Objects.requireNonNull((p3) this.f10277l);
            h5 p10 = ((p3) this.f10277l).y().p(false);
            if (p10 != null && !bundle.containsKey("_sc")) {
                p10.f10363d = true;
            }
            d7.y(p10, bundle, z10 && !z12);
        }
        boolean equals = "am".equals(str);
        boolean W = d7.W(str2);
        if (!z10 || this.f10246o == null || W) {
            z13 = equals;
        } else if (!equals) {
            ((p3) this.f10277l).b().f10382x.c("Passing event to registered event handler (FE)", ((p3) this.f10277l).f10556x.d(str2), ((p3) this.f10277l).f10556x.b(bundle));
            h5.l.i(this.f10246o);
            f7 f7Var = this.f10246o;
            Objects.requireNonNull(f7Var);
            try {
                ((c6.a1) f7Var.f10307a).j(str, str2, bundle, j10);
                return;
            } catch (RemoteException e11) {
                p3 p3Var = ((AppMeasurementDynamiteService) f7Var.f10308b).f2937a;
                if (p3Var != null) {
                    p3Var.b().f10378t.b("Event interceptor threw exception", e11);
                    return;
                }
                return;
            }
        } else {
            z13 = true;
        }
        if (((p3) this.f10277l).j()) {
            int i02 = ((p3) this.f10277l).B().i0(str2);
            if (i02 != 0) {
                ((p3) this.f10277l).b().f10377s.b("Invalid event name. Event will not be logged (FE)", ((p3) this.f10277l).f10556x.d(str2));
                d7 B3 = ((p3) this.f10277l).B();
                Objects.requireNonNull((p3) this.f10277l);
                ((p3) this.f10277l).B().B(this.A, str3, i02, "_ev", B3.s(str2, 40, true), str2 != null ? str2.length() : 0);
                return;
            }
            Bundle s02 = ((p3) this.f10277l).B().s0(str3, str2, bundle, Collections.unmodifiableList(Arrays.asList("_o", "_sn", "_sc", "_si")), z12);
            h5.l.i(s02);
            Objects.requireNonNull((p3) this.f10277l);
            if (((p3) this.f10277l).y().p(false) != null && "_ae".equals(str2)) {
                i6 i6Var = ((p3) this.f10277l).A().p;
                Objects.requireNonNull(((p3) i6Var.f10391d.f10277l).f10557y);
                long elapsedRealtime = SystemClock.elapsedRealtime();
                long j12 = elapsedRealtime - i6Var.f10390b;
                i6Var.f10390b = elapsedRealtime;
                if (j12 > 0) {
                    ((p3) this.f10277l).B().w(s02, j12);
                }
            }
            sa.c();
            if (((p3) this.f10277l).f10550r.v(null, w1.f10705c0)) {
                if (!"auto".equals(str) && "_ssr".equals(str2)) {
                    d7 B4 = ((p3) this.f10277l).B();
                    String string2 = s02.getString("_ffr");
                    int i11 = q5.l.f12331a;
                    if (string2 == null || string2.trim().isEmpty()) {
                        string2 = null;
                    } else if (string2 != null) {
                        string2 = string2.trim();
                    }
                    String a10 = ((p3) B4.f10277l).u().D.a();
                    if (string2 == a10 || (string2 != null && string2.equals(a10))) {
                        ((p3) B4.f10277l).b().f10382x.a("Not logging duplicate session_start_with_rollout event");
                        return;
                    }
                    ((p3) B4.f10277l).u().D.b(string2);
                } else if ("_ae".equals(str2)) {
                    String a11 = ((p3) ((p3) this.f10277l).B().f10277l).u().D.a();
                    if (!TextUtils.isEmpty(a11)) {
                        s02.putString("_ffr", a11);
                    }
                }
            }
            ArrayList arrayList = new ArrayList();
            arrayList.add(s02);
            if (((p3) this.f10277l).u().f10761y.a() > 0 && ((p3) this.f10277l).u().u(j10) && ((p3) this.f10277l).u().A.b()) {
                ((p3) this.f10277l).b().f10383y.a("Current session is expired, remove the session number, ID, and engagement time");
                Objects.requireNonNull(((p3) this.f10277l).f10557y);
                str4 = "_ae";
                j11 = 0;
                F("auto", "_sid", null, System.currentTimeMillis());
                Objects.requireNonNull(((p3) this.f10277l).f10557y);
                F("auto", "_sno", null, System.currentTimeMillis());
                Objects.requireNonNull(((p3) this.f10277l).f10557y);
                F("auto", "_se", null, System.currentTimeMillis());
            } else {
                str4 = "_ae";
                j11 = 0;
            }
            if (s02.getLong("extend_session", j11) == 1) {
                ((p3) this.f10277l).b().f10383y.a("EXTEND_SESSION param attached: initiate a new session or extend the current active session");
                ((p3) this.f10277l).A().f10440o.b(j10, true);
            }
            ArrayList arrayList2 = new ArrayList(s02.keySet());
            Collections.sort(arrayList2);
            int size = arrayList2.size();
            for (int i12 = 0; i12 < size; i12++) {
                String str7 = (String) arrayList2.get(i12);
                if (str7 != null) {
                    ((p3) this.f10277l).B();
                    Object obj = s02.get(str7);
                    if (obj instanceof Bundle) {
                        bundleArr = new Bundle[]{(Bundle) obj};
                    } else if (obj instanceof Parcelable[]) {
                        Parcelable[] parcelableArr = (Parcelable[]) obj;
                        bundleArr = (Bundle[]) Arrays.copyOf(parcelableArr, parcelableArr.length, Bundle[].class);
                    } else if (obj instanceof ArrayList) {
                        ArrayList arrayList3 = (ArrayList) obj;
                        bundleArr = (Bundle[]) arrayList3.toArray(new Bundle[arrayList3.size()]);
                    } else {
                        bundleArr = null;
                    }
                    if (bundleArr != null) {
                        s02.putParcelableArray(str7, bundleArr);
                    }
                }
            }
            for (int i13 = 0; i13 < arrayList.size(); i13++) {
                Bundle bundle2 = (Bundle) arrayList.get(i13);
                if (i13 != 0) {
                    str6 = "_ep";
                    str5 = str;
                } else {
                    str5 = str;
                    str6 = str2;
                }
                bundle2.putString("_o", str5);
                if (z11) {
                    bundle2 = ((p3) this.f10277l).B().r0(bundle2);
                }
                Bundle bundle3 = bundle2;
                zzaw zzawVar = new zzaw(str6, new zzau(bundle3), str, j10);
                x5 z15 = ((p3) this.f10277l).z();
                Objects.requireNonNull(z15);
                z15.i();
                z15.j();
                z15.w();
                c2 s10 = ((p3) z15.f10277l).s();
                Objects.requireNonNull(s10);
                Parcel obtain = Parcel.obtain();
                t.a(zzawVar, obtain, 0);
                byte[] marshall = obtain.marshall();
                obtain.recycle();
                if (marshall.length > 131072) {
                    ((p3) s10.f10277l).b().f10376r.a("Event is too long for local database. Sending event directly to service");
                    z14 = true;
                    q10 = false;
                } else {
                    q10 = s10.q(0, marshall);
                    z14 = true;
                }
                z15.v(new a5(z15, z15.s(z14), q10, zzawVar, str3));
                if (!z13) {
                    Iterator it = this.p.iterator();
                    while (it.hasNext()) {
                        ((j4) it.next()).a(str, str2, new Bundle(bundle3), j10);
                    }
                }
            }
            Objects.requireNonNull((p3) this.f10277l);
            if (((p3) this.f10277l).y().p(false) == null || !str4.equals(str2)) {
                return;
            }
            k6 A = ((p3) this.f10277l).A();
            Objects.requireNonNull(((p3) this.f10277l).f10557y);
            A.p.a(true, true, SystemClock.elapsedRealtime());
        }
    }

    public final void t(long j10, boolean z10) {
        i();
        j();
        ((p3) this.f10277l).b().f10382x.a("Resetting analytics data (FE)");
        k6 A = ((p3) this.f10277l).A();
        A.i();
        i6 i6Var = A.p;
        i6Var.c.a();
        i6Var.f10389a = 0L;
        i6Var.f10390b = 0L;
        ac.c();
        if (((p3) this.f10277l).f10550r.v(null, w1.f10740u0)) {
            ((p3) this.f10277l).r().p();
        }
        boolean h10 = ((p3) this.f10277l).h();
        w2 u10 = ((p3) this.f10277l).u();
        u10.p.b(j10);
        if (!TextUtils.isEmpty(((p3) u10.f10277l).u().D.a())) {
            u10.D.b(null);
        }
        bb.c();
        e eVar = ((p3) u10.f10277l).f10550r;
        v1 v1Var = w1.f10707d0;
        if (eVar.v(null, v1Var)) {
            u10.f10761y.b(0L);
        }
        if (!((p3) u10.f10277l).f10550r.y()) {
            u10.t(!h10);
        }
        u10.E.b(null);
        u10.F.b(0L);
        u10.G.b(null);
        if (z10) {
            x5 z11 = ((p3) this.f10277l).z();
            z11.i();
            z11.j();
            zzq s10 = z11.s(false);
            z11.w();
            ((p3) z11.f10277l).s().n();
            z11.v(new q5(z11, s10, 0));
        }
        bb.c();
        if (((p3) this.f10277l).f10550r.v(null, v1Var)) {
            ((p3) this.f10277l).A().f10440o.a();
        }
        this.f10256z = !h10;
    }

    public final void u(String str, String str2, long j10, Bundle bundle, boolean z10, boolean z11, boolean z12) {
        Bundle bundle2 = new Bundle(bundle);
        for (String str3 : bundle2.keySet()) {
            Object obj = bundle2.get(str3);
            if (obj instanceof Bundle) {
                bundle2.putBundle(str3, new Bundle((Bundle) obj));
            } else {
                int i10 = 0;
                if (obj instanceof Parcelable[]) {
                    Parcelable[] parcelableArr = (Parcelable[]) obj;
                    while (i10 < parcelableArr.length) {
                        Parcelable parcelable = parcelableArr[i10];
                        if (parcelable instanceof Bundle) {
                            parcelableArr[i10] = new Bundle((Bundle) parcelable);
                        }
                        i10++;
                    }
                } else if (obj instanceof List) {
                    List list = (List) obj;
                    while (i10 < list.size()) {
                        Object obj2 = list.get(i10);
                        if (obj2 instanceof Bundle) {
                            list.set(i10, new Bundle((Bundle) obj2));
                        }
                        i10++;
                    }
                }
            }
        }
        ((p3) this.f10277l).a().s(new p4(this, str, str2, j10, bundle2, z10, z11, z12));
    }

    public final void v(String str, String str2, long j10, Object obj) {
        ((p3) this.f10277l).a().s(new q4(this, str, str2, obj, j10));
    }

    public final void w(String str) {
        this.f10248r.set(str);
    }

    public final void x(Bundle bundle, long j10) {
        Objects.requireNonNull(bundle, "null reference");
        Bundle bundle2 = new Bundle(bundle);
        if (!TextUtils.isEmpty(bundle2.getString("app_id"))) {
            ((p3) this.f10277l).b().f10378t.a("Package name should be null when calling setConditionalUserProperty");
        }
        bundle2.remove("app_id");
        i4.a(bundle2, "app_id", String.class, null);
        i4.a(bundle2, OSSHeaders.ORIGIN, String.class, null);
        i4.a(bundle2, AuthenticationTokenClaims.JSON_KEY_NAME, String.class, null);
        i4.a(bundle2, "value", Object.class, null);
        i4.a(bundle2, "trigger_event_name", String.class, null);
        i4.a(bundle2, "trigger_timeout", Long.class, 0L);
        i4.a(bundle2, "timed_out_event_name", String.class, null);
        i4.a(bundle2, "timed_out_event_params", Bundle.class, null);
        i4.a(bundle2, "triggered_event_name", String.class, null);
        i4.a(bundle2, "triggered_event_params", Bundle.class, null);
        i4.a(bundle2, "time_to_live", Long.class, 0L);
        i4.a(bundle2, "expired_event_name", String.class, null);
        i4.a(bundle2, "expired_event_params", Bundle.class, null);
        h5.l.f(bundle2.getString(AuthenticationTokenClaims.JSON_KEY_NAME));
        h5.l.f(bundle2.getString(OSSHeaders.ORIGIN));
        h5.l.i(bundle2.get("value"));
        bundle2.putLong("creation_timestamp", j10);
        String string = bundle2.getString(AuthenticationTokenClaims.JSON_KEY_NAME);
        Object obj = bundle2.get("value");
        if (((p3) this.f10277l).B().l0(string) != 0) {
            ((p3) this.f10277l).b().f10375q.b("Invalid conditional user property name", ((p3) this.f10277l).f10556x.f(string));
        } else if (((p3) this.f10277l).B().h0(string, obj) != 0) {
            ((p3) this.f10277l).b().f10375q.c("Invalid conditional user property value", ((p3) this.f10277l).f10556x.f(string), obj);
        } else {
            Object q10 = ((p3) this.f10277l).B().q(string, obj);
            if (q10 == null) {
                ((p3) this.f10277l).b().f10375q.c("Unable to normalize conditional user property value", ((p3) this.f10277l).f10556x.f(string), obj);
                return;
            }
            i4.c(bundle2, q10);
            long j11 = bundle2.getLong("trigger_timeout");
            if (!TextUtils.isEmpty(bundle2.getString("trigger_event_name"))) {
                Objects.requireNonNull((p3) this.f10277l);
                if (j11 > 15552000000L || j11 < 1) {
                    ((p3) this.f10277l).b().f10375q.c("Invalid conditional user property timeout", ((p3) this.f10277l).f10556x.f(string), Long.valueOf(j11));
                    return;
                }
            }
            long j12 = bundle2.getLong("time_to_live");
            Objects.requireNonNull((p3) this.f10277l);
            if (j12 > 15552000000L || j12 < 1) {
                ((p3) this.f10277l).b().f10375q.c("Invalid conditional user property time to live", ((p3) this.f10277l).f10556x.f(string), Long.valueOf(j12));
            } else {
                ((p3) this.f10277l).a().s(new m(this, bundle2, 2));
            }
        }
    }

    public final void y(Bundle bundle, int i10, long j10) {
        String str;
        j();
        g gVar = g.f10309b;
        f[] values = f.values();
        int length = values.length;
        int i11 = 0;
        while (true) {
            if (i11 >= length) {
                str = null;
                break;
            }
            f fVar = values[i11];
            if (bundle.containsKey(fVar.f10291l) && (str = bundle.getString(fVar.f10291l)) != null && g.i(str) == null) {
                break;
            }
            i11++;
        }
        if (str != null) {
            ((p3) this.f10277l).b().f10380v.b("Ignoring invalid consent setting", str);
            ((p3) this.f10277l).b().f10380v.a("Valid consent values are 'granted', 'denied'");
        }
        z(g.a(bundle), i10, j10);
    }

    public final void z(g gVar, int i10, long j10) {
        g gVar2;
        boolean z10;
        boolean z11;
        g gVar3;
        boolean z12;
        f fVar = f.ANALYTICS_STORAGE;
        j();
        if (i10 != -10 && ((Boolean) gVar.f10310a.get(f.AD_STORAGE)) == null && ((Boolean) gVar.f10310a.get(fVar)) == null) {
            ((p3) this.f10277l).b().f10380v.a("Discarding empty consent settings");
            return;
        }
        synchronized (this.f10249s) {
            gVar2 = this.f10250t;
            int i11 = this.f10251u;
            g gVar4 = g.f10309b;
            z10 = true;
            z11 = false;
            if (i10 <= i11) {
                boolean g10 = gVar.g(gVar2, (f[]) gVar.f10310a.keySet().toArray(new f[0]));
                if (gVar.f(fVar) && !this.f10250t.f(fVar)) {
                    z11 = true;
                }
                g d9 = gVar.d(this.f10250t);
                this.f10250t = d9;
                this.f10251u = i10;
                gVar3 = d9;
                z12 = z11;
                z11 = g10;
            } else {
                gVar3 = gVar;
                z12 = false;
                z10 = false;
            }
        }
        if (!z10) {
            ((p3) this.f10277l).b().f10381w.b("Ignoring lower-priority consent settings, proposed settings", gVar3);
            return;
        }
        long andIncrement = this.f10252v.getAndIncrement();
        if (z11) {
            this.f10248r.set(null);
            ((p3) this.f10277l).a().t(new x4(this, gVar3, j10, i10, andIncrement, z12, gVar2));
            return;
        }
        y4 y4Var = new y4(this, gVar3, i10, andIncrement, z12, gVar2);
        if (i10 == 30 || i10 == -10) {
            ((p3) this.f10277l).a().t(y4Var);
        } else {
            ((p3) this.f10277l).a().s(y4Var);
        }
    }
}