Prevent force showing system bars for TaskView
Update the condition of force showing system bars to check adjacent tasks instead of checking multi-window windowing mode so it can distinguish from TaskView. Bug: 273495037 Test: atest TaskDisplayAreaTests DisplayPolicyTests InsetsPolicyTest Change-Id: I1c51c6f66cd6967651068de1ffc2e6e8566f5a46 Merged-In: Ibc056d4ac1fae7aa82001d815090a5be2cb703e9
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
package com.android.server.wm;
|
||||
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
|
||||
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
|
||||
import static android.view.Display.TYPE_INTERNAL;
|
||||
import static android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES;
|
||||
import static android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT;
|
||||
@@ -2382,16 +2381,16 @@ public class DisplayPolicy {
|
||||
|
||||
private int updateSystemBarsLw(WindowState win, int disableFlags) {
|
||||
final TaskDisplayArea defaultTaskDisplayArea = mDisplayContent.getDefaultTaskDisplayArea();
|
||||
final boolean multiWindowTaskVisible =
|
||||
final boolean adjacentTasksVisible =
|
||||
defaultTaskDisplayArea.getRootTask(task -> task.isVisible()
|
||||
&& task.getTopLeafTask().getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW)
|
||||
&& task.getAdjacentTask() != null)
|
||||
!= null;
|
||||
final boolean freeformRootTaskVisible =
|
||||
defaultTaskDisplayArea.isRootTaskVisible(WINDOWING_MODE_FREEFORM);
|
||||
|
||||
// We need to force showing system bars when the multi-window or freeform root task is
|
||||
// visible.
|
||||
mForceShowSystemBars = multiWindowTaskVisible || freeformRootTaskVisible;
|
||||
mForceShowSystemBars = adjacentTasksVisible || freeformRootTaskVisible;
|
||||
// We need to force the consumption of the system bars if they are force shown or if they
|
||||
// are controlled by a remote insets controller.
|
||||
mForceConsumeSystemBars = mForceShowSystemBars
|
||||
@@ -2412,7 +2411,7 @@ public class DisplayPolicy {
|
||||
|
||||
int appearance = APPEARANCE_OPAQUE_NAVIGATION_BARS | APPEARANCE_OPAQUE_STATUS_BARS;
|
||||
appearance = configureStatusBarOpacity(appearance);
|
||||
appearance = configureNavBarOpacity(appearance, multiWindowTaskVisible,
|
||||
appearance = configureNavBarOpacity(appearance, adjacentTasksVisible,
|
||||
freeformRootTaskVisible);
|
||||
|
||||
final boolean requestHideNavBar = !win.getRequestedVisibility(ITYPE_NAVIGATION_BAR);
|
||||
|
||||
@@ -2385,6 +2385,22 @@ class Task extends TaskFragment {
|
||||
return parentTask == null ? null : parentTask.getCreatedByOrganizerTask();
|
||||
}
|
||||
|
||||
/** @return the first adjacent task of this task or its parent. */
|
||||
@Nullable
|
||||
Task getAdjacentTask() {
|
||||
final TaskFragment adjacentTaskFragment = getAdjacentTaskFragment();
|
||||
if (adjacentTaskFragment != null && adjacentTaskFragment.asTask() != null) {
|
||||
return adjacentTaskFragment.asTask();
|
||||
}
|
||||
|
||||
final WindowContainer parent = getParent();
|
||||
if (parent == null || parent.asTask() == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return parent.asTask().getAdjacentTask();
|
||||
}
|
||||
|
||||
// TODO(task-merge): Figure out what's the right thing to do for places that used it.
|
||||
boolean isRootTask() {
|
||||
return getRootTask() == this;
|
||||
|
||||
@@ -81,12 +81,14 @@ public class InsetsPolicyTest extends WindowTestsBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testControlsForDispatch_multiWindowTaskVisible() {
|
||||
public void testControlsForDispatch_adjacentTasksVisible() {
|
||||
addWindow(TYPE_STATUS_BAR, "statusBar");
|
||||
addWindow(TYPE_NAVIGATION_BAR, "navBar");
|
||||
|
||||
final WindowState win = createWindow(null, WINDOWING_MODE_MULTI_WINDOW,
|
||||
ACTIVITY_TYPE_STANDARD, TYPE_APPLICATION, mDisplayContent, "app");
|
||||
final Task task1 = createTask(mDisplayContent);
|
||||
final Task task2 = createTask(mDisplayContent);
|
||||
task1.setAdjacentTaskFragment(task2);
|
||||
final WindowState win = createAppWindow(task1, WINDOWING_MODE_MULTI_WINDOW, "app");
|
||||
final InsetsSourceControl[] controls = addWindowAndGetControlsForDispatch(win);
|
||||
|
||||
// The app must not control any system bars.
|
||||
|
||||
Reference in New Issue
Block a user