what-the-bank/sources/com/google/android/gms/auth/GoogleAuthUtil.java

144 lines
6.8 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.gms.auth;
import android.accounts.Account;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.google.android.gms.common.GooglePlayServicesUtil;
import com.google.android.gms.common.internal.Preconditions;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.List;
/* loaded from: classes.dex */
public final class GoogleAuthUtil extends zzd {
public static final int CHANGE_TYPE_ACCOUNT_ADDED = 1;
public static final int CHANGE_TYPE_ACCOUNT_REMOVED = 2;
public static final int CHANGE_TYPE_ACCOUNT_RENAMED_FROM = 3;
public static final int CHANGE_TYPE_ACCOUNT_RENAMED_TO = 4;
public static final String GOOGLE_ACCOUNT_TYPE = "com.google";
public static final String KEY_SUPPRESS_PROGRESS_SCREEN = "suppressProgressScreen";
public static final String WORK_ACCOUNT_TYPE = "com.google.work";
private static final String KEY_CALLER_UID = zzd.KEY_CALLER_UID;
private static final String KEY_ANDROID_PACKAGE_NAME = zzd.KEY_ANDROID_PACKAGE_NAME;
@Deprecated
public static String getTokenWithNotification(Context context, String str, String str2, Bundle bundle) throws IOException, UserRecoverableNotifiedException, GoogleAuthException {
return getTokenWithNotification(context, new Account(str, "com.google"), str2, bundle);
}
@Deprecated
public static String getTokenWithNotification(Context context, String str, String str2, Bundle bundle, Intent intent) throws IOException, UserRecoverableNotifiedException, GoogleAuthException {
return getTokenWithNotification(context, new Account(str, "com.google"), str2, bundle, intent);
}
@Deprecated
public static String getTokenWithNotification(Context context, String str, String str2, Bundle bundle, String str3, Bundle bundle2) throws IOException, UserRecoverableNotifiedException, GoogleAuthException {
return getTokenWithNotification(context, new Account(str, "com.google"), str2, bundle, str3, bundle2);
}
public static String getTokenWithNotification(Context context, Account account, String str, Bundle bundle) throws IOException, UserRecoverableNotifiedException, GoogleAuthException {
if (bundle == null) {
bundle = new Bundle();
}
bundle.putBoolean("handle_notification", true);
return zza(context, account, str, bundle).zzb();
}
public static String getTokenWithNotification(Context context, Account account, String str, Bundle bundle, Intent intent) throws IOException, UserRecoverableNotifiedException, GoogleAuthException {
if (intent == null) {
throw new IllegalArgumentException("Callback cannot be null.");
}
try {
Intent.parseUri(intent.toUri(1), 1);
if (bundle == null) {
bundle = new Bundle();
}
bundle.putParcelable("callback_intent", intent);
bundle.putBoolean("handle_notification", true);
return zza(context, account, str, bundle).zzb();
} catch (URISyntaxException unused) {
throw new IllegalArgumentException("Parameter callback contains invalid data. It must be serializable using toUri() and parseUri().");
}
}
public static String getTokenWithNotification(Context context, Account account, String str, Bundle bundle, String str2, Bundle bundle2) throws IOException, UserRecoverableNotifiedException, GoogleAuthException {
Preconditions.checkNotEmpty(str2, "Authority cannot be empty or null.");
if (bundle == null) {
bundle = new Bundle();
}
if (bundle2 == null) {
bundle2 = new Bundle();
}
ContentResolver.validateSyncExtrasBundle(bundle2);
bundle.putString("authority", str2);
bundle.putBundle("sync_extras", bundle2);
bundle.putBoolean("handle_notification", true);
return zza(context, account, str, bundle).zzb();
}
private static TokenData zza(Context context, Account account, String str, Bundle bundle) throws IOException, GoogleAuthException {
if (bundle == null) {
bundle = new Bundle();
}
try {
TokenData zzb = zzd.zzb(context, account, str, bundle);
GooglePlayServicesUtil.cancelAvailabilityErrorNotifications(context);
return zzb;
} catch (GooglePlayServicesAvailabilityException e) {
GooglePlayServicesUtil.showErrorNotification(e.getConnectionStatusCode(), context);
throw new UserRecoverableNotifiedException("User intervention required. Notification has been pushed.");
} catch (UserRecoverableAuthException unused) {
GooglePlayServicesUtil.cancelAvailabilityErrorNotifications(context);
throw new UserRecoverableNotifiedException("User intervention required. Notification has been pushed.");
}
}
private GoogleAuthUtil() {
}
@Deprecated
public static String getToken(Context context, String str, String str2) throws IOException, UserRecoverableAuthException, GoogleAuthException {
return zzd.getToken(context, str, str2);
}
@Deprecated
public static String getToken(Context context, String str, String str2, Bundle bundle) throws IOException, UserRecoverableAuthException, GoogleAuthException {
return zzd.getToken(context, str, str2, bundle);
}
public static String getToken(Context context, Account account, String str) throws IOException, UserRecoverableAuthException, GoogleAuthException {
return zzd.getToken(context, account, str);
}
public static String getToken(Context context, Account account, String str, Bundle bundle) throws IOException, UserRecoverableAuthException, GoogleAuthException {
return zzd.getToken(context, account, str, bundle);
}
@Deprecated
public static void invalidateToken(Context context, String str) {
zzd.invalidateToken(context, str);
}
public static void clearToken(Context context, String str) throws GooglePlayServicesAvailabilityException, GoogleAuthException, IOException {
zzd.clearToken(context, str);
}
public static List<AccountChangeEvent> getAccountChangeEvents(Context context, int i, String str) throws GoogleAuthException, IOException {
return zzd.getAccountChangeEvents(context, i, str);
}
public static String getAccountId(Context context, String str) throws GoogleAuthException, IOException {
return zzd.getAccountId(context, str);
}
public static Bundle removeAccount(Context context, Account account) throws GoogleAuthException, IOException {
return zzd.removeAccount(context, account);
}
public static Boolean requestGoogleAccountsAccess(Context context) throws GoogleAuthException, IOException {
return zzd.requestGoogleAccountsAccess(context);
}
}