am 862840d6: am 301dfe08: Merge "[Fix getAccounts MANAGE_USERS permission]" into mnc-dev

* commit '862840d68935addab388791db251c05d5bdfc183':
  [Fix getAccounts MANAGE_USERS permission]
This commit is contained in:
Simranjit Kohli
2015-08-10 21:51:26 +00:00
committed by Android Git Automerger

View File

@@ -2604,7 +2604,8 @@ public class AccountManagerService
// Prune the list down to just the requested type. // Prune the list down to just the requested type.
visibleAccountTypes = new ArrayList<>(); visibleAccountTypes = new ArrayList<>();
visibleAccountTypes.add(type); visibleAccountTypes.add(type);
} // else aggregate all the visible accounts (it won't matter if the list is empty). } // else aggregate all the visible accounts (it won't matter if the
// list is empty).
long identityToken = clearCallingIdentity(); long identityToken = clearCallingIdentity();
try { try {
@@ -3788,8 +3789,15 @@ public class AccountManagerService
private List<String> getTypesForCaller( private List<String> getTypesForCaller(
int callingUid, int userId, boolean isOtherwisePermitted) { int callingUid, int userId, boolean isOtherwisePermitted) {
List<String> managedAccountTypes = new ArrayList<>(); List<String> managedAccountTypes = new ArrayList<>();
long identityToken = Binder.clearCallingIdentity();
Collection<RegisteredServicesCache.ServiceInfo<AuthenticatorDescription>> serviceInfos;
try {
serviceInfos = mAuthenticatorCache.getAllServices(userId);
} finally {
Binder.restoreCallingIdentity(identityToken);
}
for (RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> serviceInfo : for (RegisteredServicesCache.ServiceInfo<AuthenticatorDescription> serviceInfo :
mAuthenticatorCache.getAllServices(userId)) { serviceInfos) {
final int sigChk = mPackageManager.checkSignatures(serviceInfo.uid, callingUid); final int sigChk = mPackageManager.checkSignatures(serviceInfo.uid, callingUid);
if (isOtherwisePermitted || sigChk == PackageManager.SIGNATURE_MATCH) { if (isOtherwisePermitted || sigChk == PackageManager.SIGNATURE_MATCH) {
managedAccountTypes.add(serviceInfo.type.type); managedAccountTypes.add(serviceInfo.type.type);