116 lines
5.3 KiB
Diff
116 lines
5.3 KiB
Diff
From: thermatk <thermatk@thermatk.com>
|
|
Date: Fri, 22 Jun 2018 17:06:15 +0200
|
|
Subject: kill Auth
|
|
|
|
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
|
---
|
|
.../signin/SystemAccountManagerDelegate.java | 63 +------------------
|
|
1 file changed, 3 insertions(+), 60 deletions(-)
|
|
|
|
diff --git a/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java b/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
|
--- a/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
|
+++ b/components/signin/public/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
|
@@ -24,9 +24,6 @@ import android.os.SystemClock;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
-import com.google.android.gms.auth.GoogleAuthException;
|
|
-import com.google.android.gms.auth.GoogleAuthUtil;
|
|
-
|
|
import org.chromium.base.ApiCompatibilityUtils;
|
|
import org.chromium.base.Callback;
|
|
import org.chromium.base.ContextUtils;
|
|
@@ -87,18 +84,6 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
|
|
|
@Override
|
|
public Account[] getAccountsSynchronous() throws AccountManagerDelegateException {
|
|
- if (!isGooglePlayServicesAvailable()) {
|
|
- throw new AccountManagerDelegateException("Can't use Google Play Services");
|
|
- }
|
|
- if (hasGetAccountsPermission()) {
|
|
- long startTime = SystemClock.elapsedRealtime();
|
|
- Account[] accounts =
|
|
- mAccountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
|
|
- RecordHistogram.recordTimesHistogram(
|
|
- "Signin.AndroidGetAccountsTime_AccountManager",
|
|
- SystemClock.elapsedRealtime() - startTime);
|
|
- return accounts;
|
|
- }
|
|
// Don't report any accounts if we don't have permission.
|
|
// TODO(crbug.com/40942462): Throw an exception if permission was denied.
|
|
return new Account[] {};
|
|
@@ -109,31 +94,12 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
|
throws AuthException {
|
|
ThreadUtils.assertOnBackgroundThread();
|
|
assert AccountUtils.GOOGLE_ACCOUNT_TYPE.equals(account.type);
|
|
- try {
|
|
- return new AccessTokenData(
|
|
- GoogleAuthUtil.getTokenWithNotification(
|
|
- ContextUtils.getApplicationContext(), account, authTokenScope, null));
|
|
- } catch (GoogleAuthException ex) {
|
|
- // This case includes a UserRecoverableNotifiedException, but most clients will have
|
|
- // their own retry mechanism anyway.
|
|
- throw new AuthException(
|
|
- AuthException.NONTRANSIENT,
|
|
- "Error while getting token for scope '" + authTokenScope + "'",
|
|
- ex);
|
|
- } catch (IOException ex) {
|
|
- throw new AuthException(AuthException.TRANSIENT, ex);
|
|
- }
|
|
+ throw new AuthException(AuthException.NONTRANSIENT,
|
|
+ "Error while getting token for scope '" + authTokenScope + "'");
|
|
}
|
|
|
|
@Override
|
|
public void invalidateAuthToken(String authToken) throws AuthException {
|
|
- try {
|
|
- GoogleAuthUtil.clearToken(ContextUtils.getApplicationContext(), authToken);
|
|
- } catch (GoogleAuthException ex) {
|
|
- throw new AuthException(AuthException.NONTRANSIENT, ex);
|
|
- } catch (IOException ex) {
|
|
- throw new AuthException(AuthException.TRANSIENT, ex);
|
|
- }
|
|
}
|
|
|
|
protected boolean hasFeatures(Account account, String[] features) {
|
|
@@ -165,24 +131,6 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
|
@SuppressLint("MissingPermission")
|
|
@Override
|
|
public void createAddAccountIntent(Callback<Intent> callback) {
|
|
- AccountManagerCallback<Bundle> accountManagerCallback =
|
|
- accountManagerFuture -> {
|
|
- try {
|
|
- Bundle bundle = accountManagerFuture.getResult();
|
|
- callback.onResult(bundle.getParcelable(AccountManager.KEY_INTENT));
|
|
- } catch (OperationCanceledException | IOException | AuthenticatorException e) {
|
|
- Log.e(TAG, "Error while creating an intent to add an account: ", e);
|
|
- callback.onResult(null);
|
|
- }
|
|
- };
|
|
- mAccountManager.addAccount(
|
|
- GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE,
|
|
- null,
|
|
- null,
|
|
- null,
|
|
- null,
|
|
- accountManagerCallback,
|
|
- null);
|
|
}
|
|
|
|
// No permission is needed on 23+ and Chrome always has MANAGE_ACCOUNTS permission on lower APIs
|
|
@@ -217,12 +165,7 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
|
@Nullable
|
|
@Override
|
|
public String getAccountGaiaId(String accountEmail) {
|
|
- try {
|
|
- return GoogleAuthUtil.getAccountId(ContextUtils.getApplicationContext(), accountEmail);
|
|
- } catch (IOException | GoogleAuthException ex) {
|
|
- Log.e(TAG, "SystemAccountManagerDelegate.getAccountGaiaId", ex);
|
|
- return null;
|
|
- }
|
|
+ return null;
|
|
}
|
|
|
|
@Override
|
|
--
|