Support per-application switch to execute the VM in safe mode.
The new attribute can be set by adding android:safeMode="true"
in AndroidManifest.xml with the SDK.
Tested with pairing locally compiled SDK with Eclipse and verified that the JIT
(the only component currently included in the safe mode) is indeed disabled
with the new attribute.
Bug: 2267583
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 98ded37..87ed252 100644
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -1949,6 +1949,9 @@
if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
debugFlags |= Zygote.DEBUG_ENABLE_DEBUGGER;
}
+ if ((app.info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0) {
+ debugFlags |= Zygote.DEBUG_ENABLE_SAFEMODE;
+ }
if ("1".equals(SystemProperties.get("debug.checkjni"))) {
debugFlags |= Zygote.DEBUG_ENABLE_CHECKJNI;
}