Skip to content

Commit dfb77bf

Browse files
author
Android Build Coastguard Worker
committed
Merge cherrypicks of ['googleplex-android-review.googlesource.com/22688474', 'googleplex-android-review.googlesource.com/22721990', 'googleplex-android-review.googlesource.com/22733606'] into sparse-9991837-L83700000960209120.
SPARSE_CHANGE: I2bfdc7801cec1b3aaa44f841d8a821214c6cb801 SPARSE_CHANGE: I35ba4652a125c8c83e18138f0fb0a51f3ef65b73 SPARSE_CHANGE: I1c51c6f66cd6967651068de1ffc2e6e8566f5a46 Change-Id: Ife0b57ca76f80fec4935b23edbd990355ef111a6
2 parents fc93b1e + 2023ade commit dfb77bf

6 files changed

Lines changed: 56 additions & 9 deletions

File tree

packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2843,6 +2843,7 @@ public void setHeadsUpAnimatingAway(boolean headsUpAnimatingAway) {
28432843
/** Set whether the bouncer is showing. */
28442844
public void setBouncerShowing(boolean bouncerShowing) {
28452845
mBouncerShowing = bouncerShowing;
2846+
mNotificationStackScrollLayoutController.updateShowEmptyShadeView();
28462847
updateVisibility();
28472848
}
28482849

packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1240,7 +1240,8 @@ public void updateShowEmptyShadeView() {
12401240
// Hide empty shade view when in transition to Keyguard.
12411241
// That avoids "No Notifications" to blink when transitioning to AOD.
12421242
// For more details, see: b/228790482
1243-
&& !isInTransitionToKeyguard();
1243+
&& !isInTransitionToKeyguard()
1244+
&& !mCentralSurfaces.isBouncerShowing();
12441245

12451246
mView.updateEmptyShadeView(shouldShow, mZenModeController.areNotificationsHiddenInShade());
12461247

packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/NotificationStackScrollLayoutControllerTest.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,34 @@ public void testUpdateEmptyShadeView_splitShadeMode_alwaysShowEmptyView() {
294294
/* notifVisibleInShade= */ false);
295295
}
296296

297+
@Test
298+
public void testUpdateEmptyShadeView_bouncerShowing_hideEmptyView() {
299+
when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
300+
initController(/* viewIsAttached= */ true);
301+
302+
when(mCentralSurfaces.isBouncerShowing()).thenReturn(true);
303+
setupShowEmptyShadeViewState(true);
304+
reset(mNotificationStackScrollLayout);
305+
mController.updateShowEmptyShadeView();
306+
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
307+
/* visible= */ false,
308+
/* areNotificationsHiddenInShade= */ false);
309+
}
310+
311+
@Test
312+
public void testUpdateEmptyShadeView_bouncerNotShowing_showEmptyView() {
313+
when(mZenModeController.areNotificationsHiddenInShade()).thenReturn(false);
314+
initController(/* viewIsAttached= */ true);
315+
316+
when(mCentralSurfaces.isBouncerShowing()).thenReturn(false);
317+
setupShowEmptyShadeViewState(true);
318+
reset(mNotificationStackScrollLayout);
319+
mController.updateShowEmptyShadeView();
320+
verify(mNotificationStackScrollLayout).updateEmptyShadeView(
321+
/* visible= */ true,
322+
/* areNotificationsHiddenInShade= */ false);
323+
}
324+
297325
@Test
298326
public void testOnUserChange_verifySensitiveProfile() {
299327
when(mNotificationLockscreenUserManager.isAnyProfilePublicMode()).thenReturn(true);

services/core/java/com/android/server/wm/DisplayPolicy.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
package com.android.server.wm;
1818

1919
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
20-
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
2120
import static android.view.Display.TYPE_INTERNAL;
2221
import static android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES;
2322
import static android.view.InsetsState.ITYPE_BOTTOM_TAPPABLE_ELEMENT;
@@ -2382,16 +2381,16 @@ int updateLightNavigationBarLw(int appearance, WindowState navColorWin) {
23822381

23832382
private int updateSystemBarsLw(WindowState win, int disableFlags) {
23842383
final TaskDisplayArea defaultTaskDisplayArea = mDisplayContent.getDefaultTaskDisplayArea();
2385-
final boolean multiWindowTaskVisible =
2384+
final boolean adjacentTasksVisible =
23862385
defaultTaskDisplayArea.getRootTask(task -> task.isVisible()
2387-
&& task.getTopLeafTask().getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW)
2386+
&& task.getAdjacentTask() != null)
23882387
!= null;
23892388
final boolean freeformRootTaskVisible =
23902389
defaultTaskDisplayArea.isRootTaskVisible(WINDOWING_MODE_FREEFORM);
23912390

23922391
// We need to force showing system bars when the multi-window or freeform root task is
23932392
// visible.
2394-
mForceShowSystemBars = multiWindowTaskVisible || freeformRootTaskVisible;
2393+
mForceShowSystemBars = adjacentTasksVisible || freeformRootTaskVisible;
23952394
// We need to force the consumption of the system bars if they are force shown or if they
23962395
// are controlled by a remote insets controller.
23972396
mForceConsumeSystemBars = mForceShowSystemBars
@@ -2412,7 +2411,7 @@ private int updateSystemBarsLw(WindowState win, int disableFlags) {
24122411

24132412
int appearance = APPEARANCE_OPAQUE_NAVIGATION_BARS | APPEARANCE_OPAQUE_STATUS_BARS;
24142413
appearance = configureStatusBarOpacity(appearance);
2415-
appearance = configureNavBarOpacity(appearance, multiWindowTaskVisible,
2414+
appearance = configureNavBarOpacity(appearance, adjacentTasksVisible,
24162415
freeformRootTaskVisible);
24172416

24182417
final boolean requestHideNavBar = !win.getRequestedVisibility(ITYPE_NAVIGATION_BAR);

services/core/java/com/android/server/wm/Task.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2385,6 +2385,22 @@ Task getCreatedByOrganizerTask() {
23852385
return parentTask == null ? null : parentTask.getCreatedByOrganizerTask();
23862386
}
23872387

2388+
/** @return the first adjacent task of this task or its parent. */
2389+
@Nullable
2390+
Task getAdjacentTask() {
2391+
final TaskFragment adjacentTaskFragment = getAdjacentTaskFragment();
2392+
if (adjacentTaskFragment != null && adjacentTaskFragment.asTask() != null) {
2393+
return adjacentTaskFragment.asTask();
2394+
}
2395+
2396+
final WindowContainer parent = getParent();
2397+
if (parent == null || parent.asTask() == null) {
2398+
return null;
2399+
}
2400+
2401+
return parent.asTask().getAdjacentTask();
2402+
}
2403+
23882404
// TODO(task-merge): Figure out what's the right thing to do for places that used it.
23892405
boolean isRootTask() {
23902406
return getRootTask() == this;

services/tests/wmtests/src/com/android/server/wm/InsetsPolicyTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ public void testControlsForDispatch_regular() {
8181
}
8282

8383
@Test
84-
public void testControlsForDispatch_multiWindowTaskVisible() {
84+
public void testControlsForDispatch_adjacentTasksVisible() {
8585
addWindow(TYPE_STATUS_BAR, "statusBar");
8686
addWindow(TYPE_NAVIGATION_BAR, "navBar");
8787

88-
final WindowState win = createWindow(null, WINDOWING_MODE_MULTI_WINDOW,
89-
ACTIVITY_TYPE_STANDARD, TYPE_APPLICATION, mDisplayContent, "app");
88+
final Task task1 = createTask(mDisplayContent);
89+
final Task task2 = createTask(mDisplayContent);
90+
task1.setAdjacentTaskFragment(task2);
91+
final WindowState win = createAppWindow(task1, WINDOWING_MODE_MULTI_WINDOW, "app");
9092
final InsetsSourceControl[] controls = addWindowAndGetControlsForDispatch(win);
9193

9294
// The app must not control any system bars.

0 commit comments

Comments
 (0)