summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorNarayan Kamath <narayan@google.com>2014-06-17 12:59:46 +0100
committerNarayan Kamath <narayan@google.com>2014-06-17 13:07:45 +0100
commit8df5bd08c2ec7e492dc442bc57157a56f65572aa (patch)
tree81c933a2ee0e543d5097f46338333da67c03b9d3 /services
parent0d28bb47d771a2ac99cec6e4a071a98d2cd705dd (diff)
downloadframeworks_base-8df5bd08c2ec7e492dc442bc57157a56f65572aa.zip
frameworks_base-8df5bd08c2ec7e492dc442bc57157a56f65572aa.tar.gz
frameworks_base-8df5bd08c2ec7e492dc442bc57157a56f65572aa.tar.bz2
Explicitly list out the list of cache subdirs to prune.
We don't want directories like profiles and the former profile-cache from being included in the prune. SELinux would have prevented the move, but that's very brittle. bug: 15677279 Change-Id: I2ff5db056757ffacaf108bb07b02dc0cac7172dd
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/pm/Installer.java5
-rwxr-xr-xservices/java/com/android/server/pm/PackageManagerService.java13
2 files changed, 12 insertions, 6 deletions
diff --git a/services/java/com/android/server/pm/Installer.java b/services/java/com/android/server/pm/Installer.java
index adf7439..7981a5b 100644
--- a/services/java/com/android/server/pm/Installer.java
+++ b/services/java/com/android/server/pm/Installer.java
@@ -24,6 +24,7 @@ import android.util.Slog;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.List;
public final class Installer {
private static final String TAG = "Installer";
@@ -335,8 +336,8 @@ public final class Installer {
}
}
- public int pruneDexCache() {
- return execute("prunedexcache");
+ public int pruneDexCache(String cacheSubDir) {
+ return execute("prunedexcache " + cacheSubDir);
}
public int freeCache(long freeStorageSize) {
diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java
index 2dad8ab..1687cd2 100755
--- a/services/java/com/android/server/pm/PackageManagerService.java
+++ b/services/java/com/android/server/pm/PackageManagerService.java
@@ -1437,9 +1437,6 @@ public class PackageManagerService extends IPackageManager.Stub {
// changed. Consider this significant, and wipe away all other
// existing dexopt files to ensure we don't leave any dangling around.
//
- // Additionally, delete all dex files from the root directory
- // since there shouldn't be any there anyway.
- //
// TODO: This should be revisited because it isn't as good an indicator
// as it used to be. It used to include the boot classpath but at some point
// DexFile.isDexOptNeeded started returning false for the boot
@@ -1447,7 +1444,15 @@ public class PackageManagerService extends IPackageManager.Stub {
// small maintenance release update that the library and tool
// jars may be unchanged but APK could be removed resulting in
// unused dalvik-cache files.
- mInstaller.pruneDexCache();
+ for (String instructionSet : instructionSets) {
+ mInstaller.pruneDexCache(instructionSet);
+ }
+
+ // Additionally, delete all dex files from the root directory
+ // since there shouldn't be any there anyway, unless we're upgrading
+ // from an older OS version or a build that contained the "old" style
+ // flat scheme.
+ mInstaller.pruneDexCache(".");
}
// Collect vendor overlay packages.