summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Tiger Huang <tigerhuang@google.com> 2020-07-28 04:31:01 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-07-28 04:31:01 +0000
commit6abd9378ff68e7e834fbfa001705ab48a8cc8a4b (patch)
treed257fa1ffac5353e7afeb1bf4b153c44be5973b0
parent43f44ad7e339de1c449d621e35be8d2d1ef1d60c (diff)
parent2d9334940f01aaf32bb5661bb49e5b5d7b96e712 (diff)
Merge "Fix panic gesture for hidden navigation bar"
-rw-r--r--services/core/java/com/android/server/wm/DisplayPolicy.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 0e24fc8bd307..4f6f75d924c4 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -356,6 +356,8 @@ public class DisplayPolicy {
private WindowState mFocusedWindow;
private WindowState mLastFocusedWindow;
+ private WindowState mSystemUiControllingWindow;
+
// The states of decor windows from the last layout. These are used to generate another display
// layout in different bounds but with the same states.
private boolean mLastNavVisible;
@@ -3436,6 +3438,7 @@ public class DisplayPolicy {
}
}
final WindowState win = winCandidate;
+ mSystemUiControllingWindow = win;
mDisplayContent.getInsetsPolicy().updateBarControlTarget(win);
@@ -3740,8 +3743,12 @@ public class DisplayPolicy {
& WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0;
final boolean hideStatusBarSysui =
(vis & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0;
- final boolean hideNavBarSysui =
- (vis & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0;
+ final boolean hideNavBarSysui = (vis & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0
+ // We shouldn't rely on the system UI visibilities anymore because the window can
+ // use the new API (e.g., WindowInsetsController.hide) to hide navigation bar.
+ // TODO(b/149813814): clean up the system UI flag usages in this function.
+ || !win.getRequestedInsetsState().getSourceOrDefaultVisibility(
+ ITYPE_NAVIGATION_BAR);
final boolean transientStatusBarAllowed = getStatusBar() != null
&& (notificationShadeHasFocus || (!mForceShowSystemBars
@@ -3755,15 +3762,16 @@ public class DisplayPolicy {
&& now - mPendingPanicGestureUptime <= PANIC_GESTURE_EXPIRATION;
final DisplayPolicy defaultDisplayPolicy =
mService.getDefaultDisplayContentLocked().getDisplayPolicy();
- if (pendingPanic && hideNavBarSysui && !isKeyguardShowing()
+ if (pendingPanic && hideNavBarSysui && win != mNotificationShade
+ && getInsetsPolicy().isHidden(ITYPE_NAVIGATION_BAR)
// TODO (b/111955725): Show keyguard presentation on all external displays
&& defaultDisplayPolicy.isKeyguardDrawComplete()) {
// The user performed the panic gesture recently, we're about to hide the bars,
// we're no longer on the Keyguard and the screen is ready. We can now request the bars.
mPendingPanicGestureUptime = 0;
- mStatusBarController.showTransient();
if (!isNavBarEmpty(vis)) {
- mNavigationBarController.showTransient();
+ mDisplayContent.getInsetsPolicy().showTransient(IntArray.wrap(
+ new int[] {ITYPE_NAVIGATION_BAR}));
}
}
@@ -3908,6 +3916,9 @@ public class DisplayPolicy {
}
private boolean isImmersiveMode(WindowState win) {
+ if (win == null) {
+ return false;
+ }
final int behavior = win.mAttrs.insetsFlags.behavior;
return getNavigationBar() != null
&& canHideNavigationBar()
@@ -3942,11 +3953,7 @@ public class DisplayPolicy {
return;
}
mPendingPanicGestureUptime = SystemClock.uptimeMillis();
- if (!isNavBarEmpty(mLastSystemUiFlags)) {
- mNavigationBarController.showTransient();
- mDisplayContent.getInsetsPolicy().showTransient(IntArray.wrap(
- new int[] {ITYPE_NAVIGATION_BAR}));
- }
+ updateSystemUiVisibilityLw();
}
}
};
@@ -3955,7 +3962,7 @@ public class DisplayPolicy {
// Detect user pressing the power button in panic when an application has
// taken over the whole screen.
boolean panic = mImmersiveModeConfirmation.onPowerKeyDown(isScreenOn,
- SystemClock.elapsedRealtime(), isImmersiveMode(mLastSystemUiFlags),
+ SystemClock.elapsedRealtime(), isImmersiveMode(mSystemUiControllingWindow),
isNavBarEmpty(mLastSystemUiFlags));
if (panic) {
mHandler.post(mHiddenNavPanic);