Loading policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -2550,7 +2550,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { int sState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_S); int dpadState = mWindowManager.getDPadKeycodeState(KeyEvent.KEYCODE_DPAD_CENTER); int trackballState = mWindowManager.getTrackballScancodeState(BTN_MOUSE); mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0; int volumeDownState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_VOLUME_DOWN); mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0 || volumeDownState > 0; performHapticFeedbackLw(null, mSafeMode ? HapticFeedbackConstants.SAFE_MODE_ENABLED : HapticFeedbackConstants.SAFE_MODE_DISABLED, true); Loading services/java/com/android/server/InputManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -423,7 +423,7 @@ public class InputManager { @SuppressWarnings("unused") public void notifyConfigurationChanged(long whenNanos) { mWindowManagerService.sendNewConfiguration(); mWindowManagerService.mInputMonitor.notifyConfigurationChanged(); } @SuppressWarnings("unused") Loading services/java/com/android/server/SystemServer.java +9 −8 Original line number Diff line number Diff line Loading @@ -481,14 +481,11 @@ class ServerThread extends Thread { // we are in safe mode. final boolean safeMode = wm.detectSafeMode(); if (safeMode) { try { ActivityManagerNative.getDefault().enterSafeMode(); 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(); } catch (RemoteException e) { } } else { // Enable the JIT for the system_server process VMRuntime.getRuntime().startJitCompilation(); Loading @@ -506,6 +503,10 @@ class ServerThread extends Thread { 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. Loading services/java/com/android/server/WindowManagerService.java +42 −1 Original line number Diff line number Diff line Loading @@ -213,6 +213,10 @@ public class WindowManagerService extends IWindowManager.Stub // FIXME is this value reasonable? private static final int INJECTION_TIMEOUT_MILLIS = 30 * 1000; // Maximum number of milliseconds to wait for input devices to be enumerated before // proceding with safe mode detection. private static final int INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS = 1000; // Default input dispatching timeout in nanoseconds. private static final long DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS = 5000 * 1000000L; Loading Loading @@ -5812,6 +5816,11 @@ public class WindowManagerService extends IWindowManager.Stub // Temporary input application object to provide to the input dispatcher. private InputApplication mTempInputApplication = new InputApplication(); // Set to true when the first input device configuration change notification // is received to indicate that the input devices are ready. private final Object mInputDevicesReadyMonitor = new Object(); private boolean mInputDevicesReady; /* Notifies the window manager about a broken input channel. * * Called by the InputManager. Loading Loading @@ -6008,6 +6017,31 @@ public class WindowManagerService extends IWindowManager.Stub mTempInputWindows.clear(); } /* Notifies that the input device configuration has changed. */ public void notifyConfigurationChanged() { sendNewConfiguration(); synchronized (mInputDevicesReadyMonitor) { if (!mInputDevicesReady) { mInputDevicesReady = true; mInputDevicesReadyMonitor.notifyAll(); } } } /* Waits until the built-in input devices have been configured. */ public boolean waitForInputDevicesReady(long timeoutMillis) { synchronized (mInputDevicesReadyMonitor) { if (!mInputDevicesReady) { try { mInputDevicesReadyMonitor.wait(timeoutMillis); } catch (InterruptedException ex) { } } return mInputDevicesReady; } } /* Notifies that the lid switch changed state. */ public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) { mPolicy.notifyLidSwitchChanged(whenNanos, lidOpen); Loading Loading @@ -6329,6 +6363,13 @@ public class WindowManagerService extends IWindowManager.Stub } public boolean detectSafeMode() { if (!mInputMonitor.waitForInputDevicesReady( INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS)) { Slog.w(TAG, "Devices still not ready after waiting " + INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS + " milliseconds before attempting to detect safe mode."); } mSafeMode = mPolicy.detectSafeMode(); return mSafeMode; } Loading services/java/com/android/server/am/ActivityManagerService.java +15 −13 Original line number Diff line number Diff line Loading @@ -6075,7 +6075,11 @@ public final class ActivityManagerService extends ActivityManagerNative AppGlobals.getPackageManager().enterSafeMode(); } catch (RemoteException e) { } } } } public final void showSafeModeOverlay() { View v = LayoutInflater.from(mContext).inflate( com.android.internal.R.layout.safe_mode, null); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); Loading @@ -6089,8 +6093,6 @@ public final class ActivityManagerService extends ActivityManagerNative ((WindowManager)mContext.getSystemService( Context.WINDOW_SERVICE)).addView(v, lp); } } } public void noteWakeupAlarm(IIntentSender sender) { if (!(sender instanceof PendingIntentRecord)) { Loading Loading
policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -2550,7 +2550,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { int sState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_S); int dpadState = mWindowManager.getDPadKeycodeState(KeyEvent.KEYCODE_DPAD_CENTER); int trackballState = mWindowManager.getTrackballScancodeState(BTN_MOUSE); mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0; int volumeDownState = mWindowManager.getKeycodeState(KeyEvent.KEYCODE_VOLUME_DOWN); mSafeMode = menuState > 0 || sState > 0 || dpadState > 0 || trackballState > 0 || volumeDownState > 0; performHapticFeedbackLw(null, mSafeMode ? HapticFeedbackConstants.SAFE_MODE_ENABLED : HapticFeedbackConstants.SAFE_MODE_DISABLED, true); Loading
services/java/com/android/server/InputManager.java +1 −1 Original line number Diff line number Diff line Loading @@ -423,7 +423,7 @@ public class InputManager { @SuppressWarnings("unused") public void notifyConfigurationChanged(long whenNanos) { mWindowManagerService.sendNewConfiguration(); mWindowManagerService.mInputMonitor.notifyConfigurationChanged(); } @SuppressWarnings("unused") Loading
services/java/com/android/server/SystemServer.java +9 −8 Original line number Diff line number Diff line Loading @@ -481,14 +481,11 @@ class ServerThread extends Thread { // we are in safe mode. final boolean safeMode = wm.detectSafeMode(); if (safeMode) { try { ActivityManagerNative.getDefault().enterSafeMode(); 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(); } catch (RemoteException e) { } } else { // Enable the JIT for the system_server process VMRuntime.getRuntime().startJitCompilation(); Loading @@ -506,6 +503,10 @@ class ServerThread extends Thread { 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. Loading
services/java/com/android/server/WindowManagerService.java +42 −1 Original line number Diff line number Diff line Loading @@ -213,6 +213,10 @@ public class WindowManagerService extends IWindowManager.Stub // FIXME is this value reasonable? private static final int INJECTION_TIMEOUT_MILLIS = 30 * 1000; // Maximum number of milliseconds to wait for input devices to be enumerated before // proceding with safe mode detection. private static final int INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS = 1000; // Default input dispatching timeout in nanoseconds. private static final long DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS = 5000 * 1000000L; Loading Loading @@ -5812,6 +5816,11 @@ public class WindowManagerService extends IWindowManager.Stub // Temporary input application object to provide to the input dispatcher. private InputApplication mTempInputApplication = new InputApplication(); // Set to true when the first input device configuration change notification // is received to indicate that the input devices are ready. private final Object mInputDevicesReadyMonitor = new Object(); private boolean mInputDevicesReady; /* Notifies the window manager about a broken input channel. * * Called by the InputManager. Loading Loading @@ -6008,6 +6017,31 @@ public class WindowManagerService extends IWindowManager.Stub mTempInputWindows.clear(); } /* Notifies that the input device configuration has changed. */ public void notifyConfigurationChanged() { sendNewConfiguration(); synchronized (mInputDevicesReadyMonitor) { if (!mInputDevicesReady) { mInputDevicesReady = true; mInputDevicesReadyMonitor.notifyAll(); } } } /* Waits until the built-in input devices have been configured. */ public boolean waitForInputDevicesReady(long timeoutMillis) { synchronized (mInputDevicesReadyMonitor) { if (!mInputDevicesReady) { try { mInputDevicesReadyMonitor.wait(timeoutMillis); } catch (InterruptedException ex) { } } return mInputDevicesReady; } } /* Notifies that the lid switch changed state. */ public void notifyLidSwitchChanged(long whenNanos, boolean lidOpen) { mPolicy.notifyLidSwitchChanged(whenNanos, lidOpen); Loading Loading @@ -6329,6 +6363,13 @@ public class WindowManagerService extends IWindowManager.Stub } public boolean detectSafeMode() { if (!mInputMonitor.waitForInputDevicesReady( INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS)) { Slog.w(TAG, "Devices still not ready after waiting " + INPUT_DEVICES_READY_FOR_SAFE_MODE_DETECTION_TIMEOUT_MILLIS + " milliseconds before attempting to detect safe mode."); } mSafeMode = mPolicy.detectSafeMode(); return mSafeMode; } Loading
services/java/com/android/server/am/ActivityManagerService.java +15 −13 Original line number Diff line number Diff line Loading @@ -6075,7 +6075,11 @@ public final class ActivityManagerService extends ActivityManagerNative AppGlobals.getPackageManager().enterSafeMode(); } catch (RemoteException e) { } } } } public final void showSafeModeOverlay() { View v = LayoutInflater.from(mContext).inflate( com.android.internal.R.layout.safe_mode, null); WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); Loading @@ -6089,8 +6093,6 @@ public final class ActivityManagerService extends ActivityManagerNative ((WindowManager)mContext.getSystemService( Context.WINDOW_SERVICE)).addView(v, lp); } } } public void noteWakeupAlarm(IIntentSender sender) { if (!(sender instanceof PendingIntentRecord)) { Loading