com.google.android.gms.common.internal.zzt.java Source code

Java tutorial

Introduction

Here is the source code for com.google.android.gms.common.internal.zzt.java

Source

package com.google.android.gms.common.internal;

import android.support.v4.util.*;
import android.content.*;
import com.google.android.gms.internal.*;
import android.content.pm.*;
import android.util.*;
import com.google.android.gms.*;
import android.content.res.*;
import com.google.android.gms.common.*;
import android.text.*;
import android.support.annotation.*;
import com.google.android.gms.common.util.*;

public final class zzt {
    private static final SimpleArrayMap<String, String> a;

    static {
        a = new SimpleArrayMap<String, String>();
    }

private static String a(Context string) {
    final String packageName = ((Context)string).getPackageName();
    try {
        string = zzbed.a((Context)string).b(packageName).toString();
        return (String)string;
    }
    catch (NullPointerException ex) {}
    catch (PackageManager$NameNotFoundException ex2) {
        goto Label_0024;
    }
}

    @Nullable
    public static String a(final Context context, final int n) {
        final String s = null;
        final Resources resources = context.getResources();
        String s2 = s;
        switch (n) {
        default: {
            Log.e("GoogleApiAvailability",
                    new StringBuilder(33).append("Unexpected error code ").append(n).toString());
            s2 = s;
            return s2;
        }
        case 20: {
            Log.e("GoogleApiAvailability",
                    "The current user profile is restricted and could not use authenticated features.");
            s2 = a(context, "common_google_play_services_restricted_profile_title");
            return s2;
        }
        case 17: {
            Log.e("GoogleApiAvailability", "The specified account could not be signed in.");
            s2 = a(context, "common_google_play_services_sign_in_failed_title");
            return s2;
        }
        case 16: {
            Log.e("GoogleApiAvailability",
                    "One of the API components you attempted to connect to is not available.");
            s2 = s;
            return s2;
        }
        case 11: {
            Log.e("GoogleApiAvailability", "The application is not licensed to the user.");
            s2 = s;
            return s2;
        }
        case 5: {
            Log.e("GoogleApiAvailability",
                    "An invalid account was specified when connecting. Please provide a valid account.");
            s2 = a(context, "common_google_play_services_invalid_account_title");
            return s2;
        }
        case 10: {
            Log.e("GoogleApiAvailability", "Developer error occurred. Please see logs for detailed information");
            s2 = s;
            return s2;
        }
        case 8: {
            Log.e("GoogleApiAvailability", "Internal error occurred. Please see logs for detailed information");
            s2 = s;
            return s2;
        }
        case 7: {
            Log.e("GoogleApiAvailability", "Network error occurred. Please retry request later.");
            s2 = a(context, "common_google_play_services_network_error_title");
            return s2;
        }
        case 9: {
            Log.e("GoogleApiAvailability", "Google Play services is invalid. Cannot recover.");
            s2 = s;
            return s2;
        }
        case 2: {
            s2 = resources.getString(R$string.common_google_play_services_update_title);
            return s2;
        }
        case 3: {
            s2 = resources.getString(R$string.common_google_play_services_enable_title);
            return s2;
        }
        case 1: {
            s2 = resources.getString(R$string.common_google_play_services_install_title);
        }
        case 4:
        case 6:
        case 18: {
            return s2;
        }
        }
    }

    @Nullable
    private static String a(final Context context, final String s) {
        while (true) {
            final int identifier;
            Label_0114: {
                synchronized (zzt.a) {
                    final String s2 = zzt.a.get(s);
                    String string;
                    if (s2 != null) {
                        // monitorexit(zzt.a)
                        string = s2;
                    } else {
                        final Resources remoteResource = GooglePlayServicesUtil.getRemoteResource(context);
                        if (remoteResource == null) {
                            // monitorexit(zzt.a)
                            string = null;
                        } else {
                            identifier = remoteResource.getIdentifier(s, "string", "com.google.android.gms");
                            if (identifier != 0) {
                                break Label_0114;
                            }
                            final String value = String.valueOf(s);
                            String concat;
                            if (value.length() != 0) {
                                concat = "Missing resource: ".concat(value);
                            } else {
                                concat = new String("Missing resource: ");
                            }
                            Log.w("GoogleApiAvailability", concat);
                            // monitorexit(zzt.a)
                            string = null;
                        }
                    }
                    return string;
                }
            }
            final Resources resources;
            String string = resources.getString(identifier);
            if (TextUtils.isEmpty((CharSequence) string)) {
                final String value2 = String.valueOf(s);
                String concat2;
                if (value2.length() != 0) {
                    concat2 = "Got empty resource: ".concat(value2);
                } else {
                    concat2 = new String("Got empty resource: ");
                }
                Log.w("GoogleApiAvailability", concat2);
                // monitorexit(simpleArrayMap)
                string = null;
                return string;
            }
            zzt.a.put(s, string);
            // monitorexit(simpleArrayMap)
            return string;
        }
    }

    private static String a(final Context context, String s, final String s2) {
        final Resources resources = context.getResources();
        String s3;
        s = (s3 = a(context, s));
        if (s == null) {
            s3 = resources.getString(R$string.common_google_play_services_unknown_issue);
        }
        return String.format(resources.getConfiguration().locale, s3, s2);
    }

    @NonNull
    public static String b(final Context context, final int n) {
        String s;
        if (n == 6) {
            s = a(context, "common_google_play_services_resolution_required_title");
        } else {
            s = a(context, n);
        }
        String string = s;
        if (s == null) {
            string = context.getResources().getString(R$string.common_google_play_services_notification_ticker);
        }
        return string;
    }

    @NonNull
    public static String c(final Context context, final int n) {
        final Resources resources = context.getResources();
        final String a = a(context);
        String s = null;
        switch (n) {
        default: {
            s = resources.getString(R$string.common_google_play_services_unknown_issue, new Object[] { a });
            break;
        }
        case 1: {
            s = resources.getString(R$string.common_google_play_services_install_text, new Object[] { a });
            break;
        }
        case 3: {
            s = resources.getString(R$string.common_google_play_services_enable_text, new Object[] { a });
            break;
        }
        case 18: {
            s = resources.getString(R$string.common_google_play_services_updating_text, new Object[] { a });
            break;
        }
        case 2: {
            if (zzi.b(context)) {
                s = resources.getString(R$string.common_google_play_services_wear_update_text);
                break;
            }
            s = resources.getString(R$string.common_google_play_services_update_text, new Object[] { a });
            break;
        }
        case 9: {
            s = resources.getString(R$string.common_google_play_services_unsupported_text, new Object[] { a });
            break;
        }
        case 7: {
            s = a(context, "common_google_play_services_network_error_text", a);
            break;
        }
        case 5: {
            s = a(context, "common_google_play_services_invalid_account_text", a);
            break;
        }
        case 16: {
            s = a(context, "common_google_play_services_api_unavailable_text", a);
            break;
        }
        case 17: {
            s = a(context, "common_google_play_services_sign_in_failed_text", a);
            break;
        }
        case 20: {
            s = a(context, "common_google_play_services_restricted_profile_text", a);
            break;
        }
        }
        return s;
    }

    @NonNull
    public static String d(final Context context, final int n) {
        String s;
        if (n == 6) {
            s = a(context, "common_google_play_services_resolution_required_text", a(context));
        } else {
            s = c(context, n);
        }
        return s;
    }

    @NonNull
    public static String e(final Context context, final int n) {
        final Resources resources = context.getResources();
        String s = null;
        switch (n) {
        default: {
            s = resources.getString(17039370);
            break;
        }
        case 1: {
            s = resources.getString(R$string.common_google_play_services_install_button);
            break;
        }
        case 3: {
            s = resources.getString(R$string.common_google_play_services_enable_button);
            break;
        }
        case 2: {
            s = resources.getString(R$string.common_google_play_services_update_button);
            break;
        }
        }
        return s;
    }
}