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/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java
index 761dcd1..c7c3fb2 100755
--- a/services/java/com/android/server/am/ActivityManagerService.java
+++ b/services/java/com/android/server/am/ActivityManagerService.java
@@ -6074,23 +6074,25 @@
AppGlobals.getPackageManager().enterSafeMode();
} catch (RemoteException e) {
}
-
- View v = LayoutInflater.from(mContext).inflate(
- com.android.internal.R.layout.safe_mode, null);
- WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
- lp.type = WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
- lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
- lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
- lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
- lp.format = v.getBackground().getOpacity();
- lp.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
- | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
- ((WindowManager)mContext.getSystemService(
- Context.WINDOW_SERVICE)).addView(v, lp);
}
}
}
+ public final void showSafeModeOverlay() {
+ View v = LayoutInflater.from(mContext).inflate(
+ com.android.internal.R.layout.safe_mode, null);
+ WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
+ lp.type = WindowManager.LayoutParams.TYPE_SECURE_SYSTEM_OVERLAY;
+ lp.width = WindowManager.LayoutParams.WRAP_CONTENT;
+ lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
+ lp.gravity = Gravity.BOTTOM | Gravity.LEFT;
+ lp.format = v.getBackground().getOpacity();
+ lp.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+ | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
+ ((WindowManager)mContext.getSystemService(
+ Context.WINDOW_SERVICE)).addView(v, lp);
+ }
+
public void noteWakeupAlarm(IIntentSender sender) {
if (!(sender instanceof PendingIntentRecord)) {
return;