package p138.p176.p177.p242.p246.p249;

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.text.TextUtils;
import android.util.Log;
import javax.annotation.concurrent.GuardedBy;
import p037.p057.C1729;
import p138.p176.p177.p242.p245.C4189;
import p138.p176.p177.p242.p246.C4197;
import p138.p176.p177.p242.p246.C4200;
import p138.p176.p177.p242.p246.p251.C4303;
import p138.p176.p177.p242.p246.p255.C4321;
import p138.p176.p177.p242.p246.p255.C4322;

/* JADX INFO: renamed from: ދ.ހ.֏.ހ.ހ.ފ.ށ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C4265 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    @GuardedBy("sCache")
    public static final C1729<String, String> f13533 = new C1729<>();

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static String m6947(Context context) {
        String packageName = context.getPackageName();
        try {
            C4321 c4321M7223 = C4322.m7223(context);
            return c4321M7223.f13621.getPackageManager().getApplicationLabel(c4321M7223.f13621.getPackageManager().getApplicationInfo(packageName, 0)).toString();
        } catch (PackageManager.NameNotFoundException | NullPointerException unused) {
            String str = context.getApplicationInfo().name;
            return TextUtils.isEmpty(str) ? packageName : str;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static String m6948(Context context, int i) {
        Resources resources = context.getResources();
        String strM6947 = m6947(context);
        if (i == 1) {
            return resources.getString(C4189.common_google_play_services_install_text, strM6947);
        }
        if (i == 2) {
            return C4303.m7170(context) ? resources.getString(C4189.common_google_play_services_wear_update_text) : resources.getString(C4189.common_google_play_services_update_text, strM6947);
        }
        if (i == 3) {
            return resources.getString(C4189.common_google_play_services_enable_text, strM6947);
        }
        if (i == 5) {
            return m6950(context, "common_google_play_services_invalid_account_text", strM6947);
        }
        if (i == 7) {
            return m6950(context, "common_google_play_services_network_error_text", strM6947);
        }
        if (i == 9) {
            return resources.getString(C4189.common_google_play_services_unsupported_text, strM6947);
        }
        if (i == 20) {
            return m6950(context, "common_google_play_services_restricted_profile_text", strM6947);
        }
        switch (i) {
            case 16:
                return m6950(context, "common_google_play_services_api_unavailable_text", strM6947);
            case 17:
                return m6950(context, "common_google_play_services_sign_in_failed_text", strM6947);
            case 18:
                return resources.getString(C4189.common_google_play_services_updating_text, strM6947);
            default:
                return resources.getString(C4200.common_google_play_services_unknown_issue, strM6947);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static String m6949(Context context, String str) {
        synchronized (f13533) {
            String orDefault = f13533.getOrDefault(str, null);
            if (orDefault != null) {
                return orDefault;
            }
            Resources resourcesM6849 = C4197.m6849(context);
            if (resourcesM6849 == null) {
                return null;
            }
            int identifier = resourcesM6849.getIdentifier(str, "string", "com.google.android.gms");
            if (identifier == 0) {
                String strValueOf = String.valueOf(str);
                Log.w("GoogleApiAvailability", strValueOf.length() != 0 ? "Missing resource: ".concat(strValueOf) : new String("Missing resource: "));
                return null;
            }
            String string = resourcesM6849.getString(identifier);
            if (!TextUtils.isEmpty(string)) {
                f13533.put(str, string);
                return string;
            }
            String strValueOf2 = String.valueOf(str);
            Log.w("GoogleApiAvailability", strValueOf2.length() != 0 ? "Got empty resource: ".concat(strValueOf2) : new String("Got empty resource: "));
            return null;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static String m6950(Context context, String str, String str2) {
        Resources resources = context.getResources();
        String strM6949 = m6949(context, str);
        if (strM6949 == null) {
            strM6949 = resources.getString(C4200.common_google_play_services_unknown_issue);
        }
        return String.format(resources.getConfiguration().locale, strM6949, str2);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static String m6951(Context context) {
        return context.getResources().getString(C4189.common_google_play_services_notification_channel_name);
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static String m6952(Context context, int i) {
        Resources resources = context.getResources();
        switch (i) {
            case 1:
                return resources.getString(C4189.common_google_play_services_install_title);
            case 2:
                return resources.getString(C4189.common_google_play_services_update_title);
            case 3:
                return resources.getString(C4189.common_google_play_services_enable_title);
            case 4:
            case 6:
            case 18:
                return null;
            case 5:
                Log.e("GoogleApiAvailability", "An invalid account was specified when connecting. Please provide a valid account.");
                return m6949(context, "common_google_play_services_invalid_account_title");
            case 7:
                Log.e("GoogleApiAvailability", "Network error occurred. Please retry request later.");
                return m6949(context, "common_google_play_services_network_error_title");
            case 8:
                Log.e("GoogleApiAvailability", "Internal error occurred. Please see logs for detailed information");
                return null;
            case 9:
                Log.e("GoogleApiAvailability", "Google Play services is invalid. Cannot recover.");
                return null;
            case 10:
                Log.e("GoogleApiAvailability", "Developer error occurred. Please see logs for detailed information");
                return null;
            case 11:
                Log.e("GoogleApiAvailability", "The application is not licensed to the user.");
                return null;
            case 12:
            case 13:
            case 14:
            case 15:
            case 19:
            default:
                StringBuilder sb = new StringBuilder(33);
                sb.append("Unexpected error code ");
                sb.append(i);
                Log.e("GoogleApiAvailability", sb.toString());
                return null;
            case 16:
                Log.e("GoogleApiAvailability", "One of the API components you attempted to connect to is not available.");
                return null;
            case 17:
                Log.e("GoogleApiAvailability", "The specified account could not be signed in.");
                return m6949(context, "common_google_play_services_sign_in_failed_title");
            case 20:
                Log.e("GoogleApiAvailability", "The current user profile is restricted and could not use authenticated features.");
                return m6949(context, "common_google_play_services_restricted_profile_title");
        }
    }
}
