summaryrefslogtreecommitdiffstats
path: root/services/java/com/android/server/accounts/AccountManagerService.java
diff options
context:
space:
mode:
Diffstat (limited to 'services/java/com/android/server/accounts/AccountManagerService.java')
-rw-r--r--services/java/com/android/server/accounts/AccountManagerService.java15
1 files changed, 11 insertions, 4 deletions
diff --git a/services/java/com/android/server/accounts/AccountManagerService.java b/services/java/com/android/server/accounts/AccountManagerService.java
index 3b63937..0fbde37 100644
--- a/services/java/com/android/server/accounts/AccountManagerService.java
+++ b/services/java/com/android/server/accounts/AccountManagerService.java
@@ -2802,12 +2802,19 @@ public class AccountManagerService
if (sharedAccounts == null || sharedAccounts.length == 0) return unfiltered;
String requiredAccountType = "";
try {
- for (String packageName : packages) {
- PackageInfo pi = mPackageManager.getPackageInfo(packageName, 0);
+ // If there's an explicit callingPackage specified, check if that package
+ // opted in to see restricted accounts.
+ if (callingPackage != null) {
+ PackageInfo pi = mPackageManager.getPackageInfo(callingPackage, 0);
if (pi != null && pi.restrictedAccountType != null) {
requiredAccountType = pi.restrictedAccountType;
- // If it matches the package name of the original caller, use this choice.
- if (callingPackage != null && packageName.equals(callingPackage)) {
+ }
+ } else {
+ // Otherwise check if the callingUid has a package that has opted in
+ for (String packageName : packages) {
+ PackageInfo pi = mPackageManager.getPackageInfo(packageName, 0);
+ if (pi != null && pi.restrictedAccountType != null) {
+ requiredAccountType = pi.restrictedAccountType;
break;
}
}