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

Commit 58fa8362 authored by Dmitry Dementyev's avatar Dmitry Dementyev
Browse files

Implement Account Discovery API.

Bug: https://b.corp.google.com/issues/33046496
Test: cts tests, manual tests.

Change-Id: I03d1ae5dfa1577f191817aa7d508f6b4d0e625ed
parent 4bab824c
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -328,7 +328,6 @@ public class AccountManager {
    /**
     * Token type for the special case where a UID has access only to an account
     * but no authenticator specific auth token types.
     *
     * @hide
     */
    public static final String ACCOUNT_ACCESS_TOKEN_TYPE =
@@ -354,9 +353,9 @@ public class AccountManager {
     * the applications are added, accounts are removed, or an account's credentials (saved
     * password, etc) are changed. List of supported account types shoud be specified in the
     * Manifest file using {@link #SUPPORTED_ACCOUNT_TYPES}
     *
     * @see #addOnAccountsUpdatedListener
     * @hide
     * @see #addOnAccountsUpdatedListener
     *
     */
    public static final String ACTION_VISIBLE_ACCOUNTS_CHANGED =
            "android.accounts.action.VISIBLE_ACCOUNTS_CHANGED";
@@ -364,6 +363,7 @@ public class AccountManager {
    /**
     * Authenticators may subscribe to get notifications about apps interested in their managed account
     * types using {@link #SUPPORTED_ACCOUNT_TYPES}.
     * Package name will be specified using {@link Intent.EXTRA_PACKAGE_NAME}
     * @hide
     */
    public static final String ACTION_ACCOUNTS_LISTENER_PACKAGE_INSTALLED =
@@ -1024,7 +1024,7 @@ public class AccountManager {
    public boolean isAccountVisible(Account account, int uid) {
        try {
            Integer visibility = mService.getAccountVisibility(account, uid);
            return visibility == VISIBILITY_USER_MANAGED_NOT_VISIBLE
            return visibility == VISIBILITY_USER_MANAGED_VISIBLE
                    || visibility == VISIBILITY_VISIBLE;
        } catch (RemoteException re) {
            throw re.rethrowFromSystemServer();
@@ -1058,6 +1058,7 @@ public class AccountManager {
    /**
     * Gets visibility of certain account for given UID. Possible returned values are:
     * <ul>
     * <li>{@link #VISIBILITY_UNDEFINED}</li>
     * <li>{@link #VISIBILITY_VISIBLE}</li>
     * <li>{@link #VISIBILITY_USER_MANAGED_VISIBLE}</li>
     * <li>{@link #VISIBILITY_NOT_VISIBLE}
+3 −1
Original line number Diff line number Diff line
@@ -52,7 +52,9 @@ public class ChooseAccountActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // TODO This activity is only used by getAuthTokenByFeatures and can not see
        // VISIBILITY_USER_MANAGED_NOT_VISIBLE accounts. It should be moved to account managed
        // service.
        mAccounts = getIntent().getParcelableArrayExtra(AccountManager.KEY_ACCOUNTS);
        mAccountManagerResponse =
                getIntent().getParcelableExtra(AccountManager.KEY_ACCOUNT_MANAGER_RESPONSE);
+3 −0
Original line number Diff line number Diff line
@@ -476,6 +476,9 @@
    <protected-broadcast android:name="android.intent.action.ACTION_RADIO_OFF" />

    <protected-broadcast android:name="android.accounts.LOGIN_ACCOUNTS_CHANGED" />
    <protected-broadcast android:name="android.accounts.action.VISIBLE_ACCOUNTS_CHANGED" />
    <protected-broadcast android:name="android.accounts.action.ACCOUNTS_LISTENER_PACKAGE_INSTALLED" />

    <protected-broadcast android:name="com.android.sync.SYNC_CONN_STATUS_CHANGED" />

    <protected-broadcast android:name="com.android.phone.SIP_INCOMING_CALL" />
+720 −144

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -355,7 +355,7 @@ class AccountsDb implements AutoCloseable {
    boolean deleteAuthtokensByAccountIdAndType(long accountId, String authtokenType) {
        SQLiteDatabase db = mDeDatabase.getWritableDatabaseUserIsUnlocked();
        return db.delete(CE_TABLE_AUTHTOKENS,
                AUTHTOKENS_ACCOUNTS_ID + "=?" + accountId + " AND " + AUTHTOKENS_TYPE + "=?",
                AUTHTOKENS_ACCOUNTS_ID + "=?" + " AND " + AUTHTOKENS_TYPE + "=?",
                new String[]{String.valueOf(accountId), authtokenType}) > 0;
    }