Fix issue #2149145: Safe Mode does not work on Sholes device
The APIs for checking whether keys are held down now also look
at virtual keys.
However it turns out there is less than a second between the time we
start the input thread and check for safe mode, so there is not enough
time to actually open all of the devices and get the data from them
about the finger being down to determine if a virtual key is down.
So now you can also hold DPAD center, trackball center, or s to
enter safe mode. Also give some vibrator feedback.
Change-Id: I55edce63bc0c375813bd3751766b8070beeb0153
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index b3b50e5..65b3e3f 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -365,8 +365,17 @@
mContentResolver.registerContentObserver(Settings.Secure.getUriFor(Settings.Secure.ADB_ENABLED),
false, new AdbSettingsObserver());
- // It is now time to start up the app processes...
+ // Before things start rolling, be sure we have decided whether
+ // we are in safe mode.
final boolean safeMode = wm.detectSafeMode();
+ if (safeMode) {
+ try {
+ ActivityManagerNative.getDefault().enterSafeMode();
+ } catch (RemoteException e) {
+ }
+ }
+
+ // It is now time to start up the app processes...
if (notification != null) {
notification.systemReady();