Do not let snapshot window control the bar

The snapshot window will sometime take over the system bar control as
the top fullscreen opaque window. To avoid the window take the control
if the window is not focusable to avoid the bar flickering issue when
the snapshot window has a different insets visibility with the current
controller.

Test: Launch sticky immersive app from recent. The bar hidden animation
      works correctly. No flickering.
Test: atest MultiDisplayPolicyTests
Test: ActivityStarterTests
Bug: 203017444
Change-Id: I3d7ba6b7d78c0508ddeccbf1d3408d723bd8e2c0
This commit is contained in:
Yunfan Chen
2021-11-08 18:48:13 +09:00
parent bb6c39d397
commit 2e6e4355e6

View File

@@ -2665,10 +2665,15 @@ public class DisplayPolicy {
}
void updateSystemBarAttributes() {
WindowState winCandidate = mFocusedWindow;
if (winCandidate == null && mTopFullscreenOpaqueWindowState != null
&& (mTopFullscreenOpaqueWindowState.mAttrs.flags
& WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE) == 0) {
// Only focusable window can take system bar control.
winCandidate = mTopFullscreenOpaqueWindowState;
}
// 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.
WindowState winCandidate = mFocusedWindow != null ? mFocusedWindow
: mTopFullscreenOpaqueWindowState;
if (winCandidate == null) {
return;
}