package defpackage;

import android.app.job.JobParameters;
import android.content.Context;
import android.graphics.Rect;
import android.media.AudioDeviceInfo;
import android.media.AudioManager;
import android.media.AudioRouting;
import android.net.Uri;
import android.os.Looper;
import android.os.Process;
import android.os.StrictMode;
import android.view.View;
import android.view.ViewGroup;
import com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.Callable;

/* renamed from: ʿᴵᵱᵣ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final /* synthetic */ class RunnableC0421 implements Runnable {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final /* synthetic */ Object f2329;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final /* synthetic */ int f2330;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final /* synthetic */ Object f2331;

    public /* synthetic */ RunnableC0421(int i, Object obj, Object obj2, Object obj3, boolean z) {
        this.f2330 = i;
        this.f2329 = obj2;
        this.f2331 = obj3;
    }

    public /* synthetic */ RunnableC0421(Object obj, int i, Object obj2) {
        this.f2330 = i;
        this.f2329 = obj;
        this.f2331 = obj2;
    }

    public /* synthetic */ RunnableC0421(Object obj, Object obj2, Object obj3, int i) {
        this.f2330 = i;
        this.f2329 = obj;
        this.f2331 = obj2;
    }

    public /* synthetic */ RunnableC0421(C3960 c3960, int i, ListenableFuture listenableFuture) {
        this.f2330 = 0;
        this.f2329 = c3960;
        this.f2331 = listenableFuture;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    private final void m1918() {
        C3940 c3940 = (C3940) this.f2329;
        InterfaceC3290 interfaceC3290 = (InterfaceC3290) this.f2331;
        synchronized (c3940) {
            try {
                if (c3940.f14882 == null) {
                    c3940.f14881.add(interfaceC3290);
                } else {
                    c3940.f14882.add(interfaceC3290.get());
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    private final void m1919() {
        ᵪᵨ r0 = (ᵪᵨ) this.f2329;
        synchronized (((C4779) this.f2331)) {
        }
        InterfaceC3662 interfaceC3662 = (InterfaceC3662) r0.ᵿʗᵝʽ;
        String str = AbstractC3558.f13329;
        C3916 c3916 = ((SurfaceHolderCallbackC4282) interfaceC3662).f16066;
        C0422 c0422 = c3916.f14777;
        c0422.m1929(c0422.m1949((C2477) c0422.f2339.f12986), 1013, new C2651(3));
        c3916.f14772 = null;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    private final void m1920() {
        InterfaceC5384 interfaceC5384;
        C5032 c5032 = (C5032) this.f2329;
        InterfaceC3290 interfaceC3290 = (InterfaceC3290) this.f2331;
        if (c5032.f18814 != C5032.f18812) {
            ᵹˉᵞ.ᵳٴᵶ("provide() can be called only once.");
            return;
        }
        synchronized (c5032) {
            interfaceC5384 = c5032.f18813;
            c5032.f18813 = null;
            c5032.f18814 = interfaceC3290;
        }
        interfaceC5384.mo3823(interfaceC3290);
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // java.lang.Runnable
    public final void run() throws SecurityException, IllegalArgumentException {
        C0744 c0744;
        int i;
        long j;
        boolean z;
        int i2 = 1;
        int i3 = 0;
        switch (this.f2330) {
            case 0:
                ((C3960) this.f2329).m8760((ListenableFuture) this.f2331);
                return;
            case 1:
                ((C3960) this.f2329).m8763((AbstractC3821) this.f2331);
                return;
            case 2:
                ExecutorC1145 executorC1145 = (ExecutorC1145) this.f2329;
                try {
                    ((Runnable) this.f2331).run();
                    return;
                } finally {
                    executorC1145.m3597();
                }
            case 3:
                C2137 c2137 = (C2137) this.f2329;
                RunnableC0421 runnableC0421 = (RunnableC0421) this.f2331;
                c2137.f8424.mo8820();
                C1768 c1768 = c2137.f8426;
                synchronized (c1768.f7136) {
                    c1768.m5044();
                    runnableC0421.run();
                }
                return;
            case 4:
                Context context = (Context) this.f2329;
                C1790 c1790 = (C1790) this.f2331;
                AbstractC4618.f17098 = (AudioManager) context.getSystemService("audio");
                c1790.m5098();
                return;
            case 5:
                m1919();
                return;
            case C1339.STRING_SET_FIELD_NUMBER /* 6 */:
                ᵪᵨ r0 = (ᵪᵨ) this.f2329;
                C3446 c3446 = (C3446) this.f2331;
                InterfaceC3662 interfaceC3662 = (InterfaceC3662) r0.ᵿʗᵝʽ;
                String str = AbstractC3558.f13329;
                C3916 c3916 = ((SurfaceHolderCallbackC4282) interfaceC3662).f16066;
                c3916.f14772 = c3446;
                C0422 c0422 = c3916.f14777;
                c0422.m1929(c0422.m1924(), 1009, new C2651(11));
                return;
            case C1339.DOUBLE_FIELD_NUMBER /* 7 */:
                ᵪᵨ r02 = (ᵪᵨ) this.f2329;
                C0397 c0397 = (C0397) this.f2331;
                InterfaceC3662 interfaceC36622 = (InterfaceC3662) r02.ᵿʗᵝʽ;
                String str2 = AbstractC3558.f13329;
                C2720.m6729(((SurfaceHolderCallbackC4282) interfaceC36622).f16066.f14736, c0397);
                return;
            case C1339.BYTES_FIELD_NUMBER /* 8 */:
                C1561.m4532((C1561) this.f2329, (AudioRouting) this.f2331);
                return;
            case 9:
                C1561 c1561 = (C1561) this.f2329;
                AudioDeviceInfo audioDeviceInfo = (AudioDeviceInfo) this.f2331;
                if (c1561.f6217 == null || (c0744 = ((C2171) c1561.f6216.f11366).f8568) == null || audioDeviceInfo.equals((AudioDeviceInfo) c0744.f3577)) {
                    return;
                }
                c0744.f3577 = audioDeviceInfo;
                c0744.m2811(C3303.m7694((Context) c0744.f3576, (C1028) c0744.f3578, audioDeviceInfo, c0744.m2809()));
                return;
            case 10:
                C1611 c1611 = (C1611) this.f2329;
                Object objApply = ((InterfaceC3923) this.f2331).apply(c1611.f6399);
                c1611.f6399 = objApply;
                RunnableC4585 runnableC4585 = new RunnableC4585(c1611, objApply, i2);
                C5073 c5073 = (C5073) c1611.f6400;
                if (c5073.f18953.getLooper().getThread().isAlive()) {
                    c5073.m10539(runnableC4585);
                    return;
                }
                return;
            case 11:
                ᵿᵧ.ᵻᵢﹳᵰ((C5205) this.f2329, ((UUID) this.f2331).toString());
                return;
            case 12:
                m1920();
                return;
            case 13:
                m1918();
                return;
            case 14:
                List<C0638> list = (List) this.f2329;
                AbstractC0387 abstractC0387 = (AbstractC0387) this.f2331;
                for (C0638 c0638 : list) {
                    Object obj = abstractC0387.f2240;
                    AbstractC0661 abstractC0661 = c0638.f3145;
                    Object c2336 = abstractC0661.mo2608(obj) ? new C2336(abstractC0661.mo2611()) : C3289.f12328;
                    C1828 c1828 = c0638.f3146;
                    c1828.getClass();
                    c1828.mo5181(c2336);
                }
                return;
            case 15:
                ((C5432) this.f2329).m11077((String) this.f2331, Boolean.FALSE);
                return;
            case 16:
                ThreadFactoryC0498 threadFactoryC0498 = (ThreadFactoryC0498) this.f2329;
                Runnable runnable = (Runnable) this.f2331;
                Process.setThreadPriority(threadFactoryC0498.f2629);
                StrictMode.ThreadPolicy threadPolicy = threadFactoryC0498.f2632;
                if (threadPolicy != null) {
                    StrictMode.setThreadPolicy(threadPolicy);
                }
                runnable.run();
                return;
            case 17:
                ((InterfaceC4086) this.f2329).mo1689((Throwable) this.f2331);
                return;
            case 18:
                C2014 c2014 = (C2014) this.f2329;
                C3446 c34462 = (C3446) this.f2331;
                C4788 c4788 = c2014.f8089;
                if (c4788.f17782 == 0 || c2014.f8090) {
                    return;
                }
                Looper looper = c4788.f17783;
                looper.getClass();
                c2014.f8087 = c4788.m10109(looper, c2014.f8088, c34462, false);
                c4788.f17789.add(c2014);
                return;
            case 19:
                C4333 c4333 = (C4333) this.f2329;
                Uri uri = (Uri) this.f2331;
                c4333.f16214 = false;
                c4333.m9296(uri);
                return;
            case 20:
                C0423 c0423 = (C0423) this.f2329;
                C0423 c04232 = (C0423) this.f2331;
                AbstractComponentCallbacksC3693 abstractComponentCallbacksC3693 = c0423.f2345;
                AbstractComponentCallbacksC3693 abstractComponentCallbacksC36932 = c04232.f2345;
                C1159 c1159 = AbstractC1415.f5790;
                return;
            case 21:
                AbstractC4613.m9779((View) this.f2329, (Rect) this.f2331);
                return;
            case 22:
                C2457 c2457 = (C2457) this.f2329;
                ViewGroup viewGroup = (ViewGroup) this.f2331;
                ArrayList arrayList = c2457.f9593;
                int size = arrayList.size();
                while (i3 < size) {
                    Object obj2 = arrayList.get(i3);
                    i3++;
                    C0423 c04233 = (C0423) ((ᵢˇᵭ) ((C2101) obj2)).ᵧᵾˀˈ;
                    View view = c04233.f2345.f13752;
                    if (view != null) {
                        AbstractC2990.m7328(c04233.f2347, view, viewGroup);
                    }
                }
                return;
            case 23:
                ((C2273) ((ᵪᵨ) this.f2329).ᵿʗᵝʽ).f8888.m9271((C3788) this.f2331);
                return;
            case 24:
                Callable callable = (Callable) this.f2329;
                ScheduledFutureC1422 scheduledFutureC1422 = (ScheduledFutureC1422) ((C2931) this.f2331).f11366;
                try {
                    scheduledFutureC1422.m6181(callable.call());
                    return;
                } catch (Exception e) {
                    scheduledFutureC1422.mo2504(e);
                    return;
                }
            case 25:
                C3916 c39162 = (C3916) this.f2329;
                C3751 c3751 = (C3751) this.f2331;
                int i4 = c39162.f14743 - c3751.f13996;
                c39162.f14743 = i4;
                if (c3751.f13992) {
                    c39162.f14774 = c3751.f13994;
                    c39162.f14724 = true;
                }
                if (i4 == 0) {
                    AbstractC0488 abstractC0488 = ((C4659) c3751.f13993).f17251;
                    int iM8649 = -1;
                    if (!c39162.f14769.f17251.m2115() && abstractC0488.m2115()) {
                        c39162.f14718 = -1;
                        c39162.f14781 = 0L;
                    }
                    if (!abstractC0488.m2115()) {
                        List listAsList = Arrays.asList(((C2906) abstractC0488).f11313);
                        ᵛᵾˏ.ᵿʗᵝʽ(listAsList.size() == c39162.f14731.size());
                        for (int i5 = 0; i5 < listAsList.size(); i5++) {
                            ((C2476) c39162.f14731.get(i5)).f9680 = (AbstractC0488) listAsList.get(i5);
                        }
                    }
                    long j2 = -9223372036854775807L;
                    if (c39162.f14724) {
                        boolean z2 = ((C4659) c3751.f13993).f17251.m2115() && c39162.f14769.f17251.m2115();
                        boolean zEquals = ((C4659) c3751.f13993).f17256.equals(c39162.f14769.f17256);
                        boolean z3 = ((C4659) c3751.f13993).f17261 == c39162.f14769.f17249;
                        if (z2 || (zEquals && z3)) {
                            i2 = 0;
                        }
                        if (i2 != 0) {
                            iM8649 = c39162.m8649();
                            if (abstractC0488.m2115() || ((C4659) c3751.f13993).f17256.m6321()) {
                                j2 = ((C4659) c3751.f13993).f17261;
                            } else {
                                C4659 c4659 = (C4659) c3751.f13993;
                                C2477 c2477 = c4659.f17256;
                                long j3 = c4659.f17261;
                                Object obj3 = c2477.f9683;
                                C4479 c4479 = c39162.f14771;
                                abstractC0488.mo2117(obj3, c4479);
                                j2 = j3 + c4479.f16705;
                            }
                        }
                        i = iM8649;
                        j = j2;
                        z = i2;
                    } else {
                        i = -1;
                        j = -9223372036854775807L;
                        z = 0;
                    }
                    c39162.f14724 = false;
                    c39162.m8617((C4659) c3751.f13993, 1, z, c39162.f14774, j, i, false);
                    return;
                }
                return;
            case 26:
                ((C4385) this.f2329).m9413((C4481) this.f2331);
                return;
            case 27:
                C1755 c1755 = (C1755) this.f2329;
                C3508 c3508 = (C3508) this.f2331;
                ˑᵽʾʦ r03 = c1755.f7051;
                Uri uri2 = c3508.f13152;
                C5426 c5426 = (C5426) ((C4946) r03.ᵢˇᵭ).f18390.f4768.get(uri2);
                if (c5426 != null) {
                    C5426.m11071(c5426, uri2, true);
                    return;
                }
                return;
            case 28:
                JobInfoSchedulerService jobInfoSchedulerService = (JobInfoSchedulerService) this.f2329;
                JobParameters jobParameters = (JobParameters) this.f2331;
                int i6 = JobInfoSchedulerService.ᵧᵾˀˈ;
                jobInfoSchedulerService.jobFinished(jobParameters, false);
                return;
            default:
                AbstractC5180 abstractC5180 = (AbstractC5180) this.f2329;
                abstractC5180.f19353.set(abstractC5180.m9535((C2720) this.f2331, abstractC5180.f19307, 0));
                return;
        }
    }
}
