package defpackage;

import android.app.Activity;
import android.app.AppOpsManager;
import android.app.ForegroundServiceStartNotAllowedException;
import android.app.Notification;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ApplicationInfo;
import android.content.res.Resources;
import android.graphics.Insets;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.media.AudioAttributes;
import android.media.AudioFormat;
import android.media.AudioTrack;
import android.media.MediaCodecInfo;
import android.os.Build;
import android.os.Process;
import android.os.Trace;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowInsets;
import android.widget.PopupWindow;
import androidx.media3.exoplayer.mediacodec.MediaCodecUtil$DecoderQueryException;
import androidx.work.impl.foreground.SystemForegroundService;
import ar.tvplayer.tv.base.ScreenOnService;
import defpackage.C3309;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;

/* renamed from: ᵽᵣ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC5363 {
    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public static void m10985(View view, int i) {
        view.setTransitionVisibility(i);
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static int m10986(boolean z) {
        MediaCodecInfo.VideoCapabilities videoCapabilities;
        List<MediaCodecInfo.VideoCapabilities.PerformancePoint> supportedPerformancePoints;
        try {
            C2153 c2153 = new C2153();
            c2153.f8516 = AbstractC2924.m7101("video/avc");
            C3446 c3446 = new C3446(c2153);
            String str = c3446.f12929;
            if (str != null) {
                List listM11161 = AbstractC5552.m11161(str, z, false);
                String strM11164 = AbstractC5552.m11164(c3446);
                Iterable iterableM11161 = strM11164 == null ? C4471.f16684 : AbstractC5552.m11161(strM11164, z, false);
                C4704 c4704M6701 = AbstractC2692.m6701();
                c4704M6701.m3198(listM11161);
                c4704M6701.m3198(iterableM11161);
                C4471 c4471M9892 = c4704M6701.m9892();
                for (int i = 0; i < c4471M9892.f16685; i++) {
                    if (((C0381) c4471M9892.get(i)).f2190 != null && (videoCapabilities = ((C0381) c4471M9892.get(i)).f2190.getVideoCapabilities()) != null && (supportedPerformancePoints = videoCapabilities.getSupportedPerformancePoints()) != null && !supportedPerformancePoints.isEmpty()) {
                        MediaCodecInfo.VideoCapabilities.PerformancePoint performancePoint = new MediaCodecInfo.VideoCapabilities.PerformancePoint(1280, 720, 60);
                        for (int i2 = 0; i2 < supportedPerformancePoints.size(); i2++) {
                            if (C1260.m3821(supportedPerformancePoints.get(i2)).covers(performancePoint)) {
                                return 2;
                            }
                        }
                        return 1;
                    }
                }
            }
        } catch (MediaCodecUtil$DecoderQueryException unused) {
        }
        return 0;
    }

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public static void m10987(Resources.Theme theme) {
        theme.rebase();
    }

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public static float m10988(View view) {
        return view.getTransitionAlpha();
    }

    /* JADX WARN: Code restructure failed: missing block: B:20:0x0046, code lost:
    
        if (r5.f16601 == r8.hashCode()) goto L21;
     */
    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static android.content.res.ColorStateList m10989(android.content.Context r8, int r9) throws android.content.res.Resources.NotFoundException {
        /*
            android.content.res.Resources r0 = r8.getResources()
            android.content.res.Resources$Theme r8 = r8.getTheme()
            ˊᵻᵞ r1 = new ˊᵻᵞ
            r1.<init>(r0, r8)
            java.lang.Object r2 = defpackage.AbstractC4701.f17377
            monitor-enter(r2)
            java.util.WeakHashMap r3 = defpackage.AbstractC4701.f17379     // Catch: java.lang.Throwable -> L3c
            java.lang.Object r3 = r3.get(r1)     // Catch: java.lang.Throwable -> L3c
            android.util.SparseArray r3 = (android.util.SparseArray) r3     // Catch: java.lang.Throwable -> L3c
            r4 = 0
            if (r3 == 0) goto L4f
            int r5 = r3.size()     // Catch: java.lang.Throwable -> L3c
            if (r5 <= 0) goto L4f
            java.lang.Object r5 = r3.get(r9)     // Catch: java.lang.Throwable -> L3c
            ᵱﹳᵕˎ r5 = (defpackage.C4448) r5     // Catch: java.lang.Throwable -> L3c
            if (r5 == 0) goto L4f
            android.content.res.Configuration r6 = r5.f16603     // Catch: java.lang.Throwable -> L3c
            android.content.res.Configuration r7 = r0.getConfiguration()     // Catch: java.lang.Throwable -> L3c
            boolean r6 = r6.equals(r7)     // Catch: java.lang.Throwable -> L3c
            if (r6 == 0) goto L4c
            if (r8 != 0) goto L3e
            int r6 = r5.f16601     // Catch: java.lang.Throwable -> L3c
            if (r6 == 0) goto L48
            goto L3e
        L3c:
            r8 = move-exception
            goto L88
        L3e:
            if (r8 == 0) goto L4c
            int r6 = r5.f16601     // Catch: java.lang.Throwable -> L3c
            int r7 = r8.hashCode()     // Catch: java.lang.Throwable -> L3c
            if (r6 != r7) goto L4c
        L48:
            android.content.res.ColorStateList r3 = r5.f16602     // Catch: java.lang.Throwable -> L3c
            monitor-exit(r2)     // Catch: java.lang.Throwable -> L3c
            goto L51
        L4c:
            r3.remove(r9)     // Catch: java.lang.Throwable -> L3c
        L4f:
            monitor-exit(r2)     // Catch: java.lang.Throwable -> L3c
            r3 = r4
        L51:
            if (r3 == 0) goto L54
            return r3
        L54:
            java.lang.ThreadLocal r2 = defpackage.AbstractC4701.f17378
            java.lang.Object r3 = r2.get()
            android.util.TypedValue r3 = (android.util.TypedValue) r3
            if (r3 != 0) goto L66
            android.util.TypedValue r3 = new android.util.TypedValue
            r3.<init>()
            r2.set(r3)
        L66:
            r2 = 1
            r0.getValue(r9, r3, r2)
            int r2 = r3.type
            r3 = 28
            if (r2 < r3) goto L75
            r3 = 31
            if (r2 > r3) goto L75
            goto L7d
        L75:
            android.content.res.XmlResourceParser r2 = r0.getXml(r9)
            android.content.res.ColorStateList r4 = defpackage.AbstractC3551.m8087(r0, r2, r8)     // Catch: java.lang.Exception -> L7d
        L7d:
            if (r4 == 0) goto L83
            defpackage.AbstractC4701.m9890(r1, r9, r4, r8)
            goto L87
        L83:
            android.content.res.ColorStateList r4 = r0.getColorStateList(r9, r8)
        L87:
            return r4
        L88:
            monitor-exit(r2)     // Catch: java.lang.Throwable -> L3c
            throw r8
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.AbstractC5363.m10989(android.content.Context, int):android.content.res.ColorStateList");
    }

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public static void m10990(SystemForegroundService systemForegroundService, int i, Notification notification, int i2) {
        try {
            systemForegroundService.startForeground(i, notification, i2);
        } catch (ForegroundServiceStartNotAllowedException unused) {
            ᵼᵫᵧˀ r0 = ᵼᵫᵧˀ.ˀᵗᵝᵭ();
            int i3 = SystemForegroundService.ᵤᵙᵷ;
            r0.getClass();
        } catch (SecurityException unused2) {
            ᵼᵫᵧˀ r02 = ᵼᵫᵧˀ.ˀᵗᵝᵭ();
            int i4 = SystemForegroundService.ᵤᵙᵷ;
            r02.getClass();
        }
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public static int m10991(Context context, int i) {
        return context.getColor(i);
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public static int m10992(Context context, String str) throws NoSuchMethodException, ClassNotFoundException, SecurityException {
        boolean zM6534;
        Method method;
        Integer num;
        if (str == null) {
            C1260.m3813("permission must be non-null");
            return 0;
        }
        int i = Build.VERSION.SDK_INT;
        if (i >= 33 || !TextUtils.equals("android.permission.POST_NOTIFICATIONS", str)) {
            return context.checkPermission(str, Process.myPid(), Process.myUid());
        }
        C1357 c1357 = new C1357(context);
        if (i >= 24) {
            zM6534 = AbstractC2602.m6534(c1357.f5585);
        } else {
            AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService("appops");
            ApplicationInfo applicationInfo = context.getApplicationInfo();
            String packageName = context.getApplicationContext().getPackageName();
            int i2 = applicationInfo.uid;
            try {
                Class<?> cls = Class.forName(AppOpsManager.class.getName());
                Class<?> cls2 = Integer.TYPE;
                method = cls.getMethod("checkOpNoThrow", cls2, cls2, String.class);
                num = (Integer) cls.getDeclaredField("OP_POST_NOTIFICATION").get(Integer.class);
                num.getClass();
            } catch (ClassNotFoundException | IllegalAccessException | NoSuchFieldException | NoSuchMethodException | RuntimeException | InvocationTargetException unused) {
            }
            zM6534 = ((Integer) method.invoke(appOpsManager, num, Integer.valueOf(i2), packageName)).intValue() == 0;
        }
        return zM6534 ? 0 : -1;
    }

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public static void m10993(ScreenOnService screenOnService, Notification notification) {
        screenOnService.startForeground(1, notification, -1);
    }

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public static void m10994(Notification.Builder builder) {
        builder.setBubbleMetadata(null);
    }

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public static void m10995(View view, Matrix matrix) {
        view.transformMatrixToLocal(matrix);
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public static int m10996(int i, int i2, C1028 c1028) {
        for (int i3 = 10; i3 > 0; i3--) {
            int iM8141 = AbstractC3558.m8141(i3);
            if (iM8141 != 0 && AudioTrack.isDirectPlaybackSupported(new AudioFormat.Builder().setEncoding(i).setSampleRate(i2).setChannelMask(iM8141).build(), c1028.m3392())) {
                return i3;
            }
        }
        return 0;
    }

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public static void m10997(Notification.Builder builder, boolean z) {
        builder.setAllowSystemGeneratedContextualActions(z);
    }

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public static final void m10998(Activity activity, C3309.C3310 c3310) {
        activity.registerActivityLifecycleCallbacks(c3310);
    }

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public static void m10999(SystemForegroundService systemForegroundService, int i, Notification notification, int i2) {
        systemForegroundService.startForeground(i, notification, i2);
    }

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public static void m11000(View view, float f) {
        view.setTransitionAlpha(f);
    }

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public static void m11001(C1496 c1496, Rect rect) {
        c1496.setEpicenterBounds(rect);
    }

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public static void m11002(PopupWindow popupWindow) {
        popupWindow.setTouchModal(false);
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static void m11003(AudioAttributes.Builder builder) {
        builder.setHapticChannelsMuted(true);
    }

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public static void m11004(ViewGroup viewGroup, boolean z) {
        viewGroup.suppressLayout(z);
    }

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public static void m11005(Notification.Action.Builder builder) {
        builder.setContextual(false);
    }

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public static void m11006(AudioAttributes.Builder builder) {
        builder.setAllowedCapturePolicy(1);
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public static String m11007(Context context) {
        String str = context.getApplicationContext().getPackageName() + ".DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION";
        if (ᵯᵽᵦ.ᵻᵢﹳᵰ(context, str) == 0) {
            return str;
        }
        if (Build.VERSION.SDK_INT >= 29) {
            str = context.getOpPackageName() + ".DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION";
            if (ᵯᵽᵦ.ᵻᵢﹳᵰ(context, str) == 0) {
                return str;
            }
        }
        C1260.m3816(AbstractC4486.m9550("Permission ", str, " is required by your application to receive broadcasts, please add it to your manifest"));
        return null;
    }

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public static void m11008(ScreenOnService screenOnService, Notification notification) {
        screenOnService.startForeground(1, notification, -1);
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public static boolean m11009() {
        return Trace.isEnabled();
    }

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public static Insets m11010(int i, int i2, int i3, int i4) {
        return Insets.of(i, i2, i3, i4);
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static int m11011(MediaCodecInfo.VideoCapabilities videoCapabilities, int i, int i2, double d) {
        boolean z;
        int i3;
        List<MediaCodecInfo.VideoCapabilities.PerformancePoint> supportedPerformancePoints = videoCapabilities.getSupportedPerformancePoints();
        if (supportedPerformancePoints != null && !supportedPerformancePoints.isEmpty()) {
            MediaCodecInfo.VideoCapabilities.PerformancePoint performancePoint = new MediaCodecInfo.VideoCapabilities.PerformancePoint(i, i2, (int) d);
            int i4 = 0;
            while (true) {
                z = true;
                if (i4 >= supportedPerformancePoints.size()) {
                    i3 = 1;
                    break;
                }
                if (C1260.m3821(supportedPerformancePoints.get(i4)).covers(performancePoint)) {
                    i3 = 2;
                    break;
                }
                i4++;
            }
            if (i3 == 1 && ᵳـᵔʤ.ˏˋٴ == null) {
                int i5 = Build.VERSION.SDK_INT;
                if (i5 < 37) {
                    int iM10986 = m10986(true);
                    if (i5 < 35 ? !(m10986(false) != 2 || iM10986 == 1) : iM10986 != 1) {
                    }
                    ᵳـᵔʤ.ˏˋٴ = Boolean.valueOf(z);
                    if (!z) {
                    }
                }
                z = false;
                ᵳـᵔʤ.ˏˋٴ = Boolean.valueOf(z);
                if (!z) {
                }
            }
            return i3;
        }
        return 0;
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public static String m11012(Context context) {
        return context.getOpPackageName();
    }

    /* renamed from: ᵸʓᵠ, reason: contains not printable characters */
    public static Intent m11013(Context context, BroadcastReceiver broadcastReceiver, IntentFilter intentFilter, String str, int i) {
        int i2 = i & 2;
        if (i2 == 0 && (i & 4) == 0) {
            ᵹˉᵞ.ˌᵜᵹᵩ("One of either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED is required");
            return null;
        }
        if (i2 == 0 || (i & 4) == 0) {
            int i3 = Build.VERSION.SDK_INT;
            return i3 >= 33 ? AbstractC4618.m9790(context, broadcastReceiver, intentFilter, str, i) : i3 >= 26 ? ﹶʾ.ᵹᵝᵶ(context, broadcastReceiver, intentFilter, str, i) : ((i & 4) == 0 || str != null) ? context.registerReceiver(broadcastReceiver, intentFilter, str, null) : context.registerReceiver(broadcastReceiver, intentFilter, m11007(context), null);
        }
        ᵹˉᵞ.ˌᵜᵹᵩ("Cannot specify both RECEIVER_EXPORTED and RECEIVER_NOT_EXPORTED");
        return null;
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public static Object m11014(Context context, Class cls) {
        return context.getSystemService(cls);
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public static C4471 m11015(C1028 c1028) {
        C4704 c4704M6701 = AbstractC2692.m6701();
        AbstractC5447 abstractC5447Mo4466 = C3303.f12376.keySet().iterator();
        while (abstractC5447Mo4466.hasNext()) {
            Integer num = (Integer) abstractC5447Mo4466.next();
            int iIntValue = num.intValue();
            if (Build.VERSION.SDK_INT >= AbstractC3558.m8128(iIntValue) && AudioTrack.isDirectPlaybackSupported(new AudioFormat.Builder().setChannelMask(12).setEncoding(iIntValue).setSampleRate(48000).build(), c1028.m3392())) {
                c4704M6701.m3197(num);
            }
        }
        c4704M6701.m3197(2);
        return c4704M6701.m9892();
    }

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public static void m11016(View view, Matrix matrix) {
        view.transformMatrixToGlobal(matrix);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public static void m11017(View view, Rect rect, Rect rect2) {
        Insets systemWindowInsets = view.computeSystemWindowInsets(new WindowInsets.Builder().setSystemWindowInsets(Insets.of(rect)).build(), rect2).getSystemWindowInsets();
        rect.set(systemWindowInsets.left, systemWindowInsets.top, systemWindowInsets.right, systemWindowInsets.bottom);
    }

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public static void m11018(View view, int i, int i2, int i3, int i4) {
        view.setLeftTopRightBottom(i, i2, i3, i4);
    }

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public static void m11019(C1496 c1496) {
        c1496.setIsClippedToScreen(true);
    }
}
