284 lines
11 KiB
Java
284 lines
11 KiB
Java
package com.google.android.gms.common.internal;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.ApplicationInfo;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.res.Resources;
|
|
import android.text.TextUtils;
|
|
import android.util.Base64;
|
|
import android.util.Log;
|
|
import com.google.android.gms.base.R;
|
|
import com.google.android.gms.common.GooglePlayServicesUtil;
|
|
import com.google.android.gms.common.util.DeviceProperties;
|
|
import com.google.android.gms.common.wrappers.Wrappers;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.Locale;
|
|
import o.DFj;
|
|
import o.bBI;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class zac {
|
|
private static int a = 1;
|
|
private static int d;
|
|
private static byte e;
|
|
private static final DFj<String, String> zaa;
|
|
private static Locale zab;
|
|
|
|
static {
|
|
a();
|
|
zaa = new DFj<>();
|
|
}
|
|
|
|
public static String zaa(Context context) {
|
|
String packageName = context.getPackageName();
|
|
try {
|
|
return Wrappers.packageManager(context).getApplicationLabel(packageName).toString();
|
|
} catch (PackageManager.NameNotFoundException | NullPointerException unused) {
|
|
String str = (String) ApplicationInfo.class.getField("name").get(context.getApplicationInfo());
|
|
return TextUtils.isEmpty(str) ? packageName : str;
|
|
}
|
|
}
|
|
|
|
public static String zab(Context context) {
|
|
return context.getResources().getString(R.string.common_google_play_services_notification_channel_name);
|
|
}
|
|
|
|
public static String zac(Context context, int i) {
|
|
Resources resources = context.getResources();
|
|
if (i == 1) {
|
|
return resources.getString(R.string.common_google_play_services_install_button);
|
|
}
|
|
if (i == 2) {
|
|
return resources.getString(R.string.common_google_play_services_update_button);
|
|
}
|
|
if (i == 3) {
|
|
return resources.getString(R.string.common_google_play_services_enable_button);
|
|
}
|
|
return resources.getString(android.R.string.ok);
|
|
}
|
|
|
|
public static String zad(Context context, int i) {
|
|
Resources resources = context.getResources();
|
|
String zaa2 = zaa(context);
|
|
if (i == 1) {
|
|
return resources.getString(R.string.common_google_play_services_install_text, zaa2);
|
|
}
|
|
if (i == 2) {
|
|
if (DeviceProperties.isWearableWithoutPlayStore(context)) {
|
|
return resources.getString(R.string.common_google_play_services_wear_update_text);
|
|
}
|
|
return resources.getString(R.string.common_google_play_services_update_text, zaa2);
|
|
}
|
|
if (i == 3) {
|
|
return resources.getString(R.string.common_google_play_services_enable_text, zaa2);
|
|
}
|
|
if (i == 5) {
|
|
return zah(context, "common_google_play_services_invalid_account_text", zaa2);
|
|
}
|
|
if (i == 7) {
|
|
return zah(context, "common_google_play_services_network_error_text", zaa2);
|
|
}
|
|
if (i == 9) {
|
|
return resources.getString(R.string.common_google_play_services_unsupported_text, zaa2);
|
|
}
|
|
if (i == 20) {
|
|
return zah(context, "common_google_play_services_restricted_profile_text", zaa2);
|
|
}
|
|
switch (i) {
|
|
case 16:
|
|
return zah(context, "common_google_play_services_api_unavailable_text", zaa2);
|
|
case 17:
|
|
return zah(context, "common_google_play_services_sign_in_failed_text", zaa2);
|
|
case 18:
|
|
return resources.getString(R.string.common_google_play_services_updating_text, zaa2);
|
|
default:
|
|
return resources.getString(com.google.android.gms.common.R.string.common_google_play_services_unknown_issue, zaa2);
|
|
}
|
|
}
|
|
|
|
public static String zag(Context context, int i) {
|
|
Resources resources = context.getResources();
|
|
switch (i) {
|
|
case 1:
|
|
return resources.getString(R.string.common_google_play_services_install_title);
|
|
case 2:
|
|
return resources.getString(R.string.common_google_play_services_update_title);
|
|
case 3:
|
|
return resources.getString(R.string.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 zai(context, "common_google_play_services_invalid_account_title");
|
|
case 7:
|
|
Log.e("GoogleApiAvailability", "Network error occurred. Please retry request later.");
|
|
return zai(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 zai(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 zai(context, "common_google_play_services_restricted_profile_title");
|
|
}
|
|
}
|
|
|
|
private static String zai(Context context, String str) {
|
|
DFj<String, String> dFj = zaa;
|
|
synchronized (dFj) {
|
|
Locale c = bBI.qs_(context.getResources().getConfiguration()).c(0);
|
|
if (!c.equals(zab)) {
|
|
dFj.clear();
|
|
zab = c;
|
|
}
|
|
String str2 = dFj.get(str);
|
|
if (str2 != null) {
|
|
return str2;
|
|
}
|
|
Resources remoteResource = GooglePlayServicesUtil.getRemoteResource(context);
|
|
if (remoteResource == null) {
|
|
return null;
|
|
}
|
|
int identifier = remoteResource.getIdentifier(str, "string", "com.google.android.gms");
|
|
if (identifier == 0) {
|
|
Log.w("GoogleApiAvailability", str.length() != 0 ? "Missing resource: ".concat(str) : new String("Missing resource: "));
|
|
return null;
|
|
}
|
|
String string = remoteResource.getString(identifier);
|
|
if (string.startsWith(",*,)")) {
|
|
Object[] objArr = new Object[1];
|
|
b(string.substring(4), objArr);
|
|
string = ((String) objArr[0]).intern();
|
|
}
|
|
if (TextUtils.isEmpty(string)) {
|
|
Log.w("GoogleApiAvailability", str.length() != 0 ? "Got empty resource: ".concat(str) : new String("Got empty resource: "));
|
|
return null;
|
|
}
|
|
dFj.put(str, string);
|
|
return string;
|
|
}
|
|
}
|
|
|
|
public static String zae(Context context, int i) {
|
|
if (i == 6 || i == 19) {
|
|
return zah(context, "common_google_play_services_resolution_required_text", zaa(context));
|
|
}
|
|
return zad(context, i);
|
|
}
|
|
|
|
public static String zaf(Context context, int i) {
|
|
String zag;
|
|
String string;
|
|
int i2 = 2 % 2;
|
|
int i3 = d + 107;
|
|
a = i3 % 128;
|
|
int i4 = i3 % 2;
|
|
if (i == 6) {
|
|
zag = zai(context, "common_google_play_services_resolution_required_title");
|
|
} else {
|
|
zag = zag(context, i);
|
|
int i5 = d + 97;
|
|
a = i5 % 128;
|
|
int i6 = i5 % 2;
|
|
}
|
|
if (zag != null) {
|
|
return zag;
|
|
}
|
|
int i7 = a + 97;
|
|
d = i7 % 128;
|
|
if (i7 % 2 != 0) {
|
|
string = context.getResources().getString(R.string.common_google_play_services_notification_ticker);
|
|
int i8 = 67 / 0;
|
|
if (!string.startsWith(",*,)")) {
|
|
return string;
|
|
}
|
|
} else {
|
|
string = context.getResources().getString(R.string.common_google_play_services_notification_ticker);
|
|
if (!string.startsWith(",*,)")) {
|
|
return string;
|
|
}
|
|
}
|
|
int i9 = d + 103;
|
|
a = i9 % 128;
|
|
int i10 = i9 % 2;
|
|
Object[] objArr = new Object[1];
|
|
b(string.substring(4), objArr);
|
|
return ((String) objArr[0]).intern();
|
|
}
|
|
|
|
private static String zah(Context context, String str, String str2) {
|
|
int i = 2 % 2;
|
|
int i2 = d + 31;
|
|
a = i2 % 128;
|
|
int i3 = i2 % 2;
|
|
Resources resources = context.getResources();
|
|
String zai = zai(context, str);
|
|
if (zai == null) {
|
|
int i4 = a + 73;
|
|
d = i4 % 128;
|
|
Object obj = null;
|
|
if (i4 % 2 != 0) {
|
|
resources.getString(com.google.android.gms.common.R.string.common_google_play_services_unknown_issue).startsWith(",*,)");
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
zai = resources.getString(com.google.android.gms.common.R.string.common_google_play_services_unknown_issue);
|
|
if (zai.startsWith(",*,)")) {
|
|
int i5 = a + 25;
|
|
d = i5 % 128;
|
|
if (i5 % 2 != 0) {
|
|
Object[] objArr = new Object[1];
|
|
b(zai.substring(4), objArr);
|
|
((String) objArr[0]).intern();
|
|
obj.hashCode();
|
|
throw null;
|
|
}
|
|
Object[] objArr2 = new Object[1];
|
|
b(zai.substring(4), objArr2);
|
|
zai = ((String) objArr2[0]).intern();
|
|
}
|
|
}
|
|
return String.format(resources.getConfiguration().locale, zai, str2);
|
|
}
|
|
|
|
private static void b(String str, Object[] objArr) {
|
|
byte[] decode = Base64.decode(str, 0);
|
|
byte[] bArr = new byte[decode.length];
|
|
for (int i = 0; i < decode.length; i++) {
|
|
bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ e);
|
|
}
|
|
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
|
|
}
|
|
|
|
static void a() {
|
|
e = (byte) 6;
|
|
}
|
|
}
|