Add volume down as a safe mode key for Stingray.
Fixed a race condition during startup. We need to wait for the input
devices to actually be ready before trying to detect safe mode.
Fixed a problem during safe mode activation where we would try to add
the overlay window but the display was not initialized. Now we do it
after the system is ready.
Bug: 3134825
Change-Id: I4c043c142ae6bf0d865c79d266d36154eaf00709
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 95534e3..6f4b4c5 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -481,14 +481,11 @@
// we are in safe mode.
final boolean safeMode = wm.detectSafeMode();
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) {
- }
+ ActivityManagerService.self().enterSafeMode();
+ // Post the safe mode state in the Zygote class
+ Zygote.systemInSafeMode = true;
+ // Disable the JIT for the system_server process
+ VMRuntime.getRuntime().disableJitCompilation();
} else {
// Enable the JIT for the system_server process
VMRuntime.getRuntime().startJitCompilation();
@@ -506,6 +503,10 @@
wm.systemReady();
+ if (safeMode) {
+ ActivityManagerService.self().showSafeModeOverlay();
+ }
+
// Update the configuration for this context by hand, because we're going
// to start using it before the config change done in wm.systemReady() will
// propagate to it.