149 lines
6.9 KiB
Diff
149 lines
6.9 KiB
Diff
From: thermatk <thermatk@thermatk.com>
|
|
Date: Fri, 22 Jun 2018 17:06:15 +0200
|
|
Subject: kill Auth
|
|
|
|
---
|
|
.../chrome/browser/signin/SigninHelper.java | 22 +-------
|
|
.../signin/SystemAccountManagerDelegate.java | 56 ++-----------------
|
|
2 files changed, 5 insertions(+), 73 deletions(-)
|
|
|
|
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java
|
|
--- a/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java
|
|
+++ b/chrome/android/java/src/org/chromium/chrome/browser/signin/SigninHelper.java
|
|
@@ -10,10 +10,6 @@ import android.content.Context;
|
|
|
|
import androidx.annotation.VisibleForTesting;
|
|
|
|
-import com.google.android.gms.auth.AccountChangeEvent;
|
|
-import com.google.android.gms.auth.GoogleAuthException;
|
|
-import com.google.android.gms.auth.GoogleAuthUtil;
|
|
-
|
|
import org.chromium.base.ApplicationState;
|
|
import org.chromium.base.ApplicationStatus;
|
|
import org.chromium.base.ContextUtils;
|
|
@@ -64,23 +60,7 @@ public class SigninHelper implements ApplicationStatus.ApplicationStateListener
|
|
@Override
|
|
public List<String> getAccountChangeEvents(
|
|
Context context, int index, String accountName) {
|
|
- try {
|
|
- List<AccountChangeEvent> list = GoogleAuthUtil.getAccountChangeEvents(
|
|
- context, index, accountName);
|
|
- List<String> result = new ArrayList<>(list.size());
|
|
- for (AccountChangeEvent e : list) {
|
|
- if (e.getChangeType() == GoogleAuthUtil.CHANGE_TYPE_ACCOUNT_RENAMED_TO) {
|
|
- result.add(e.getChangeData());
|
|
- } else {
|
|
- result.add(null);
|
|
- }
|
|
- }
|
|
- return result;
|
|
- } catch (IOException e) {
|
|
- Log.w(TAG, "Failed to get change events", e);
|
|
- } catch (GoogleAuthException e) {
|
|
- Log.w(TAG, "Failed to get change events", e);
|
|
- }
|
|
+
|
|
return new ArrayList<>(0);
|
|
}
|
|
}
|
|
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
|
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
|
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/SystemAccountManagerDelegate.java
|
|
@@ -26,9 +26,6 @@ import android.os.SystemClock;
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
-import com.google.android.gms.auth.GoogleAuthException;
|
|
-import com.google.android.gms.auth.GoogleAuthUtil;
|
|
-import com.google.android.gms.auth.GooglePlayServicesAvailabilityException;
|
|
import com.google.android.gms.common.ConnectionResult;
|
|
import com.google.android.gms.common.GoogleApiAvailability;
|
|
|
|
@@ -120,18 +117,7 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
|
// so don't report any accounts if Google Play Services are out of date.
|
|
checkCanUseGooglePlayServices();
|
|
|
|
- if (!hasGetAccountsPermission()) {
|
|
- return new Account[] {};
|
|
- }
|
|
- long now = SystemClock.elapsedRealtime();
|
|
- Account[] accounts = mAccountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
|
|
- long elapsed = SystemClock.elapsedRealtime() - now;
|
|
- recordElapsedTimeHistogram("Signin.AndroidGetAccountsTime_AccountManager", elapsed);
|
|
- if (ThreadUtils.runningOnUiThread()) {
|
|
- recordElapsedTimeHistogram(
|
|
- "Signin.AndroidGetAccountsTimeUiThread_AccountManager", elapsed);
|
|
- }
|
|
- return accounts;
|
|
+ return new Account[] {};
|
|
}
|
|
|
|
@Override
|
|
@@ -139,30 +125,12 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
|
|
throws AuthException {
|
|
assert !ThreadUtils.runningOnUiThread();
|
|
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 (GooglePlayServicesAvailabilityException ex) {
|
|
- throw new AuthException(AuthException.NONTRANSIENT, ex);
|
|
- } catch (GoogleAuthException ex) {
|
|
- throw new AuthException(AuthException.NONTRANSIENT, ex);
|
|
- } catch (IOException ex) {
|
|
- throw new AuthException(AuthException.TRANSIENT, ex);
|
|
- }
|
|
}
|
|
|
|
@Override
|
|
@@ -192,17 +160,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
|
|
@@ -220,12 +177,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
|
|
--
|
|
2.17.1
|
|
|