package defpackage;

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.text.TextUtils;
import ar.tvplayer.tv.R;
import java.util.Locale;

/* renamed from: ˈˀᵱˌ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC1018 {

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static final C2771 f4476 = new C2771(0);

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static Locale f4477;

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public static String m3383(Context context, String str) {
        Resources resourcesForApplication;
        C2771 c2771 = f4476;
        synchronized (c2771) {
            try {
                Configuration configuration = context.getResources().getConfiguration();
                Locale locale = (Build.VERSION.SDK_INT >= 24 ? new C2358(new C5113(AbstractC2602.m6538(configuration))) : C2358.m6110(configuration.locale)).f9227.get(0);
                if (!locale.equals(f4477)) {
                    c2771.clear();
                    f4477 = locale;
                }
                String str2 = (String) c2771.get(str);
                if (str2 != null) {
                    return str2;
                }
                int i = AbstractC0388.f2245;
                try {
                    resourcesForApplication = context.getPackageManager().getResourcesForApplication("com.google.android.gms");
                } catch (PackageManager.NameNotFoundException unused) {
                    resourcesForApplication = null;
                }
                if (resourcesForApplication != null) {
                    int identifier = resourcesForApplication.getIdentifier(str, "string", "com.google.android.gms");
                    if (identifier != 0) {
                        String string = resourcesForApplication.getString(identifier);
                        if (!TextUtils.isEmpty(string)) {
                            f4476.put(str, string);
                            return string;
                        }
                    }
                }
                return null;
            } finally {
            }
        }
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public static String m3384(Context context, int i) {
        Resources resources = context.getResources();
        if (i == 1) {
            return resources.getString(R.string._11_res_0x7f13007c);
        }
        if (i == 2) {
            return resources.getString(R.string._11_res_0x7f130083);
        }
        if (i == 3) {
            return resources.getString(R.string._11_res_0x7f130079);
        }
        if (i == 5) {
            return m3383(context, "common_google_play_services_invalid_account_title");
        }
        if (i == 7) {
            return m3383(context, "common_google_play_services_network_error_title");
        }
        if (i == 17) {
            return m3383(context, "common_google_play_services_sign_in_failed_title");
        }
        if (i != 20) {
            return null;
        }
        return m3383(context, "common_google_play_services_restricted_profile_title");
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public static String m3385(Context context) {
        String packageName = context.getPackageName();
        try {
            Context context2 = C4004.m8846(context).f11588;
            return context2.getPackageManager().getApplicationLabel(context2.getPackageManager().getApplicationInfo(packageName, 0)).toString();
        } catch (PackageManager.NameNotFoundException | NullPointerException unused) {
            String str = context.getApplicationInfo().name;
            return TextUtils.isEmpty(str) ? packageName : str;
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public static String m3386(Context context, int i) {
        Resources resources = context.getResources();
        String strM3385 = m3385(context);
        if (i == 1) {
            return resources.getString(R.string._11_res_0x7f13007b, strM3385);
        }
        if (i == 2) {
            return ᵩʛʽ.ᵢˇᵭ(context) ? resources.getString(R.string._11_res_0x7f130085) : resources.getString(R.string._11_res_0x7f130082, strM3385);
        }
        if (i == 3) {
            return resources.getString(R.string._11_res_0x7f130078, strM3385);
        }
        if (i == 5) {
            return m3387(context, "common_google_play_services_invalid_account_text", strM3385);
        }
        if (i == 7) {
            return m3387(context, "common_google_play_services_network_error_text", strM3385);
        }
        if (i == 9) {
            return resources.getString(R.string._11_res_0x7f130080, strM3385);
        }
        if (i == 20) {
            return m3387(context, "common_google_play_services_restricted_profile_text", strM3385);
        }
        switch (i) {
            case 16:
                return m3387(context, "common_google_play_services_api_unavailable_text", strM3385);
            case 17:
                return m3387(context, "common_google_play_services_sign_in_failed_text", strM3385);
            case 18:
                return resources.getString(R.string._11_res_0x7f130084, strM3385);
            default:
                return resources.getString(R.string._11_res_0x7f13007f, strM3385);
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public static String m3387(Context context, String str, String str2) throws Resources.NotFoundException {
        Resources resources = context.getResources();
        String strM3383 = m3383(context, str);
        if (strM3383 == null) {
            strM3383 = resources.getString(R.string._11_res_0x7f13007f);
        }
        return String.format(resources.getConfiguration().locale, strM3383, str2);
    }
}
