Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ae64092 authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Update Account Manager to use latest version of account discovery API.

Bug: 33046496
Test: cts tests, manual tests.
Change-Id: I2791f4f7bab2665a928264da5ccf6a3ab975cea6
parent 896619a7
Loading
Loading
Loading
Loading
+14 −6
Original line number Diff line number Diff line
@@ -2874,15 +2874,18 @@ package android.accounts {
  public class AccountManager {
    method public android.accounts.AccountManagerFuture<android.os.Bundle> addAccount(java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle, int[]);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle, java.util.Map<java.lang.Integer, java.lang.Integer>);
    method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean);
    method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean, java.lang.String[]);
    method public java.lang.String blockingGetAuthToken(android.accounts.Account, java.lang.String, boolean) throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException;
    method public void clearPassword(android.accounts.Account);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> editProperties(java.lang.String, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public static android.accounts.AccountManager get(android.content.Context);
    method public int getAccountVisibility(android.accounts.Account, int);
    method public android.accounts.Account[] getAccounts();
    method public java.util.Map<android.accounts.Account, java.lang.Integer> getAccountsAndVisibilityForPackage(java.lang.String, java.lang.String);
    method public android.accounts.Account[] getAccountsByType(java.lang.String);
    method public android.accounts.AccountManagerFuture<android.accounts.Account[]> getAccountsByTypeAndFeatures(java.lang.String, java.lang.String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler);
    method public android.accounts.Account[] getAccountsByTypeForPackage(java.lang.String, java.lang.String);
@@ -2893,13 +2896,11 @@ package android.accounts {
    method public android.accounts.AuthenticatorDescription[] getAuthenticatorTypes();
    method public java.lang.String getPassword(android.accounts.Account);
    method public java.lang.String getPreviousName(android.accounts.Account);
    method public int[] getRequestingUidsForType(java.lang.String);
    method public java.util.Map<java.lang.Integer, java.lang.Integer> getUidsAndVisibilityForAccount(android.accounts.Account);
    method public java.lang.String getUserData(android.accounts.Account, java.lang.String);
    method public android.accounts.AccountManagerFuture<java.lang.Boolean> hasFeatures(android.accounts.Account, java.lang.String[], android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public void invalidateAuthToken(java.lang.String, java.lang.String);
    method public boolean isAccountVisible(android.accounts.Account, int);
    method public android.accounts.AccountManagerFuture<java.lang.Boolean> isCredentialsUpdateSuggested(android.accounts.Account, java.lang.String, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public boolean makeAccountVisible(android.accounts.Account, int);
    method public static deprecated android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.ArrayList<android.accounts.Account>, java.lang.String[], boolean, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle);
    method public static android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.List<android.accounts.Account>, java.lang.String[], java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle);
    method public boolean notifyAccountAuthenticated(android.accounts.Account);
@@ -2907,9 +2908,9 @@ package android.accounts {
    method public deprecated android.accounts.AccountManagerFuture<java.lang.Boolean> removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> removeAccount(android.accounts.Account, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public boolean removeAccountExplicitly(android.accounts.Account);
    method public boolean removeAccountVisibility(android.accounts.Account, int);
    method public void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener);
    method public android.accounts.AccountManagerFuture<android.accounts.Account> renameAccount(android.accounts.Account, java.lang.String, android.accounts.AccountManagerCallback<android.accounts.Account>, android.os.Handler);
    method public boolean setAccountVisibility(android.accounts.Account, int, int);
    method public void setAuthToken(android.accounts.Account, java.lang.String, java.lang.String);
    method public void setPassword(android.accounts.Account, java.lang.String);
    method public void setUserData(android.accounts.Account, java.lang.String, java.lang.String);
@@ -2948,7 +2949,14 @@ package android.accounts {
    field public static final java.lang.String KEY_LAST_AUTHENTICATED_TIME = "lastAuthenticatedTime";
    field public static final java.lang.String KEY_PASSWORD = "password";
    field public static final java.lang.String KEY_USERDATA = "userdata";
    field public static final java.lang.String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED";
    field public static final deprecated java.lang.String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED";
    field public static final int UID_KEY_DEFAULT_LEGACY_VISIBILITY = -3; // 0xfffffffd
    field public static final int UID_KEY_DEFAULT_VISIBILITY = -2; // 0xfffffffe
    field public static final int VISIBILITY_NOT_VISIBLE = 3; // 0x3
    field public static final int VISIBILITY_UNDEFINED = 0; // 0x0
    field public static final int VISIBILITY_USER_MANAGED_NOT_VISIBLE = 4; // 0x4
    field public static final int VISIBILITY_USER_MANAGED_VISIBLE = 2; // 0x2
    field public static final int VISIBILITY_VISIBLE = 1; // 0x1
  }
  public abstract interface AccountManagerCallback<V> {
+14 −6
Original line number Diff line number Diff line
@@ -2990,8 +2990,9 @@ package android.accounts {
  public class AccountManager {
    method public android.accounts.AccountManagerFuture<android.os.Bundle> addAccount(java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle, int[]);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle, java.util.Map<java.lang.Integer, java.lang.Integer>);
    method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean);
    method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean, java.lang.String[]);
    method public java.lang.String blockingGetAuthToken(android.accounts.Account, java.lang.String, boolean) throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException;
    method public void clearPassword(android.accounts.Account);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
@@ -2999,7 +3000,9 @@ package android.accounts {
    method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSessionAsUser(android.os.Bundle, android.app.Activity, android.os.UserHandle, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public static android.accounts.AccountManager get(android.content.Context);
    method public int getAccountVisibility(android.accounts.Account, int);
    method public android.accounts.Account[] getAccounts();
    method public java.util.Map<android.accounts.Account, java.lang.Integer> getAccountsAndVisibilityForPackage(java.lang.String, java.lang.String);
    method public android.accounts.Account[] getAccountsByType(java.lang.String);
    method public android.accounts.AccountManagerFuture<android.accounts.Account[]> getAccountsByTypeAndFeatures(java.lang.String, java.lang.String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler);
    method public android.accounts.Account[] getAccountsByTypeForPackage(java.lang.String, java.lang.String);
@@ -3010,13 +3013,11 @@ package android.accounts {
    method public android.accounts.AuthenticatorDescription[] getAuthenticatorTypes();
    method public java.lang.String getPassword(android.accounts.Account);
    method public java.lang.String getPreviousName(android.accounts.Account);
    method public int[] getRequestingUidsForType(java.lang.String);
    method public java.util.Map<java.lang.Integer, java.lang.Integer> getUidsAndVisibilityForAccount(android.accounts.Account);
    method public java.lang.String getUserData(android.accounts.Account, java.lang.String);
    method public android.accounts.AccountManagerFuture<java.lang.Boolean> hasFeatures(android.accounts.Account, java.lang.String[], android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public void invalidateAuthToken(java.lang.String, java.lang.String);
    method public boolean isAccountVisible(android.accounts.Account, int);
    method public android.accounts.AccountManagerFuture<java.lang.Boolean> isCredentialsUpdateSuggested(android.accounts.Account, java.lang.String, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public boolean makeAccountVisible(android.accounts.Account, int);
    method public static deprecated android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.ArrayList<android.accounts.Account>, java.lang.String[], boolean, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle);
    method public static android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.List<android.accounts.Account>, java.lang.String[], java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle);
    method public boolean notifyAccountAuthenticated(android.accounts.Account);
@@ -3024,9 +3025,9 @@ package android.accounts {
    method public deprecated android.accounts.AccountManagerFuture<java.lang.Boolean> removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> removeAccount(android.accounts.Account, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public boolean removeAccountExplicitly(android.accounts.Account);
    method public boolean removeAccountVisibility(android.accounts.Account, int);
    method public void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener);
    method public android.accounts.AccountManagerFuture<android.accounts.Account> renameAccount(android.accounts.Account, java.lang.String, android.accounts.AccountManagerCallback<android.accounts.Account>, android.os.Handler);
    method public boolean setAccountVisibility(android.accounts.Account, int, int);
    method public void setAuthToken(android.accounts.Account, java.lang.String, java.lang.String);
    method public void setPassword(android.accounts.Account, java.lang.String);
    method public void setUserData(android.accounts.Account, java.lang.String, java.lang.String);
@@ -3065,7 +3066,14 @@ package android.accounts {
    field public static final java.lang.String KEY_LAST_AUTHENTICATED_TIME = "lastAuthenticatedTime";
    field public static final java.lang.String KEY_PASSWORD = "password";
    field public static final java.lang.String KEY_USERDATA = "userdata";
    field public static final java.lang.String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED";
    field public static final deprecated java.lang.String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED";
    field public static final int UID_KEY_DEFAULT_LEGACY_VISIBILITY = -3; // 0xfffffffd
    field public static final int UID_KEY_DEFAULT_VISIBILITY = -2; // 0xfffffffe
    field public static final int VISIBILITY_NOT_VISIBLE = 3; // 0x3
    field public static final int VISIBILITY_UNDEFINED = 0; // 0x0
    field public static final int VISIBILITY_USER_MANAGED_NOT_VISIBLE = 4; // 0x4
    field public static final int VISIBILITY_USER_MANAGED_VISIBLE = 2; // 0x2
    field public static final int VISIBILITY_VISIBLE = 1; // 0x1
  }
  public abstract interface AccountManagerCallback<V> {
+14 −6
Original line number Diff line number Diff line
@@ -2874,15 +2874,18 @@ package android.accounts {
  public class AccountManager {
    method public android.accounts.AccountManagerFuture<android.os.Bundle> addAccount(java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle, int[]);
    method public boolean addAccountExplicitly(android.accounts.Account, java.lang.String, android.os.Bundle, java.util.Map<java.lang.Integer, java.lang.Integer>);
    method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean);
    method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean, java.lang.String[]);
    method public java.lang.String blockingGetAuthToken(android.accounts.Account, java.lang.String, boolean) throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException;
    method public void clearPassword(android.accounts.Account);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> editProperties(java.lang.String, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public static android.accounts.AccountManager get(android.content.Context);
    method public int getAccountVisibility(android.accounts.Account, int);
    method public android.accounts.Account[] getAccounts();
    method public java.util.Map<android.accounts.Account, java.lang.Integer> getAccountsAndVisibilityForPackage(java.lang.String, java.lang.String);
    method public android.accounts.Account[] getAccountsByType(java.lang.String);
    method public android.accounts.AccountManagerFuture<android.accounts.Account[]> getAccountsByTypeAndFeatures(java.lang.String, java.lang.String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler);
    method public android.accounts.Account[] getAccountsByTypeForPackage(java.lang.String, java.lang.String);
@@ -2893,13 +2896,11 @@ package android.accounts {
    method public android.accounts.AuthenticatorDescription[] getAuthenticatorTypes();
    method public java.lang.String getPassword(android.accounts.Account);
    method public java.lang.String getPreviousName(android.accounts.Account);
    method public int[] getRequestingUidsForType(java.lang.String);
    method public java.util.Map<java.lang.Integer, java.lang.Integer> getUidsAndVisibilityForAccount(android.accounts.Account);
    method public java.lang.String getUserData(android.accounts.Account, java.lang.String);
    method public android.accounts.AccountManagerFuture<java.lang.Boolean> hasFeatures(android.accounts.Account, java.lang.String[], android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public void invalidateAuthToken(java.lang.String, java.lang.String);
    method public boolean isAccountVisible(android.accounts.Account, int);
    method public android.accounts.AccountManagerFuture<java.lang.Boolean> isCredentialsUpdateSuggested(android.accounts.Account, java.lang.String, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public boolean makeAccountVisible(android.accounts.Account, int);
    method public static deprecated android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.ArrayList<android.accounts.Account>, java.lang.String[], boolean, java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle);
    method public static android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.List<android.accounts.Account>, java.lang.String[], java.lang.String, java.lang.String, java.lang.String[], android.os.Bundle);
    method public boolean notifyAccountAuthenticated(android.accounts.Account);
@@ -2907,9 +2908,9 @@ package android.accounts {
    method public deprecated android.accounts.AccountManagerFuture<java.lang.Boolean> removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
    method public android.accounts.AccountManagerFuture<android.os.Bundle> removeAccount(android.accounts.Account, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
    method public boolean removeAccountExplicitly(android.accounts.Account);
    method public boolean removeAccountVisibility(android.accounts.Account, int);
    method public void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener);
    method public android.accounts.AccountManagerFuture<android.accounts.Account> renameAccount(android.accounts.Account, java.lang.String, android.accounts.AccountManagerCallback<android.accounts.Account>, android.os.Handler);
    method public boolean setAccountVisibility(android.accounts.Account, int, int);
    method public void setAuthToken(android.accounts.Account, java.lang.String, java.lang.String);
    method public void setPassword(android.accounts.Account, java.lang.String);
    method public void setUserData(android.accounts.Account, java.lang.String, java.lang.String);
@@ -2948,7 +2949,14 @@ package android.accounts {
    field public static final java.lang.String KEY_LAST_AUTHENTICATED_TIME = "lastAuthenticatedTime";
    field public static final java.lang.String KEY_PASSWORD = "password";
    field public static final java.lang.String KEY_USERDATA = "userdata";
    field public static final java.lang.String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED";
    field public static final deprecated java.lang.String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED";
    field public static final int UID_KEY_DEFAULT_LEGACY_VISIBILITY = -3; // 0xfffffffd
    field public static final int UID_KEY_DEFAULT_VISIBILITY = -2; // 0xfffffffe
    field public static final int VISIBILITY_NOT_VISIBLE = 3; // 0x3
    field public static final int VISIBILITY_UNDEFINED = 0; // 0x0
    field public static final int VISIBILITY_USER_MANAGED_NOT_VISIBLE = 4; // 0x4
    field public static final int VISIBILITY_USER_MANAGED_VISIBLE = 2; // 0x2
    field public static final int VISIBILITY_VISIBLE = 1; // 0x1
  }
  public abstract interface AccountManagerCallback<V> {
+45 −190

File changed.

Preview size limit exceeded, changes collapsed.

+7 −1
Original line number Diff line number Diff line
@@ -505,7 +505,9 @@ public class AccountManagerService
     * @param ua UserAccount that currently hosts the account and application
     */
    private void registerAccountTypesSupported(int uid, UserAccounts ua) {
        /* Account types supported are drawn from the Android Manifest of the Application */
        return;
        // TODO clean up the code, manifest entry is deprecated
        /*
        String interestedPackages = null;
        try {
            String[] allPackages = mPackageManager.getPackagesForUid(uid);
@@ -527,6 +529,7 @@ public class AccountManagerService
            // TODO request visibility
            // requestAccountVisibility(interestedPackages.split(";"), uid, ua);
        }
        */
    }

    /**
@@ -536,6 +539,8 @@ public class AccountManagerService
     * @param visibleAccount to send to package
     */
    private void sendNotification(String desiredPackage, Account visibleAccount) {
        // TODO replace with callback
        /*
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
        intent.setAction(AccountManager.ACTION_VISIBLE_ACCOUNTS_CHANGED);
@@ -543,6 +548,7 @@ public class AccountManagerService
        // TODO update documentation, add account extra if new account became visible
        // intent.putExtra("android.accounts.KEY_ACCOUNT", (Account) visibleAccount);
        mContext.sendBroadcast(intent);
        */
    }

    @Override