diff options
author | Jeff Sharkey <jsharkey@android.com> | 2015-09-21 20:29:58 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-09-21 20:29:58 +0000 |
commit | 281a868c69e0915efc16eb3c65f669bbf0df69df (patch) | |
tree | 2673783470845a2f400564180844970abd49350e /services | |
parent | 7aa79efe80b790eef61ac355c0ce6c7b606e6f78 (diff) | |
parent | e1a6299b994bbdb304550e00d5b3b26a064bdf0c (diff) | |
download | frameworks_base-281a868c69e0915efc16eb3c65f669bbf0df69df.zip frameworks_base-281a868c69e0915efc16eb3c65f669bbf0df69df.tar.gz frameworks_base-281a868c69e0915efc16eb3c65f669bbf0df69df.tar.bz2 |
am e1a6299b: Relax locking when scanning private volumes.
* commit 'e1a6299b994bbdb304550e00d5b3b26a064bdf0c':
Relax locking when scanning private volumes.
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/pm/PackageManagerService.java | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/pm/PackageManagerService.java b/services/core/java/com/android/server/pm/PackageManagerService.java index 3330a50..7e5930d 100644 --- a/services/core/java/com/android/server/pm/PackageManagerService.java +++ b/services/core/java/com/android/server/pm/PackageManagerService.java @@ -15678,14 +15678,28 @@ public class PackageManagerService extends IPackageManager.Stub { } } - private void loadPrivatePackages(VolumeInfo vol) { + private void loadPrivatePackages(final VolumeInfo vol) { + mHandler.post(new Runnable() { + @Override + public void run() { + loadPrivatePackagesInner(vol); + } + }); + } + + private void loadPrivatePackagesInner(VolumeInfo vol) { final ArrayList<ApplicationInfo> loaded = new ArrayList<>(); final int parseFlags = mDefParseFlags | PackageParser.PARSE_EXTERNAL_STORAGE; - synchronized (mInstallLock) { + + final VersionInfo ver; + final List<PackageSetting> packages; synchronized (mPackages) { - final VersionInfo ver = mSettings.findOrCreateVersion(vol.fsUuid); - final List<PackageSetting> packages = mSettings.getVolumePackagesLPr(vol.fsUuid); - for (PackageSetting ps : packages) { + ver = mSettings.findOrCreateVersion(vol.fsUuid); + packages = mSettings.getVolumePackagesLPr(vol.fsUuid); + } + + for (PackageSetting ps : packages) { + synchronized (mInstallLock) { final PackageParser.Package pkg; try { pkg = scanPackageLI(ps.codePath, parseFlags, SCAN_INITIAL, 0L, null); @@ -15698,7 +15712,9 @@ public class PackageManagerService extends IPackageManager.Stub { deleteCodeCacheDirsLI(ps.volumeUuid, ps.name); } } + } + synchronized (mPackages) { int updateFlags = UPDATE_PERMISSIONS_ALL; if (ver.sdkVersion != mSdkVersion) { logCriticalInfo(Log.INFO, "Platform changed from " + ver.sdkVersion + " to " @@ -15712,13 +15728,21 @@ public class PackageManagerService extends IPackageManager.Stub { mSettings.writeLPr(); } - } if (DEBUG_INSTALL) Slog.d(TAG, "Loaded packages " + loaded); sendResourcesChangedBroadcast(true, false, loaded, null); } - private void unloadPrivatePackages(VolumeInfo vol) { + private void unloadPrivatePackages(final VolumeInfo vol) { + mHandler.post(new Runnable() { + @Override + public void run() { + unloadPrivatePackagesInner(vol); + } + }); + } + + private void unloadPrivatePackagesInner(VolumeInfo vol) { final ArrayList<ApplicationInfo> unloaded = new ArrayList<>(); synchronized (mInstallLock) { synchronized (mPackages) { |