162 lines
7.6 KiB
Diff
162 lines
7.6 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 +-------
|
|
.../components/signin/AccountIdProvider.java | 9 +---
|
|
.../signin/SystemAccountManagerDelegate.java | 50 ++-----------------
|
|
3 files changed, 5 insertions(+), 76 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
|
|
@@ -11,10 +11,6 @@ import android.content.Context;
|
|
import androidx.annotation.Nullable;
|
|
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.ContextUtils;
|
|
import org.chromium.base.Log;
|
|
import org.chromium.base.task.AsyncTask;
|
|
@@ -60,23 +56,7 @@ public class SigninHelper {
|
|
@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/AccountIdProvider.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountIdProvider.java
|
|
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountIdProvider.java
|
|
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/AccountIdProvider.java
|
|
@@ -6,8 +6,6 @@ package org.chromium.components.signin;
|
|
|
|
import androidx.annotation.VisibleForTesting;
|
|
|
|
-import com.google.android.gms.auth.GoogleAuthException;
|
|
-import com.google.android.gms.auth.GoogleAuthUtil;
|
|
import com.google.android.gms.common.ConnectionResult;
|
|
import com.google.android.gms.common.GoogleApiAvailability;
|
|
|
|
@@ -41,12 +39,7 @@ public class AccountIdProvider {
|
|
* @param accountName The email address of a Google account.
|
|
*/
|
|
public String getAccountId(String accountName) {
|
|
- try {
|
|
- return GoogleAuthUtil.getAccountId(ContextUtils.getApplicationContext(), accountName);
|
|
- } catch (IOException | GoogleAuthException ex) {
|
|
- Log.e("cr.AccountIdProvider", "AccountIdProvider.getAccountId", ex);
|
|
- return null;
|
|
- }
|
|
+ return null;
|
|
}
|
|
|
|
/**
|
|
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
|
|
@@ -24,9 +24,6 @@ import android.os.PatternMatcher;
|
|
import android.os.Process;
|
|
import android.os.SystemClock;
|
|
|
|
-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;
|
|
|
|
@@ -116,48 +113,18 @@ 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
|
|
public String getAuthToken(Account account, String authTokenScope) throws AuthException {
|
|
assert !ThreadUtils.runningOnUiThread();
|
|
assert AccountManagerFacade.GOOGLE_ACCOUNT_TYPE.equals(account.type);
|
|
- try {
|
|
- return 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);
|
|
- }
|
|
+ return null;
|
|
}
|
|
|
|
@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);
|
|
- }
|
|
+ public void invalidateAuthToken(String authToken) {
|
|
}
|
|
|
|
@Override
|
|
@@ -187,17 +154,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
|
|
--
|
|
2.17.1
|
|
|