package defpackage;

import android.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.FragmentManager;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.DialogInterface;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.util.TypedValue;
import com.google.android.gms.common.api.GoogleApiActivity;

/* renamed from: ᵶᵛʘᵻ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4815 extends C1029 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public static final Object f17869 = new Object();

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public static final C4815 f17870 = new C4815();

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static void m10137(Activity activity, AlertDialog alertDialog, String str, DialogInterface.OnCancelListener onCancelListener) {
        try {
            if (activity instanceof AbstractActivityC3177) {
                C3319 c3319M7536 = ((AbstractActivityC3177) activity).m7536();
                C5282 c5282 = new C5282();
                ᵩʛʽ.ᵶᵷᵕ(alertDialog, "Cannot display null dialog");
                alertDialog.setOnCancelListener(null);
                alertDialog.setOnDismissListener(null);
                c5282.f19769 = alertDialog;
                if (onCancelListener != null) {
                    c5282.f19767 = onCancelListener;
                }
                c5282.f18013 = false;
                c5282.f18018 = true;
                c3319M7536.getClass();
                C4877 c4877 = new C4877(c3319M7536);
                c4877.f18146 = true;
                c4877.m10299(0, c5282, str, 1);
                c4877.m10300();
                return;
            }
        } catch (NoClassDefFoundError unused) {
        }
        FragmentManager fragmentManager = activity.getFragmentManager();
        DialogFragmentC2214 dialogFragmentC2214 = new DialogFragmentC2214();
        ᵩʛʽ.ᵶᵷᵕ(alertDialog, "Cannot display null dialog");
        alertDialog.setOnCancelListener(null);
        alertDialog.setOnDismissListener(null);
        dialogFragmentC2214.f8707 = alertDialog;
        if (onCancelListener != null) {
            dialogFragmentC2214.f8706 = onCancelListener;
        }
        dialogFragmentC2214.show(fragmentManager, str);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public static AlertDialog m10138(Activity activity, int i, AbstractDialogInterfaceOnClickListenerC3179 abstractDialogInterfaceOnClickListenerC3179, DialogInterface.OnCancelListener onCancelListener) {
        if (i == 0) {
            return null;
        }
        TypedValue typedValue = new TypedValue();
        activity.getTheme().resolveAttribute(R.attr.alertDialogTheme, typedValue, true);
        AlertDialog.Builder builder = "Theme.Dialog.Alert".equals(activity.getResources().getResourceEntryName(typedValue.resourceId)) ? new AlertDialog.Builder(activity, 5) : null;
        if (builder == null) {
            builder = new AlertDialog.Builder(activity);
        }
        builder.setMessage(AbstractC1018.m3386(activity, i));
        if (onCancelListener != null) {
            builder.setOnCancelListener(onCancelListener);
        }
        Resources resources = activity.getResources();
        String string = i != 1 ? i != 2 ? i != 3 ? resources.getString(R.string.ok) : resources.getString(ar.tvplayer.tv.R.string._11_res_0x7f130077) : resources.getString(ar.tvplayer.tv.R.string._11_res_0x7f130081) : resources.getString(ar.tvplayer.tv.R.string._11_res_0x7f13007a);
        if (string != null) {
            builder.setPositiveButton(string, abstractDialogInterfaceOnClickListenerC3179);
        }
        String strM3384 = AbstractC1018.m3384(activity, i);
        if (strM3384 != null) {
            builder.setTitle(strM3384);
        }
        new IllegalArgumentException();
        return builder.create();
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void m10139(Activity activity, InterfaceC1123 interfaceC1123, int i, DialogInterface.OnCancelListener onCancelListener) {
        AlertDialog alertDialogM10138 = m10138(activity, i, new C1526(super.m3393(i, activity, "d"), interfaceC1123), onCancelListener);
        if (alertDialogM10138 == null) {
            return;
        }
        m10137(activity, alertDialogM10138, "GooglePlayServicesErrorDialog", onCancelListener);
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final void m10140(Context context, int i, PendingIntent pendingIntent) throws Resources.NotFoundException {
        int i2;
        new IllegalArgumentException();
        if (i == 18) {
            new HandlerC4868(this, context).sendEmptyMessageDelayed(1, 120000L);
            return;
        }
        if (pendingIntent == null) {
            return;
        }
        String strM3383 = i == 6 ? AbstractC1018.m3383(context, "common_google_play_services_resolution_required_title") : AbstractC1018.m3384(context, i);
        if (strM3383 == null) {
            strM3383 = context.getResources().getString(ar.tvplayer.tv.R.string._11_res_0x7f13007e);
        }
        String strM3387 = (i == 6 || i == 19) ? AbstractC1018.m3387(context, "common_google_play_services_resolution_required_text", AbstractC1018.m3385(context)) : AbstractC1018.m3386(context, i);
        Resources resources = context.getResources();
        Object systemService = context.getSystemService("notification");
        ᵩʛʽ.ᵝᵵᵺ(systemService);
        NotificationManager notificationManager = (NotificationManager) systemService;
        C2142 c2142 = new C2142(context, null);
        c2142.f8448 = true;
        c2142.f8445.flags |= 16;
        c2142.f8435 = C2142.m5762(strM3383);
        C5553 c5553 = new C5553(8, false);
        c5553.f20835 = C2142.m5762(strM3387);
        c2142.m5763(c5553);
        PackageManager packageManager = context.getPackageManager();
        if (ᵩʛʽ.ˌᵜᵹᵩ == null) {
            ᵩʛʽ.ˌᵜᵹᵩ = Boolean.valueOf(packageManager.hasSystemFeature("android.hardware.type.watch"));
        }
        if (ᵩʛʽ.ˌᵜᵹᵩ.booleanValue()) {
            c2142.f8445.icon = context.getApplicationInfo().icon;
            c2142.f8449 = 2;
            if (ᵩʛʽ.ᵢˇᵭ(context)) {
                c2142.f8446.add(new C4020(resources.getString(ar.tvplayer.tv.R.string._11_res_0x7f130086), pendingIntent));
            } else {
                c2142.f8438 = pendingIntent;
            }
        } else {
            c2142.f8445.icon = R.drawable.stat_sys_warning;
            c2142.f8445.tickerText = C2142.m5762(resources.getString(ar.tvplayer.tv.R.string._11_res_0x7f13007e));
            c2142.f8445.when = System.currentTimeMillis();
            c2142.f8438 = pendingIntent;
            c2142.f8439 = C2142.m5762(strM3387);
        }
        if (ᵮʛˀ.ᵪʩ()) {
            if (!ᵮʛˀ.ᵪʩ()) {
                ᵨᴵᵺ.ˌʾˀ();
                return;
            }
            synchronized (f17869) {
            }
            NotificationChannel notificationChannel = notificationManager.getNotificationChannel("com.google.android.gms.availability");
            String string = context.getResources().getString(ar.tvplayer.tv.R.string._11_res_0x7f13007d);
            if (notificationChannel == null) {
                notificationManager.createNotificationChannel(new NotificationChannel("com.google.android.gms.availability", string, 4));
            } else if (!string.contentEquals(notificationChannel.getName())) {
                notificationChannel.setName(string);
                notificationManager.createNotificationChannel(notificationChannel);
            }
            c2142.f8444 = "com.google.android.gms.availability";
        }
        Notification notificationM5764 = c2142.m5764();
        if (i == 1 || i == 2 || i == 3) {
            AbstractC0388.f2247.set(false);
            i2 = 10436;
        } else {
            i2 = 39789;
        }
        notificationManager.notify(i2, notificationM5764);
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void m10141(GoogleApiActivity googleApiActivity, int i, GoogleApiActivity googleApiActivity2) {
        AlertDialog alertDialogM10138 = m10138(googleApiActivity, i, new C2593(super.m3393(i, googleApiActivity, "d"), googleApiActivity), googleApiActivity2);
        if (alertDialogM10138 == null) {
            return;
        }
        m10137(googleApiActivity, alertDialogM10138, "GooglePlayServicesErrorDialog", googleApiActivity2);
    }
}
