package m4;

import B0.C0037y;
import B0.C0038z;
import B0.I;
import B0.t0;
import D0.C0070g;
import android.content.Context;
import android.content.IntentFilter;
import android.media.AudioManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.telephony.TelephonyManager;
import com.rubensousa.dpadrecyclerview.DpadRecyclerView;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import n.U0;
import n4.u0;
import r4.C1495b;
import v0.AbstractC1664c;
import w2.EnumC1700c;
import x0.v;

/* JADX INFO: renamed from: m4.p, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class RunnableC1180p implements Runnable {

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

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

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

    public /* synthetic */ RunnableC1180p(Object obj, int i, Object obj2) {
        this.f14643q = i;
        this.f14644r = obj;
        this.f14645s = obj2;
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0049  */
    /* JADX WARN: Removed duplicated region for block: B:23:0x004b  */
    /* JADX WARN: Removed duplicated region for block: B:24:0x004d  */
    @Override // java.lang.Runnable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void run() {
        switch (this.f14643q) {
            case u0.f15495q /* 0 */:
                U0 u02 = (U0) this.f14644r;
                ((C1172h) u02.f14793a).i((String) u02.f14795c, (List) this.f14645s);
                break;
            case 1:
                m6.a aVar = (m6.a) this.f14644r;
                P6.g.e(aVar, "this$0");
                DpadRecyclerView dpadRecyclerView = (DpadRecyclerView) this.f14645s;
                P6.g.e(dpadRecyclerView, "$this_apply");
                if (aVar.f14652q.f13528e) {
                    dpadRecyclerView.requestLayout();
                }
                dpadRecyclerView.w0();
                break;
            case 2:
                C1495b c1495b = (C1495b) this.f14644r;
                c1495b.getClass();
                try {
                    z2.o.a().f19280d.a(((z2.i) c1495b.f16451h.f3552q).b(EnumC1700c.f18298s), 1);
                    break;
                } catch (Exception unused) {
                }
                ((CountDownLatch) this.f14645s).countDown();
                break;
            case 3:
                AbstractC1664c.f18005a = (AudioManager) ((Context) this.f14644r).getSystemService("audio");
                ((t0) this.f14645s).f();
                break;
            case 4:
                K2.e eVar = (K2.e) this.f14644r;
                eVar.getClass();
                Object obj = this.f14645s;
                Object obj2 = eVar.f3555t;
                eVar.f3555t = obj;
                if (!obj2.equals(obj)) {
                    C0038z c0038z = (C0038z) eVar.f3554s;
                    c0038z.getClass();
                    ((Integer) obj2).getClass();
                    Integer num = (Integer) obj;
                    int iIntValue = num.intValue();
                    I i = c0038z.f927q;
                    i.p0();
                    i.f0(1, 10, num);
                    i.f0(2, 10, num);
                    i.f532C.e(21, new C0037y(iIntValue, 1));
                }
                break;
            case 5:
                x0.n nVar = (x0.n) this.f14644r;
                nVar.getClass();
                IntentFilter intentFilter = new IntentFilter();
                intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
                ((Context) this.f14645s).registerReceiver(new C0070g(2, nVar), intentFilter);
                break;
            default:
                x0.n nVar2 = (x0.n) ((C0070g) this.f14644r).f1547b;
                nVar2.getClass();
                Context context = (Context) this.f14645s;
                ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
                int i5 = 0;
                if (connectivityManager != null) {
                    try {
                        NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo();
                        if (activeNetworkInfo == null || !activeNetworkInfo.isConnected()) {
                            i5 = 1;
                        } else {
                            int type = activeNetworkInfo.getType();
                            if (type == 0) {
                                switch (activeNetworkInfo.getSubtype()) {
                                    case 1:
                                    case 2:
                                        i5 = 3;
                                        break;
                                    case 3:
                                    case 4:
                                    case 5:
                                    case Z.g.STRING_SET_FIELD_NUMBER /* 6 */:
                                    case Z.g.DOUBLE_FIELD_NUMBER /* 7 */:
                                    case Z.g.BYTES_FIELD_NUMBER /* 8 */:
                                    case 9:
                                    case 10:
                                    case 11:
                                    case 12:
                                    case 14:
                                    case 15:
                                    case 17:
                                        i5 = 4;
                                        break;
                                    case 13:
                                        i5 = 5;
                                        break;
                                    case 16:
                                    case 19:
                                    default:
                                        i5 = 6;
                                        break;
                                    case 18:
                                        i5 = 2;
                                        break;
                                    case 20:
                                        if (v.f18553a >= 29) {
                                            i5 = 9;
                                        }
                                        break;
                                }
                            } else if (type != 1) {
                                if (type != 4 && type != 5) {
                                    if (type != 6) {
                                        i5 = type != 9 ? 8 : 7;
                                    }
                                }
                            }
                        }
                    } catch (SecurityException unused2) {
                    }
                }
                if (v.f18553a < 31 || i5 != 5) {
                    nVar2.c(i5);
                } else {
                    try {
                        TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService("phone");
                        telephonyManager.getClass();
                        x0.l lVar = new x0.l(nVar2);
                        telephonyManager.registerTelephonyCallback(nVar2.f18531a, lVar);
                        telephonyManager.unregisterTelephonyCallback(lVar);
                    } catch (RuntimeException unused3) {
                        nVar2.c(5);
                        return;
                    }
                }
                break;
        }
    }
}
