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

Commit a63a9d4c authored by Dmitry Dementyev's avatar Dmitry Dementyev Committed by Android (Google) Code Review
Browse files

Merge "Update AccountManager getAccountVisibility method to better handle default cases."

parents cdb8fcb6 06f32e0a
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -288,7 +288,8 @@ public class AccountManager {
    }

    /**
     * Account visibility was not set.
     * Account visibility was not set. Default visibility value will be used.
     * See {@link #PACKAGE_NAME_KEY_LEGACY_VISIBLE}, {@link #PACKAGE_NAME_KEY_LEGACY_NOT_VISIBLE}
     */
    public static final int VISIBILITY_UNDEFINED = 0;

@@ -919,7 +920,14 @@ public class AccountManager {
     * Package name must match installed application, or be equal to
     * {@link #PACKAGE_NAME_KEY_LEGACY_VISIBLE} or {@link #PACKAGE_NAME_KEY_LEGACY_NOT_VISIBLE}.
     * <p>
     * See {@link #getAccountVisibility} for possible values.
     * Possible visibility values:
     * <ul>
     * <li>{@link #VISIBILITY_UNDEFINED}</li>
     * <li>{@link #VISIBILITY_VISIBLE}</li>
     * <li>{@link #VISIBILITY_USER_MANAGED_VISIBLE}</li>
     * <li>{@link #VISIBILITY_NOT_VISIBLE}
     * <li>{@link #VISIBILITY_USER_MANAGED_NOT_VISIBLE}</li>
     * </ul>
     * <p>
     * This method requires the caller to have a signature match with the authenticator that owns
     * the specified account.
@@ -944,7 +952,6 @@ public class AccountManager {
    /**
     * Get visibility of certain account for given application. 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}
+8 −3
Original line number Diff line number Diff line
@@ -481,8 +481,13 @@ public class AccountManagerService
            managedTypes.add(accountType);
        }

        long identityToken = clearCallingIdentity();
        try {
            return getAccountsAndVisibilityForPackage(packageName, managedTypes, callingUid,
                    getUserAccounts(UserHandle.getUserId(callingUid)));
        } finally {
            restoreCallingIdentity(identityToken);
        }
    }

    /*
@@ -560,7 +565,7 @@ public class AccountManagerService
                    a.type);
            throw new SecurityException(msg);
        }
        return getAccountVisibility(a, packageName,
        return resolveAccountVisibility(a, packageName,
                getUserAccounts(UserHandle.getUserId(callingUid)));
    }