import android.content.IntentFilter;
import android.graphics.PixelFormat;
import android.graphics.drawable.ColorDrawable;
+import android.os.Binder;
import android.os.Handler;
+import android.os.IBinder;
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.service.vr.IVrStateCallbacks;
import android.util.DisplayMetrics;
import android.util.Slog;
-import android.util.SparseBooleanArray;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
private final H mHandler;
private final long mShowDelayMs;
private final long mPanicThresholdMs;
+ private final IBinder mWindowToken = new Binder();
private boolean mConfirmed;
private ClingWindowView mClingWindow;
WindowManager.LayoutParams.TYPE_STATUS_BAR_PANEL,
0
| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
,
PixelFormat.TRANSLUCENT);
lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
lp.setTitle("ImmersiveModeConfirmation");
lp.windowAnimations = com.android.internal.R.style.Animation_ImmersiveModeConfirmation;
+ lp.token = getWindowToken();
return lp;
}
Gravity.CENTER_HORIZONTAL | Gravity.TOP);
}
+ /**
+ * @return the window token that's used by all ImmersiveModeConfirmation windows.
+ */
+ public IBinder getWindowToken() {
+ return mWindowToken;
+ }
+
private class ClingWindowView extends FrameLayout {
private static final int BGCOLOR = 0x80000000;
private static final int OFFSET_DP = 96;
private int updateSystemUiVisibilityLw() {
// If there is no window focused, there will be nobody to handle the events
// anyway, so just hang on in whatever state we're in until things settle down.
- final WindowState win = mFocusedWindow != null ? mFocusedWindow
+ WindowState winCandidate = mFocusedWindow != null ? mFocusedWindow
: mTopFullscreenOpaqueWindowState;
- if (win == null) {
+ if (winCandidate == null) {
return 0;
}
+ if (winCandidate.getAttrs().token == mImmersiveModeConfirmation.getWindowToken()) {
+ // The immersive mode confirmation should never affect the system bar visibility,
+ // otherwise it will unhide the navigation bar and hide itself.
+ winCandidate = isStatusBarKeyguard() ? mStatusBar : mTopFullscreenOpaqueWindowState;
+ if (winCandidate == null) {
+ return 0;
+ }
+ }
+ final WindowState win = winCandidate;
if ((win.getAttrs().privateFlags & PRIVATE_FLAG_KEYGUARD) != 0 && mHideLockScreen == true) {
// We are updating at a point where the keyguard has gotten
// focus, but we were last in a state where the top window is