Commit a59f2b51 authored by Boris Sazonov's avatar Boris Sazonov Committed by Commit Bot

Remove deprecated methods from AccountManagerHelper and AccountManagerDelegate

Follow-up to https://crrev.com/c/558346. This CL removes no longer used
AccountManagerDelegate.getAccountsByType and async overload of
AccountManagerHelper.getGoogleAccounts.

Bug: 698258
Change-Id: Ia3f62f12c6e5ea9374b9d89df69ad609ba1007de
Reviewed-on: https://chromium-review.googlesource.com/563387Reviewed-by: default avatarMihai Sardarescu <msarda@chromium.org>
Commit-Queue: Boris Sazonov <bsazonov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485249}
parent d61560a9
...@@ -33,14 +33,6 @@ public interface AccountManagerDelegate { ...@@ -33,14 +33,6 @@ public interface AccountManagerDelegate {
@MainThread @MainThread
void removeObserver(AccountsChangeObserver observer); void removeObserver(AccountsChangeObserver observer);
/**
* Get all the accounts for a given {@code type}.
* This is deprecated an will be removed soon.
*/
@Deprecated
@WorkerThread
Account[] getAccountsByType(String type);
/** /**
* Get all the accounts. * Get all the accounts.
* This method shouldn't be called on the UI thread (violated due to crbug.com/517697). * This method shouldn't be called on the UI thread (violated due to crbug.com/517697).
......
...@@ -247,15 +247,6 @@ public class AccountManagerHelper { ...@@ -247,15 +247,6 @@ public class AccountManagerHelper {
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} }
/**
* This method is deprecated and will be removed soon.
*/
// TODO(bsazonov) remove this method after fixing internal usages.
@MainThread
public void getGoogleAccounts(final Callback<Account[]> callback) {
tryGetGoogleAccounts(callback);
}
/** /**
* Determine whether there are any Google accounts on the device. * Determine whether there are any Google accounts on the device.
* Returns false if an error occurs while getting account list. * Returns false if an error occurs while getting account list.
......
...@@ -77,12 +77,12 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate { ...@@ -77,12 +77,12 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
} }
@Override @Override
public Account[] getAccountsByType(String type) { public Account[] getAccountsSync() throws AccountManagerDelegateException {
if (!hasGetAccountsPermission()) { if (!hasGetAccountsPermission()) {
return new Account[] {}; return new Account[] {};
} }
long now = SystemClock.elapsedRealtime(); long now = SystemClock.elapsedRealtime();
Account[] accounts = mAccountManager.getAccountsByType(type); Account[] accounts = mAccountManager.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
long elapsed = SystemClock.elapsedRealtime() - now; long elapsed = SystemClock.elapsedRealtime() - now;
recordElapsedTimeHistogram("Signin.AndroidGetAccountsTime_AccountManager", elapsed); recordElapsedTimeHistogram("Signin.AndroidGetAccountsTime_AccountManager", elapsed);
if (ThreadUtils.runningOnUiThread()) { if (ThreadUtils.runningOnUiThread()) {
...@@ -92,11 +92,6 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate { ...@@ -92,11 +92,6 @@ public class SystemAccountManagerDelegate implements AccountManagerDelegate {
return accounts; return accounts;
} }
@Override
public Account[] getAccountsSync() throws AccountManagerDelegateException {
return getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
}
@Override @Override
public String getAuthToken(Account account, String authTokenScope) throws AuthException { public String getAuthToken(Account account, String authTokenScope) throws AuthException {
assert !ThreadUtils.runningOnUiThread(); assert !ThreadUtils.runningOnUiThread();
......
...@@ -68,20 +68,6 @@ public class FakeAccountManagerDelegate implements AccountManagerDelegate { ...@@ -68,20 +68,6 @@ public class FakeAccountManagerDelegate implements AccountManagerDelegate {
mObservers.removeObserver(observer); mObservers.removeObserver(observer);
} }
@Override
public Account[] getAccountsByType(String type) {
if (!AccountManagerHelper.GOOGLE_ACCOUNT_TYPE.equals(type)) {
throw new IllegalArgumentException("Invalid account type: " + type);
}
ArrayList<Account> validAccounts = new ArrayList<>();
for (AccountHolder ah : mAccounts) {
if (type.equals(ah.getAccount().type)) {
validAccounts.add(ah.getAccount());
}
}
return validAccounts.toArray(new Account[0]);
}
@Override @Override
public Account[] getAccountsSync() throws AccountManagerDelegateException { public Account[] getAccountsSync() throws AccountManagerDelegateException {
return getAccountsSyncNoThrow(); return getAccountsSyncNoThrow();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment