Only run "core" apps when encrypting device.
This forces the package manager to only read packages that have
coreApp="true" in their manifest when encrypting the device, since no
non-essential processes or applications should run in that time.
Bug: 5031399
Change-Id: I87e8b27703e42553940167858db9473705d5d843
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 7e28c4f..977dd6f 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -64,6 +64,7 @@
class ServerThread extends Thread {
private static final String TAG = "SystemServer";
+ private static final String ENCRYPTING_STATE = "trigger_restart_min_framework";
ContentResolver mContentResolver;
@@ -147,9 +148,15 @@
AttributeCache.init(context);
Slog.i(TAG, "Package Manager");
+ // Only run "core" apps if we're encrypting the device.
+ String cryptState = SystemProperties.get("vold.decrypt");
+ boolean onlyCore = ENCRYPTING_STATE.equals(cryptState);
+ if (onlyCore) {
+ Slog.w(TAG, "Detected encryption in progress - only parsing core apps");
+ }
pm = PackageManagerService.main(context,
factoryTest != SystemServer.FACTORY_TEST_OFF,
- false);
+ onlyCore);
ActivityManagerService.setSystemProcess();