Update AccountManager getAccountVisibility method to better handle default cases.
Test: cts, manual
Change-Id: Ic0f8fef9f928fefa6cc32a91c471969f7d5a4e45
diff --git a/services/core/java/com/android/server/accounts/AccountManagerService.java b/services/core/java/com/android/server/accounts/AccountManagerService.java
index be5cbfc..5b480d0 100644
--- a/services/core/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/core/java/com/android/server/accounts/AccountManagerService.java
@@ -481,8 +481,13 @@
managedTypes.add(accountType);
}
- return getAccountsAndVisibilityForPackage(packageName, managedTypes, callingUid,
- getUserAccounts(UserHandle.getUserId(callingUid)));
+ long identityToken = clearCallingIdentity();
+ try {
+ return getAccountsAndVisibilityForPackage(packageName, managedTypes, callingUid,
+ getUserAccounts(UserHandle.getUserId(callingUid)));
+ } finally {
+ restoreCallingIdentity(identityToken);
+ }
}
/*
@@ -560,7 +565,7 @@
a.type);
throw new SecurityException(msg);
}
- return getAccountVisibility(a, packageName,
+ return resolveAccountVisibility(a, packageName,
getUserAccounts(UserHandle.getUserId(callingUid)));
}