package o;

import android.app.ActivityManager;
import android.app.Application;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import android.util.Log;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Zu, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public class C0669Zu implements InterfaceC2652un, InterfaceC0320Mj, D90, InterfaceC2919xe, InterfaceC0246Jm, Ut0, InterfaceC2126pA {
    public static C2961y00 C;
    public static volatile C0669Zu M;
    public static C2676v00 Z;
    public final /* synthetic */ int l;
    public static final C0159Gd m = new C0159Gd(-1.0f, -1.0f);
    public static final C0159Gd n = new C0159Gd(0.0f, -1.0f);

    /* renamed from: o, reason: collision with root package name */
    public static final C0159Gd f444o = new C0159Gd(1.0f, -1.0f);
    public static final C0159Gd p = new C0159Gd(-1.0f, 0.0f);
    public static final C0159Gd q = new C0159Gd(0.0f, 0.0f);
    public static final C0159Gd r = new C0159Gd(1.0f, 0.0f);
    public static final C0159Gd s = new C0159Gd(-1.0f, 1.0f);
    public static final C0159Gd t = new C0159Gd(0.0f, 1.0f);
    public static final C0159Gd u = new C0159Gd(1.0f, 1.0f);
    public static final C0133Fd v = new C0133Fd(-1.0f);
    public static final C0133Fd w = new C0133Fd(0.0f);
    public static final C0133Fd x = new C0133Fd(1.0f);
    public static final C0107Ed y = new C0107Ed(-1.0f);
    public static final C0107Ed z = new C0107Ed(0.0f);
    public static final C0107Ed A = new C0107Ed(1.0f);
    public static final C0669Zu B = new C0669Zu(2);
    public static final /* synthetic */ C0669Zu D = new C0669Zu(3);
    public static final /* synthetic */ C0669Zu E = new C0669Zu(4);
    public static final C0669Zu F = new C0669Zu(5);
    public static final C0669Zu G = new C0669Zu(6);
    public static final C0669Zu H = new C0669Zu(7);
    public static final C0669Zu I = new C0669Zu(8);
    public static final /* synthetic */ C0669Zu J = new C0669Zu(9);
    public static final /* synthetic */ C0669Zu K = new C0669Zu(10);
    public static final Object L = new Object();
    public static final /* synthetic */ C0669Zu N = new C0669Zu(12);
    public static final C0669Zu O = new C0669Zu(13);
    public static final C0669Zu P = new C0669Zu(14);
    public static final /* synthetic */ C0669Zu Q = new C0669Zu(15);
    public static final C0669Zu R = new C0669Zu(16);
    public static final C0669Zu S = new C0669Zu(17);
    public static final C0669Zu T = new C0669Zu(18);
    public static final C0387Oy U = new C0387Oy(12);
    public static final C0387Oy V = new C0387Oy(13);
    public static final C0387Oy W = new C0387Oy(14);
    public static final C0387Oy X = new C0387Oy(15);
    public static final C0669Zu Y = new C0669Zu(20);
    public static final C0669Zu a0 = new C0669Zu(21);
    public static final C0669Zu b0 = new C0669Zu(23);
    public static final Gk0 c0 = new Gk0();
    public static final /* synthetic */ C0669Zu d0 = new C0669Zu(25);
    public static final C0669Zu e0 = new C0669Zu(26);

    public /* synthetic */ C0669Zu(int i) {
        this.l = i;
    }

    public static C0669Zu e() {
        C0669Zu c0669Zu;
        synchronized (L) {
            try {
                if (M == null) {
                    M = new C0669Zu(11);
                }
                c0669Zu = M;
            } catch (Throwable th) {
                throw th;
            }
        }
        return c0669Zu;
    }

    public static ArrayList g(Context context) {
        List<ActivityManager.RunningAppProcessInfo> runningAppProcesses;
        int i = context.getApplicationInfo().uid;
        String str = context.getApplicationInfo().processName;
        Object systemService = context.getSystemService("activity");
        ActivityManager activityManager = systemService instanceof ActivityManager ? (ActivityManager) systemService : null;
        if (activityManager == null || (runningAppProcesses = activityManager.getRunningAppProcesses()) == null) {
            runningAppProcesses = C0332Mv.l;
        }
        ArrayList arrayList = new ArrayList();
        for (Object obj : runningAppProcesses) {
            if (obj != null) {
                arrayList.add(obj);
            }
        }
        ArrayList arrayList2 = new ArrayList();
        int size = arrayList.size();
        int i2 = 0;
        int i3 = 0;
        while (i3 < size) {
            Object obj2 = arrayList.get(i3);
            i3++;
            if (((ActivityManager.RunningAppProcessInfo) obj2).uid == i) {
                arrayList2.add(obj2);
            }
        }
        ArrayList arrayList3 = new ArrayList(AbstractC0034Bi.W(arrayList2, 10));
        int size2 = arrayList2.size();
        while (i2 < size2) {
            Object obj3 = arrayList2.get(i2);
            i2++;
            ActivityManager.RunningAppProcessInfo runningAppProcessInfo = (ActivityManager.RunningAppProcessInfo) obj3;
            C3008yb c3008yb = new C3008yb();
            String str2 = runningAppProcessInfo.processName;
            if (str2 == null) {
                throw new NullPointerException("Null processName");
            }
            c3008yb.a = str2;
            c3008yb.b = runningAppProcessInfo.pid;
            byte b = (byte) (c3008yb.e | 1);
            c3008yb.c = runningAppProcessInfo.importance;
            c3008yb.e = (byte) (b | 2);
            c3008yb.d = F3.c(str2, str);
            c3008yb.e = (byte) (c3008yb.e | 4);
            arrayList3.add(c3008yb.a());
        }
        return arrayList3;
    }

    public static C2147pV k() {
        float f = Qd0.a;
        return new C2147pV(f, Qd0.b, f, 0);
    }

    public static String l(String str) {
        int length = str.length();
        StringBuilder sb = new StringBuilder(23);
        sb.append("WM-");
        if (length >= 20) {
            sb.append(str.substring(0, 20));
        } else {
            sb.append(str);
        }
        return sb.toString();
    }

    public void a(Drawable drawable, C0321Mk c0321Mk, int i) {
        c0321Mk.X(257732500);
        int i2 = (c0321Mk.h(drawable) ? 4 : 2) | i;
        if (c0321Mk.N(i2 & 1, (i2 & 3) != 2)) {
            MP mpH = androidx.compose.foundation.layout.c.h(JP.a, AbstractC0038Bm.j);
            boolean zH = c0321Mk.h(drawable);
            Object objK = c0321Mk.K();
            if (zH || objK == C0140Fk.a) {
                objK = new S1(23, drawable);
                c0321Mk.f0(objK);
            }
            AbstractC3109ze.a(androidx.compose.ui.draw.a.a(mpH, (OC) objK), c0321Mk, 0);
        } else {
            c0321Mk.Q();
        }
        L00 l00S = c0321Mk.s();
        if (l00S != null) {
            l00S.d = new C0032Bg(i, 7, this, drawable);
        }
    }

    public void b(final Icon icon, C0321Mk c0321Mk, final int i) {
        L00 l00S;
        SC sc;
        c0321Mk.X(2116504409);
        int i2 = (c0321Mk.h(icon) ? 4 : 2) | i;
        if (c0321Mk.N(i2 & 1, (i2 & 19) != 18)) {
            Context context = (Context) c0321Mk.j(N3.b);
            boolean zF = c0321Mk.f(icon) | c0321Mk.f(context);
            Object objK = c0321Mk.K();
            if (zF || objK == C0140Fk.a) {
                objK = icon.loadDrawable(context);
                c0321Mk.f0(objK);
            }
            Drawable drawable = (Drawable) objK;
            if (drawable == null) {
                l00S = c0321Mk.s();
                if (l00S != null) {
                    final int i3 = 1;
                    sc = new SC(this, icon, i, i3) { // from class: o.nd0
                        public final /* synthetic */ int l;
                        public final /* synthetic */ C0669Zu m;
                        public final /* synthetic */ Icon n;

                        {
                            this.l = i3;
                            this.m = this;
                        }

                        @Override // o.SC
                        public final Object f(Object obj, Object obj2) {
                            int i4 = this.l;
                            C0321Mk c0321Mk2 = (C0321Mk) obj;
                            ((Integer) obj2).getClass();
                            switch (i4) {
                                case 0:
                                    this.m.b(this.n, c0321Mk2, AbstractC1904ms0.D(49));
                                    break;
                                default:
                                    this.m.b(this.n, c0321Mk2, AbstractC1904ms0.D(49));
                                    break;
                            }
                            return Oh0.a;
                        }
                    };
                    l00S.d = sc;
                }
                return;
            }
            a(drawable, c0321Mk, 48);
        } else {
            c0321Mk.Q();
        }
        l00S = c0321Mk.s();
        if (l00S != null) {
            final int i4 = 0;
            sc = new SC(this, icon, i, i4) { // from class: o.nd0
                public final /* synthetic */ int l;
                public final /* synthetic */ C0669Zu m;
                public final /* synthetic */ Icon n;

                {
                    this.l = i4;
                    this.m = this;
                }

                @Override // o.SC
                public final Object f(Object obj, Object obj2) {
                    int i42 = this.l;
                    C0321Mk c0321Mk2 = (C0321Mk) obj;
                    ((Integer) obj2).getClass();
                    switch (i42) {
                        case 0:
                            this.m.b(this.n, c0321Mk2, AbstractC1904ms0.D(49));
                            break;
                        default:
                            this.m.b(this.n, c0321Mk2, AbstractC1904ms0.D(49));
                            break;
                    }
                    return Oh0.a;
                }
            };
            l00S.d = sc;
        }
    }

    @Override // o.D90
    public boolean c(Object obj, Object obj2) {
        switch (this.l) {
            case 13:
                break;
            default:
                if (obj == obj2) {
                }
                break;
        }
        return false;
    }

    @Override // o.Ut0
    public boolean d(Class cls) {
        return AbstractC2665ut0.class.isAssignableFrom(cls);
    }

    @Override // o.Ut0
    public C1527iu0 f(Class cls) {
        if (!AbstractC2665ut0.class.isAssignableFrom(cls)) {
            throw new IllegalArgumentException("Unsupported message type: ".concat(cls.getName()));
        }
        try {
            return (C1527iu0) AbstractC2665ut0.l(cls.asSubclass(AbstractC2665ut0.class)).o(3);
        } catch (Exception e) {
            throw new RuntimeException("Unable to get message info for ".concat(cls.getName()), e);
        }
    }

    public AbstractC1610jo h(Context context) {
        Object obj;
        String processName;
        int iMyPid = Process.myPid();
        ArrayList arrayListG = g(context);
        int size = arrayListG.size();
        int i = 0;
        while (true) {
            if (i >= size) {
                obj = null;
                break;
            }
            obj = arrayListG.get(i);
            i++;
            if (((C3103zb) ((AbstractC1610jo) obj)).b == iMyPid) {
                break;
            }
        }
        AbstractC1610jo abstractC1610jo = (AbstractC1610jo) obj;
        if (abstractC1610jo != null) {
            return abstractC1610jo;
        }
        int i2 = Build.VERSION.SDK_INT;
        if (i2 > 33) {
            processName = Process.myProcessName();
        } else if (i2 < 28 || (processName = Application.getProcessName()) == null) {
            processName = "";
        }
        C3008yb c3008yb = new C3008yb();
        c3008yb.a = processName;
        c3008yb.b = iMyPid;
        byte b = (byte) (c3008yb.e | 1);
        c3008yb.c = 0;
        c3008yb.d = false;
        c3008yb.e = (byte) (((byte) (b | 2)) | 4);
        return c3008yb.a();
    }

    @Override // o.InterfaceC0320Mj
    public Object i(U7 u7) {
        switch (this.l) {
            case 7:
                return new C0768ax((Executor) u7.e(new JZ(InterfaceC1281gL.class, Executor.class)));
            default:
                return new C0768ax((Executor) u7.e(new JZ(Eh0.class, Executor.class)));
        }
    }

    @Override // o.InterfaceC2919xe
    public long j(int i, C2642ui c2642ui) {
        String str = ((Ne0) c2642ui.e).a.a.m;
        return AbstractC2378rs0.u(AbstractC2461sm0.o(str, i), AbstractC2461sm0.n(str, i));
    }

    @Override // o.InterfaceC0246Jm
    public Object then(Pc0 pc0) throws IOException {
        if (pc0.h()) {
            return (Bundle) pc0.f();
        }
        if (Log.isLoggable("Rpc", 3)) {
            "Error making request: ".concat(String.valueOf(pc0.e()));
        }
        throw new IOException("SERVICE_NOT_AVAILABLE", pc0.e());
    }

    public String toString() {
        switch (this.l) {
            case 13:
                return "NeverEqualPolicy";
            case 14:
                return "coil.request.NullRequestData";
            case 15:
            case 16:
            default:
                return super.toString();
            case 17:
                return "ReferentialEqualityPolicy";
        }
    }
}
