Suppress transient bars over dreams.
This changelist prevents transient bars over dream windows.
This allows for suppressing these UI elements when other swipe
affordances are provided by the SystemUI.
Bug: 267565290
Test: atest DisplayPolicyTests#testTransientBarsSuppressedOnDreams
Test: manual: swipe up and down from edges of device on a dream
and observe now transient bars
Change-Id: I5be342ed21174ff6e2c2cf87cea6202773e5f51a
This commit is contained in:
@@ -1981,6 +1981,14 @@ public class DisplayPolicy {
|
||||
return;
|
||||
}
|
||||
|
||||
if (controlTarget != null) {
|
||||
final WindowState win = controlTarget.getWindow();
|
||||
|
||||
if (win != null && win.isActivityTypeDream()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final @InsetsType int restorePositionTypes = (Type.statusBars() | Type.navigationBars())
|
||||
& controlTarget.getRequestedVisibleTypes();
|
||||
|
||||
|
||||
@@ -81,6 +81,17 @@ public class DisplayPolicyTests extends WindowTestsBase {
|
||||
return win;
|
||||
}
|
||||
|
||||
private WindowState createDreamWindow() {
|
||||
final WindowState win = createDreamWindow(null, TYPE_BASE_APPLICATION, "dream");
|
||||
final WindowManager.LayoutParams attrs = win.mAttrs;
|
||||
attrs.width = MATCH_PARENT;
|
||||
attrs.height = MATCH_PARENT;
|
||||
attrs.flags =
|
||||
FLAG_LAYOUT_IN_SCREEN | FLAG_LAYOUT_INSET_DECOR | FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
|
||||
attrs.format = PixelFormat.OPAQUE;
|
||||
return win;
|
||||
}
|
||||
|
||||
private WindowState createDimmingDialogWindow(boolean canBeImTarget) {
|
||||
final WindowState win = spy(createWindow(null, TYPE_APPLICATION, "dimmingDialog"));
|
||||
final WindowManager.LayoutParams attrs = win.mAttrs;
|
||||
@@ -384,4 +395,25 @@ public class DisplayPolicyTests extends WindowTestsBase {
|
||||
displayPolicy.requestTransientBars(mNavBarWindow, true);
|
||||
assertTrue(mDisplayContent.getInsetsPolicy().isTransient(navigationBars()));
|
||||
}
|
||||
|
||||
@UseTestDisplay(addWindows = { W_NAVIGATION_BAR })
|
||||
@Test
|
||||
public void testTransientBarsSuppressedOnDreams() {
|
||||
final WindowState win = createDreamWindow();
|
||||
|
||||
((TestWindowManagerPolicy) mWm.mPolicy).mIsUserSetupComplete = true;
|
||||
win.mAttrs.insetsFlags.behavior = BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
|
||||
win.setRequestedVisibleTypes(0, navigationBars());
|
||||
|
||||
final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy();
|
||||
displayPolicy.addWindowLw(mNavBarWindow, mNavBarWindow.mAttrs);
|
||||
final InsetsSourceProvider navBarProvider = mNavBarWindow.getControllableInsetProvider();
|
||||
navBarProvider.updateControlForTarget(win, false);
|
||||
navBarProvider.getSource().setVisible(false);
|
||||
|
||||
displayPolicy.setCanSystemBarsBeShownByUser(true);
|
||||
displayPolicy.requestTransientBars(mNavBarWindow, true);
|
||||
|
||||
assertFalse(mDisplayContent.getInsetsPolicy().isTransient(navigationBars()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.app.AppOpsManager.OP_NONE;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
|
||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
|
||||
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||
@@ -467,6 +468,12 @@ class WindowTestsBase extends SystemServiceTestsBase {
|
||||
return createWindow(null, type, activity, name);
|
||||
}
|
||||
|
||||
WindowState createDreamWindow(WindowState parent, int type, String name) {
|
||||
final WindowToken token = createWindowToken(
|
||||
mDisplayContent, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_DREAM, type);
|
||||
return createWindow(parent, type, token, name);
|
||||
}
|
||||
|
||||
// TODO: Move these calls to a builder?
|
||||
WindowState createWindow(WindowState parent, int type, DisplayContent dc, String name,
|
||||
IWindow iwindow) {
|
||||
|
||||
Reference in New Issue
Block a user