package k;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.os.RemoteException;
import android.view.MenuItem;
import androidx.work.WorkInfo$State;
import androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryChargingProxy;
import androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryNotLowProxy;
import androidx.work.impl.background.systemalarm.ConstraintProxy$NetworkStateProxy;
import androidx.work.impl.background.systemalarm.ConstraintProxy$StorageNotLowProxy;
import androidx.work.impl.background.systemalarm.ConstraintProxyUpdateReceiver;
import com.google.android.gms.ads.nonagon.signalgeneration.r0;
import com.google.android.gms.internal.ads.b10;
import com.google.android.gms.internal.ads.dz;
import com.google.android.gms.internal.ads.i10;
import com.google.android.gms.internal.ads.l20;
import com.google.android.gms.internal.ads.nu;
import com.google.android.gms.internal.ads.vs0;
import com.google.android.gms.internal.ads.xu0;
import com.google.android.gms.internal.ads.zq0;
import com.google.android.gms.internal.measurement.x0;
import com.google.android.gms.measurement.internal.AppMeasurementDynamiteService;
import com.google.android.gms.measurement.internal.a3;
import com.google.android.gms.measurement.internal.b4;
import com.google.android.gms.measurement.internal.d4;
import com.google.android.gms.measurement.internal.n4;
import com.google.android.gms.measurement.internal.u2;
import java.io.File;
import java.util.ArrayDeque;
import java.util.HashMap;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicReference;
import xyz.stream.utils.j0;

/* JADX INFO: loaded from: classes.dex */
public final class h implements Runnable {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f28839a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f28840b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f28841c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ Object f28842d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ Object f28843e;

    public /* synthetic */ h(Object obj, Object obj2, Object obj3, Object obj4, int i10) {
        this.f28839a = i10;
        this.f28843e = obj;
        this.f28840b = obj2;
        this.f28841c = obj3;
        this.f28842d = obj4;
    }

    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:37:0x00de -> B:154:0x00e9). Please report as a decompilation issue!!! */
    @Override // java.lang.Runnable
    public final void run() throws Throwable {
        n4.o oVarP;
        boolean zContains;
        Object obj;
        com.google.android.gms.measurement.internal.h0 h0Var;
        byte[] bArrZza = null;
        switch (this.f28839a) {
            case 0:
                i iVar = (i) this.f28840b;
                if (iVar != null) {
                    j0 j0Var = (j0) this.f28843e;
                    ((j) j0Var.f36154b).f28854d0 = true;
                    iVar.f28845b.c(false);
                    ((j) j0Var.f36154b).f28854d0 = false;
                }
                MenuItem menuItem = (MenuItem) this.f28841c;
                if (menuItem.isEnabled() && menuItem.hasSubMenu()) {
                    ((p) this.f28842d).q(menuItem, null, 4);
                    return;
                }
                return;
            case 1:
                Object obj2 = this.f28842d;
                Object obj3 = this.f28841c;
                Object obj4 = this.f28840b;
                try {
                    boolean booleanExtra = ((Intent) obj4).getBooleanExtra("KEY_BATTERY_NOT_LOW_PROXY_ENABLED", false);
                    boolean booleanExtra2 = ((Intent) obj4).getBooleanExtra("KEY_BATTERY_CHARGING_PROXY_ENABLED", false);
                    boolean booleanExtra3 = ((Intent) obj4).getBooleanExtra("KEY_STORAGE_NOT_LOW_PROXY_ENABLED", false);
                    boolean booleanExtra4 = ((Intent) obj4).getBooleanExtra("KEY_NETWORK_STATE_PROXY_ENABLED", false);
                    androidx.work.u uVarC = androidx.work.u.c();
                    int i10 = ConstraintProxyUpdateReceiver.f4570a;
                    String.format("Updating proxies: BatteryNotLowProxy enabled (%s), BatteryChargingProxy enabled (%s), StorageNotLowProxy (%s), NetworkStateProxy enabled (%s)", Boolean.valueOf(booleanExtra), Boolean.valueOf(booleanExtra2), Boolean.valueOf(booleanExtra3), Boolean.valueOf(booleanExtra4));
                    uVarC.a(new Throwable[0]);
                    o4.g.a((Context) obj3, ConstraintProxy$BatteryNotLowProxy.class, booleanExtra);
                    o4.g.a((Context) obj3, ConstraintProxy$BatteryChargingProxy.class, booleanExtra2);
                    o4.g.a((Context) obj3, ConstraintProxy$StorageNotLowProxy.class, booleanExtra3);
                    o4.g.a((Context) obj3, ConstraintProxy$NetworkStateProxy.class, booleanExtra4);
                    return;
                } finally {
                    ((BroadcastReceiver.PendingResult) obj2).finish();
                }
            case 2:
                Object obj5 = this.f28842d;
                UUID uuid = (UUID) this.f28840b;
                String string = uuid.toString();
                androidx.work.u uVarC2 = androidx.work.u.c();
                int i11 = o4.q.f31413c;
                Object obj6 = this.f28841c;
                String.format("Updating progress for %s (%s)", uuid, (androidx.work.i) obj6);
                uVarC2.a(new Throwable[0]);
                Object obj7 = this.f28843e;
                ((o4.q) obj7).f31414a.beginTransaction();
                try {
                    oVarP = ((n4.r) ((o4.q) obj7).f31414a.workSpecDao()).p(string);
                } finally {
                    try {
                    } finally {
                    }
                    break;
                }
                if (oVarP == null) {
                    throw new IllegalStateException("Calls to setProgressAsync() must complete before a ListenableWorker signals completion of work by returning an instance of Result.");
                }
                if (oVarP.f30819b == WorkInfo$State.f4517b) {
                    ((u.e) ((o4.q) obj7).f31414a.workProgressDao()).h(new n4.k(string, (androidx.work.i) obj6));
                } else {
                    androidx.work.u uVarC3 = androidx.work.u.c();
                    String.format("Ignoring setProgressAsync(...). WorkSpec (%s) is not in a RUNNING state.", string);
                    uVarC3.f(new Throwable[0]);
                }
                ((androidx.work.impl.utils.futures.i) obj5).set(null);
                ((o4.q) obj7).f31414a.setTransactionSuccessful();
                return;
            case 3:
                i7.a aVar = (i7.a) this.f28843e;
                g7.f fVar = (g7.f) this.f28842d;
                Context context = (Context) this.f28840b;
                try {
                    new xu0(context, (String) this.f28841c, fVar.f26279a, aVar).a();
                    return;
                } catch (IllegalStateException e10) {
                    dz.a(context).d("AppOpenAd.load", e10);
                    return;
                }
            case 4:
                r7.b bVar = (r7.b) this.f28843e;
                g7.f fVar2 = (g7.f) this.f28842d;
                Context context2 = (Context) this.f28840b;
                try {
                    new nu(context2, (String) this.f28841c).c(fVar2.f26279a, bVar);
                    return;
                } catch (IllegalStateException e11) {
                    dz.a(context2).d("InterstitialAd.load", e11);
                    return;
                }
            case 5:
                com.google.android.gms.ads.nonagon.signalgeneration.v vVar = (com.google.android.gms.ads.nonagon.signalgeneration.v) this.f28840b;
                String str = (String) this.f28841c;
                com.google.android.gms.ads.nonagon.signalgeneration.p pVar = (com.google.android.gms.ads.nonagon.signalgeneration.p) this.f28842d;
                l20 l20Var = (l20) this.f28843e;
                com.google.android.gms.ads.nonagon.signalgeneration.h0 h0Var2 = vVar.f8147b;
                h0Var2.c();
                synchronized (h0Var2.f8040d) {
                    zContains = h0Var2.f8037a.contains(str);
                    break;
                }
                if (zContains || vVar.a()) {
                    return;
                }
                pVar.zze(new k8.b(vVar.f8146a), l20Var, null);
                return;
            case 6:
                r0 r0Var = (r0) this.f28840b;
                zq0 zq0Var = (zq0) this.f28841c;
                ArrayDeque arrayDeque = (ArrayDeque) this.f28842d;
                ArrayDeque arrayDeque2 = (ArrayDeque) this.f28843e;
                r0Var.d(zq0Var, arrayDeque, "to");
                r0Var.d(zq0Var, arrayDeque2, "of");
                return;
            case 7:
                vs0 vs0Var = (vs0) this.f28843e;
                g7.f fVar3 = (g7.f) this.f28842d;
                Context context3 = (Context) this.f28840b;
                try {
                    new b10(context3, (String) this.f28841c).b(fVar3.f26279a, vs0Var);
                    return;
                } catch (IllegalStateException e12) {
                    dz.a(context3).d("RewardedAd.load", e12);
                    return;
                }
            case 8:
                vs0 vs0Var2 = (vs0) this.f28843e;
                g7.f fVar4 = (g7.f) this.f28842d;
                Context context4 = (Context) this.f28840b;
                try {
                    new i10(context4, (String) this.f28841c).b(fVar4.f26279a, vs0Var2);
                    return;
                } catch (IllegalStateException e13) {
                    dz.a(context4).d("RewardedInterstitialAd.load", e13);
                    return;
                }
            case 9:
                a3 a3VarL = ((AppMeasurementDynamiteService) this.f28843e).f21463a.l();
                x0 x0Var = (x0) this.f28840b;
                com.google.android.gms.measurement.internal.y yVar = (com.google.android.gms.measurement.internal.y) this.f28841c;
                String str2 = (String) this.f28842d;
                a3VarL.w();
                a3VarL.D();
                if (e8.e.f25522b.b(a3VarL.v().zza(), 12451000) == 0) {
                    a3VarL.I(new h(a3VarL, yVar, str2, x0Var, 12));
                    return;
                } else {
                    a3VarL.zzj().f21837i.c("Not bundling data. Service unavailable or out of date");
                    a3VarL.v().V(x0Var, new byte[0]);
                    return;
                }
            case 10:
                a3 a3VarL2 = ((AppMeasurementDynamiteService) this.f28843e).f21463a.l();
                x0 x0Var2 = (x0) this.f28840b;
                String str3 = (String) this.f28841c;
                String str4 = (String) this.f28842d;
                a3VarL2.w();
                a3VarL2.D();
                a3VarL2.I(new u2(a3VarL2, str3, str4, a3VarL2.S(false), x0Var2));
                return;
            case 11:
                synchronized (((AtomicReference) this.f28840b)) {
                    try {
                        try {
                            obj = this.f28843e;
                            h0Var = ((a3) obj).f21472d;
                        } catch (RemoteException e14) {
                            ((a3) this.f28843e).zzj().f21834f.b(e14, "Failed to get trigger URIs; remote exception");
                        }
                        if (h0Var == null) {
                            ((a3) obj).zzj().f21834f.c("Failed to get trigger URIs; not connected to service");
                            return;
                        }
                        com.google.android.gms.common.internal.w.checkNotNull((d4) this.f28841c);
                        ((AtomicReference) this.f28840b).set(h0Var.s((Bundle) this.f28842d, (d4) this.f28841c));
                        ((a3) this.f28843e).R();
                        ((AtomicReference) this.f28840b).notify();
                        return;
                    } finally {
                        ((AtomicReference) this.f28840b).notify();
                    }
                }
            case 12:
                Object obj8 = this.f28842d;
                Object objV = this.f28843e;
                try {
                    com.google.android.gms.measurement.internal.h0 h0Var3 = ((a3) objV).f21472d;
                    if (h0Var3 == null) {
                        ((a3) objV).zzj().f21834f.c("Discarding data. Failed to send event to service to bundle");
                    } else {
                        bArrZza = h0Var3.zza((com.google.android.gms.measurement.internal.y) this.f28840b, (String) this.f28841c);
                        ((a3) objV).R();
                        n4 n4VarV = ((a3) objV).v();
                        x0 x0Var3 = (x0) obj8;
                        n4VarV.V(x0Var3, bArrZza);
                        obj8 = x0Var3;
                        objV = n4VarV;
                    }
                } catch (RemoteException e15) {
                    ((a3) objV).zzj().f21834f.b(e15, "Failed to send event to the service to bundle");
                } finally {
                    ((a3) objV).v().V((x0) obj8, bArrZza);
                }
                return;
            case 13:
                b4 b4Var = (b4) this.f28843e;
                n4 n4VarX = b4Var.f21491b.X();
                String str5 = (String) this.f28840b;
                String str6 = (String) this.f28841c;
                Bundle bundle = (Bundle) this.f28842d;
                ((i8.d) b4Var.f21491b.zzb()).getClass();
                b4Var.f21491b.n((com.google.android.gms.measurement.internal.y) com.google.android.gms.common.internal.w.checkNotNull(n4VarX.J(str6, bundle, "auto", System.currentTimeMillis(), false)), str5);
                return;
            case 14:
                ((lc.a) this.f28843e).f30206b.error((String) this.f28840b, (String) this.f28841c, this.f28842d);
                return;
            default:
                synchronized (com.tekartik.sqflite.m.f24870f) {
                    Object obj9 = this.f28840b;
                    if (((com.tekartik.sqflite.d) obj9) != null) {
                        com.tekartik.sqflite.m.a((com.tekartik.sqflite.m) this.f28843e, (com.tekartik.sqflite.d) obj9);
                    }
                    try {
                        SQLiteDatabase.deleteDatabase(new File((String) this.f28841c));
                    } catch (Exception e16) {
                        e16.toString();
                        HashMap map = com.tekartik.sqflite.m.f24867c;
                    }
                    break;
                }
                ((ed.t) this.f28842d).success(null);
                return;
        }
    }

    public /* synthetic */ h(Object obj, Object obj2, Object obj3, Object obj4, int i10, int i11) {
        this.f28839a = i10;
        this.f28840b = obj;
        this.f28841c = obj2;
        this.f28842d = obj3;
        this.f28843e = obj4;
    }
}
