Use invalid package names for special keys in AccountManager.
Bug: 37672088
Test: cts, manual.
Change-Id: I7fd40e0646a50f809b5c9b89dfe4242ceb00195d
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index 018e41b..03da5b2 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -576,6 +576,22 @@
long identityToken = clearCallingIdentity();
try {
UserAccounts accounts = getUserAccounts(userId);
+ if (AccountManager.PACKAGE_NAME_KEY_LEGACY_VISIBLE.equals(packageName)) {
+ int visibility = getAccountVisibilityFromCache(account, packageName, accounts);
+ if (AccountManager.VISIBILITY_UNDEFINED != visibility) {
+ return visibility;
+ } else {
+ return AccountManager.VISIBILITY_USER_MANAGED_VISIBLE;
+ }
+ }
+ if (AccountManager.PACKAGE_NAME_KEY_LEGACY_NOT_VISIBLE.equals(packageName)) {
+ int visibility = getAccountVisibilityFromCache(account, packageName, accounts);
+ if (AccountManager.VISIBILITY_UNDEFINED != visibility) {
+ return visibility;
+ } else {
+ return AccountManager.VISIBILITY_USER_MANAGED_NOT_VISIBLE;
+ }
+ }
return resolveAccountVisibility(account, packageName, accounts);
} finally {
restoreCallingIdentity(identityToken);
@@ -641,11 +657,6 @@
return AccountManager.VISIBILITY_VISIBLE; // Authenticator can always see the account
}
- if (isSpecialPackageKey(packageName)) {
- Log.d(TAG, "Package name is forbidden: " + packageName);
- return AccountManager.VISIBILITY_NOT_VISIBLE;
- }
-
// Return stored value if it was set.
int visibility = getAccountVisibilityFromCache(account, packageName, accounts);