diff options
author | Fyodor Kupolov <fkupolov@google.com> | 2014-11-14 21:45:57 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-11-14 21:45:57 +0000 |
commit | 0477f716311ab03ef89ce9ecb288182c0aa25d4a (patch) | |
tree | efb72930fdb7e063453cdfef70e2b5c6df6a98df /services/devicepolicy | |
parent | 7fc726193f4e59936c63fa11ac5908bddd768ef1 (diff) | |
parent | 70b2de7c25a083a44042ddd0cb8b2a24dde53e6e (diff) | |
download | frameworks_base-0477f716311ab03ef89ce9ecb288182c0aa25d4a.zip frameworks_base-0477f716311ab03ef89ce9ecb288182c0aa25d4a.tar.gz frameworks_base-0477f716311ab03ef89ce9ecb288182c0aa25d4a.tar.bz2 |
am 70b2de7c: am 6dd9f86f: Merge "Added synchronization to handlePackagesChanged method" into lmp-mr1-dev automerge: a07bdda
* commit '70b2de7c25a083a44042ddd0cb8b2a24dde53e6e':
Added synchronization to handlePackagesChanged method
Diffstat (limited to 'services/devicepolicy')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 9c78963..73cfbb2 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -901,23 +901,25 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (DBG) Slog.d(LOG_TAG, "Handling package changes for user " + userHandle); DevicePolicyData policy = getUserData(userHandle); IPackageManager pm = AppGlobals.getPackageManager(); - for (int i = policy.mAdminList.size() - 1; i >= 0; i--) { - ActiveAdmin aa = policy.mAdminList.get(i); - try { - if (pm.getPackageInfo(aa.info.getPackageName(), 0, userHandle) == null - || pm.getReceiverInfo(aa.info.getComponent(), 0, userHandle) == null) { - removed = true; - policy.mAdminList.remove(i); - policy.mAdminMap.remove(aa.info.getComponent()); + synchronized (this) { + for (int i = policy.mAdminList.size() - 1; i >= 0; i--) { + ActiveAdmin aa = policy.mAdminList.get(i); + try { + if (pm.getPackageInfo(aa.info.getPackageName(), 0, userHandle) == null + || pm.getReceiverInfo(aa.info.getComponent(), 0, userHandle) == null) { + removed = true; + policy.mAdminList.remove(i); + policy.mAdminMap.remove(aa.info.getComponent()); + } + } catch (RemoteException re) { + // Shouldn't happen } - } catch (RemoteException re) { - // Shouldn't happen } - } - if (removed) { - validatePasswordOwnerLocked(policy); - syncDeviceCapabilitiesLocked(policy); - saveSettingsLocked(policy.mUserHandle); + if (removed) { + validatePasswordOwnerLocked(policy); + syncDeviceCapabilitiesLocked(policy); + saveSettingsLocked(policy.mUserHandle); + } } } |