diff options
author | Ben Cheng <bccheng@android.com> | 2010-02-14 16:18:56 -0800 |
---|---|---|
committer | Ben Cheng <bccheng@android.com> | 2010-02-16 15:12:55 -0800 |
commit | 6c0afff7f027f14fba97bc937d2a13889927be9a (patch) | |
tree | 290ac7f6b40f7c1626e6f6c26117214e09ec4c1a /services | |
parent | 4a2d3b15ecca1f4db1e2c935ff36d19838eb5622 (diff) | |
download | frameworks_base-6c0afff7f027f14fba97bc937d2a13889927be9a.zip frameworks_base-6c0afff7f027f14fba97bc937d2a13889927be9a.tar.gz frameworks_base-6c0afff7f027f14fba97bc937d2a13889927be9a.tar.bz2 |
Detect system-wide safe mode and configure the VM accordingly.
For the system server process, do the disableJitCompilation/startJitCompilation
callbacks depending on whether the system is in safe mode or not.
In addition, if the system is found to be in safe mode, a flag will be set in
the Zygote class which will be used to launch subsequent apps in VM safe mode.
Bug: 2267590
Diffstat (limited to 'services')
-rw-r--r-- | services/java/com/android/server/SystemServer.java | 9 | ||||
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 5 |
2 files changed, 12 insertions, 2 deletions
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java index 28b4b28..a09896a 100644 --- a/services/java/com/android/server/SystemServer.java +++ b/services/java/com/android/server/SystemServer.java @@ -22,6 +22,7 @@ import com.android.internal.os.BinderInternal; import com.android.internal.os.SamplingProfilerIntegration; import dalvik.system.VMRuntime; +import dalvik.system.Zygote; import android.app.ActivityManagerNative; import android.bluetooth.BluetoothAdapter; @@ -396,8 +397,15 @@ class ServerThread extends Thread { if (safeMode) { try { ActivityManagerNative.getDefault().enterSafeMode(); + // Post the safe mode state in the Zygote class + Zygote.systemInSafeMode = true; + // Disable the JIT for the system_server process + VMRuntime.getRuntime().disableJitCompilation(); } catch (RemoteException e) { } + } else { + // Enable the JIT for the system_server process + VMRuntime.getRuntime().startJitCompilation(); } // It is now time to start up the app processes... @@ -519,7 +527,6 @@ public class SystemServer // The system server has to run all of the time, so it needs to be // as efficient as possible with its memory usage. VMRuntime.getRuntime().setTargetHeapUtilization(0.8f); - VMRuntime.getRuntime().startJitCompilation(); System.loadLibrary("android_servers"); init1(args); diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 8a73e99..3ecfd8a 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -1940,7 +1940,10 @@ public final class ActivityManagerService extends ActivityManagerNative implemen if ((app.info.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) { debugFlags |= Zygote.DEBUG_ENABLE_DEBUGGER; } - if ((app.info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0) { + // Run the app in safe mode if its manifest requests so or the + // system is booted in safe mode. + if ((app.info.flags & ApplicationInfo.FLAG_VM_SAFE_MODE) != 0 || + Zygote.systemInSafeMode == true) { debugFlags |= Zygote.DEBUG_ENABLE_SAFEMODE; } if ("1".equals(SystemProperties.get("debug.checkjni"))) { |