package e;

import android.content.ComponentName;
import android.content.Context;
import android.os.Build;
import java.lang.ref.WeakReference;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

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

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

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

    public /* synthetic */ q(Context context, int i10) {
        this.f25314a = i10;
        this.f25315b = context;
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x008c  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x009a  */
    @Override // java.lang.Runnable
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void run() {
        m0.h hVar;
        Object systemService;
        Context context;
        int i10 = this.f25314a;
        Context context2 = this.f25315b;
        switch (i10) {
            case 0:
                int i11 = Build.VERSION.SDK_INT;
                if (i11 >= 33) {
                    ComponentName componentName = new ComponentName(context2, "androidx.appcompat.app.AppLocalesMetadataHolderService");
                    if (context2.getPackageManager().getComponentEnabledSetting(componentName) != 1) {
                        if (i11 >= 33) {
                            androidx.collection.g gVar = w.f25353g;
                            gVar.getClass();
                            androidx.collection.b bVar = new androidx.collection.b(gVar);
                            while (true) {
                                if (bVar.hasNext()) {
                                    w wVar = (w) ((WeakReference) bVar.next()).get();
                                    if (wVar != null && (context = ((m0) wVar).f25285k) != null) {
                                        systemService = context.getSystemService("locale");
                                    }
                                } else {
                                    systemService = null;
                                }
                            }
                            hVar = systemService != null ? new m0.h(new m0.j(s.a(systemService))) : m0.h.f30286b;
                            if (((m0.j) hVar.f30287a).f30288a.isEmpty()) {
                                String strB = androidx.core.app.k.b(context2);
                                Object systemService2 = context2.getSystemService("locale");
                                if (systemService2 != null) {
                                    s.b(systemService2, r.a(strB));
                                }
                            }
                            context2.getPackageManager().setComponentEnabledSetting(componentName, 1, 1);
                        } else {
                            hVar = w.f25349c;
                            if (hVar == null) {
                            }
                            if (((m0.j) hVar.f30287a).f30288a.isEmpty()) {
                            }
                            context2.getPackageManager().setComponentEnabledSetting(componentName, 1, 1);
                        }
                    }
                }
                w.f25352f = true;
                break;
            case 1:
                new ThreadPoolExecutor(0, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue()).execute(new q(context2, 2));
                break;
            default:
                d3.i.b(context2, new m.a(14), d3.i.f24960a, false);
                break;
        }
    }
}
