Merge "Add a sysui state for manage menu being expanded" into sc-v2-dev
This commit is contained in:
@@ -120,8 +120,6 @@ public class BubbleStackView extends FrameLayout
|
|||||||
|
|
||||||
private static final int EXPANDED_VIEW_ALPHA_ANIMATION_DURATION = 150;
|
private static final int EXPANDED_VIEW_ALPHA_ANIMATION_DURATION = 150;
|
||||||
|
|
||||||
private static final int MANAGE_MENU_SCRIM_ANIM_DURATION = 150;
|
|
||||||
|
|
||||||
private static final float SCRIM_ALPHA = 0.6f;
|
private static final float SCRIM_ALPHA = 0.6f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -894,6 +892,7 @@ public class BubbleStackView extends FrameLayout
|
|||||||
updatePointerPosition(false /* forIme */);
|
updatePointerPosition(false /* forIme */);
|
||||||
mExpandedAnimationController.expandFromStack(() -> {
|
mExpandedAnimationController.expandFromStack(() -> {
|
||||||
afterExpandedViewAnimation();
|
afterExpandedViewAnimation();
|
||||||
|
showManageMenu(mShowingManage);
|
||||||
} /* after */);
|
} /* after */);
|
||||||
final float translationY = mPositioner.getExpandedViewY(mExpandedBubble,
|
final float translationY = mPositioner.getExpandedViewY(mExpandedBubble,
|
||||||
getBubbleIndex(mExpandedBubble));
|
getBubbleIndex(mExpandedBubble));
|
||||||
@@ -1253,9 +1252,6 @@ public class BubbleStackView extends FrameLayout
|
|||||||
mRelativeStackPositionBeforeRotation = new RelativeStackPosition(
|
mRelativeStackPositionBeforeRotation = new RelativeStackPosition(
|
||||||
mPositioner.getRestingPosition(),
|
mPositioner.getRestingPosition(),
|
||||||
mStackAnimationController.getAllowableStackPositionRegion());
|
mStackAnimationController.getAllowableStackPositionRegion());
|
||||||
mManageMenu.setVisibility(View.INVISIBLE);
|
|
||||||
mShowingManage = false;
|
|
||||||
|
|
||||||
addOnLayoutChangeListener(mOrientationChangedListener);
|
addOnLayoutChangeListener(mOrientationChangedListener);
|
||||||
hideFlyoutImmediate();
|
hideFlyoutImmediate();
|
||||||
}
|
}
|
||||||
@@ -2555,16 +2551,19 @@ public class BubbleStackView extends FrameLayout
|
|||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showManageMenu(boolean show) {
|
/** Hide or show the manage menu for the currently expanded bubble. */
|
||||||
|
@VisibleForTesting
|
||||||
|
public void showManageMenu(boolean show) {
|
||||||
mShowingManage = show;
|
mShowingManage = show;
|
||||||
|
|
||||||
// This should not happen, since the manage menu is only visible when there's an expanded
|
// This should not happen, since the manage menu is only visible when there's an expanded
|
||||||
// bubble. If we end up in this state, just hide the menu immediately.
|
// bubble. If we end up in this state, just hide the menu immediately.
|
||||||
if (mExpandedBubble == null || mExpandedBubble.getExpandedView() == null) {
|
if (mExpandedBubble == null || mExpandedBubble.getExpandedView() == null) {
|
||||||
mManageMenu.setVisibility(View.INVISIBLE);
|
mManageMenu.setVisibility(View.INVISIBLE);
|
||||||
|
mManageMenuScrim.setVisibility(INVISIBLE);
|
||||||
|
mBubbleController.getSysuiProxy().onManageMenuExpandChanged(false /* show */);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (show) {
|
if (show) {
|
||||||
mManageMenuScrim.setVisibility(VISIBLE);
|
mManageMenuScrim.setVisibility(VISIBLE);
|
||||||
mManageMenuScrim.setTranslationZ(mManageMenu.getElevation() - 1f);
|
mManageMenuScrim.setTranslationZ(mManageMenu.getElevation() - 1f);
|
||||||
@@ -2576,8 +2575,8 @@ public class BubbleStackView extends FrameLayout
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mBubbleController.getSysuiProxy().onManageMenuExpandChanged(show);
|
||||||
mManageMenuScrim.animate()
|
mManageMenuScrim.animate()
|
||||||
.setDuration(MANAGE_MENU_SCRIM_ANIM_DURATION)
|
|
||||||
.setInterpolator(show ? ALPHA_IN : ALPHA_OUT)
|
.setInterpolator(show ? ALPHA_IN : ALPHA_OUT)
|
||||||
.alpha(show ? SCRIM_ALPHA : 0f)
|
.alpha(show ? SCRIM_ALPHA : 0f)
|
||||||
.withEndAction(endAction)
|
.withEndAction(endAction)
|
||||||
|
|||||||
@@ -284,6 +284,8 @@ public interface Bubbles {
|
|||||||
|
|
||||||
void onStackExpandChanged(boolean shouldExpand);
|
void onStackExpandChanged(boolean shouldExpand);
|
||||||
|
|
||||||
|
void onManageMenuExpandChanged(boolean menuExpanded);
|
||||||
|
|
||||||
void onUnbubbleConversation(String key);
|
void onUnbubbleConversation(String key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ public class QuickStepContract {
|
|||||||
public static final int SYSUI_STATE_DEVICE_DOZING = 1 << 21;
|
public static final int SYSUI_STATE_DEVICE_DOZING = 1 << 21;
|
||||||
// The home feature is disabled (either by SUW/SysUI/device policy)
|
// The home feature is disabled (either by SUW/SysUI/device policy)
|
||||||
public static final int SYSUI_STATE_BACK_DISABLED = 1 << 22;
|
public static final int SYSUI_STATE_BACK_DISABLED = 1 << 22;
|
||||||
|
// The bubble stack is expanded AND the mange menu for bubbles is expanded on top of it.
|
||||||
|
public static final int SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED = 1 << 23;
|
||||||
|
|
||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
@IntDef({SYSUI_STATE_SCREEN_PINNING,
|
@IntDef({SYSUI_STATE_SCREEN_PINNING,
|
||||||
@@ -142,7 +144,8 @@ public class QuickStepContract {
|
|||||||
SYSUI_STATE_MAGNIFICATION_OVERLAP,
|
SYSUI_STATE_MAGNIFICATION_OVERLAP,
|
||||||
SYSUI_STATE_IME_SWITCHER_SHOWING,
|
SYSUI_STATE_IME_SWITCHER_SHOWING,
|
||||||
SYSUI_STATE_DEVICE_DOZING,
|
SYSUI_STATE_DEVICE_DOZING,
|
||||||
SYSUI_STATE_BACK_DISABLED
|
SYSUI_STATE_BACK_DISABLED,
|
||||||
|
SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED
|
||||||
})
|
})
|
||||||
public @interface SystemUiStateFlags {}
|
public @interface SystemUiStateFlags {}
|
||||||
|
|
||||||
@@ -174,6 +177,8 @@ public class QuickStepContract {
|
|||||||
str.add((flags & SYSUI_STATE_IME_SWITCHER_SHOWING) != 0 ? "ime_switcher_showing" : "");
|
str.add((flags & SYSUI_STATE_IME_SWITCHER_SHOWING) != 0 ? "ime_switcher_showing" : "");
|
||||||
str.add((flags & SYSUI_STATE_DEVICE_DOZING) != 0 ? "device_dozing" : "");
|
str.add((flags & SYSUI_STATE_DEVICE_DOZING) != 0 ? "device_dozing" : "");
|
||||||
str.add((flags & SYSUI_STATE_BACK_DISABLED) != 0 ? "back_disabled" : "");
|
str.add((flags & SYSUI_STATE_BACK_DISABLED) != 0 ? "back_disabled" : "");
|
||||||
|
str.add((flags & SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0
|
||||||
|
? "bubbles_mange_menu_expanded" : "");
|
||||||
return str.toString();
|
return str.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -377,9 +377,23 @@ public class BubblesManager implements Dumpable {
|
|||||||
sysuiMainExecutor.execute(() -> {
|
sysuiMainExecutor.execute(() -> {
|
||||||
sysUiState.setFlag(QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED, shouldExpand)
|
sysUiState.setFlag(QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED, shouldExpand)
|
||||||
.commitUpdate(mContext.getDisplayId());
|
.commitUpdate(mContext.getDisplayId());
|
||||||
|
if (!shouldExpand) {
|
||||||
|
sysUiState.setFlag(
|
||||||
|
QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED,
|
||||||
|
false).commitUpdate(mContext.getDisplayId());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onManageMenuExpandChanged(boolean menuExpanded) {
|
||||||
|
sysuiMainExecutor.execute(() -> {
|
||||||
|
sysUiState.setFlag(QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED,
|
||||||
|
menuExpanded).commitUpdate(mContext.getDisplayId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUnbubbleConversation(String key) {
|
public void onUnbubbleConversation(String key) {
|
||||||
sysuiMainExecutor.execute(() -> {
|
sysuiMainExecutor.execute(() -> {
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static android.view.Display.DEFAULT_DISPLAY;
|
|||||||
|
|
||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BOUNCER_SHOWING;
|
||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED;
|
||||||
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED;
|
||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_GLOBAL_ACTIONS_SHOWING;
|
||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
|
||||||
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE;
|
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_ONE_HANDED_ACTIVE;
|
||||||
@@ -101,6 +102,7 @@ public final class WMShell extends SystemUI
|
|||||||
| SYSUI_STATE_BOUNCER_SHOWING
|
| SYSUI_STATE_BOUNCER_SHOWING
|
||||||
| SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
| SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED
|
||||||
| SYSUI_STATE_BUBBLES_EXPANDED
|
| SYSUI_STATE_BUBBLES_EXPANDED
|
||||||
|
| SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED
|
||||||
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
| SYSUI_STATE_QUICK_SETTINGS_EXPANDED;
|
||||||
|
|
||||||
// Shell interfaces
|
// Shell interfaces
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
|
|
||||||
private SysUiState mSysUiState;
|
private SysUiState mSysUiState;
|
||||||
private boolean mSysUiStateBubblesExpanded;
|
private boolean mSysUiStateBubblesExpanded;
|
||||||
|
private boolean mSysUiStateBubblesManageMenuExpanded;
|
||||||
|
|
||||||
@Captor
|
@Captor
|
||||||
private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor;
|
private ArgumentCaptor<NotificationEntryListener> mEntryListenerCaptor;
|
||||||
@@ -295,9 +296,13 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
when(mZenModeController.getConfig()).thenReturn(mZenModeConfig);
|
when(mZenModeController.getConfig()).thenReturn(mZenModeConfig);
|
||||||
|
|
||||||
mSysUiState = new SysUiState();
|
mSysUiState = new SysUiState();
|
||||||
mSysUiState.addCallback(sysUiFlags ->
|
mSysUiState.addCallback(sysUiFlags -> {
|
||||||
mSysUiStateBubblesExpanded =
|
mSysUiStateBubblesManageMenuExpanded =
|
||||||
(sysUiFlags & QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED) != 0);
|
(sysUiFlags
|
||||||
|
& QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0;
|
||||||
|
mSysUiStateBubblesExpanded =
|
||||||
|
(sysUiFlags & QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED) != 0;
|
||||||
|
});
|
||||||
|
|
||||||
// TODO: Fix
|
// TODO: Fix
|
||||||
mPositioner = new TestableBubblePositioner(mContext, mWindowManager);
|
mPositioner = new TestableBubblePositioner(mContext, mWindowManager);
|
||||||
@@ -372,8 +377,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
public void testAddBubble() {
|
public void testAddBubble() {
|
||||||
mBubbleController.updateBubble(mBubbleEntry);
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -381,7 +385,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
assertFalse(mBubbleController.hasBubbles());
|
assertFalse(mBubbleController.hasBubbles());
|
||||||
mBubbleController.updateBubble(mBubbleEntry);
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -396,7 +400,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
||||||
verify(mNotificationEntryManager, times(2)).updateNotifications(anyString());
|
verify(mNotificationEntryManager, times(2)).updateNotifications(anyString());
|
||||||
|
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -459,7 +463,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
verify(mNotificationEntryManager, never()).performRemoveNotification(
|
verify(mNotificationEntryManager, never()).performRemoveNotification(
|
||||||
eq(mRow.getSbn()), any(), anyInt());
|
eq(mRow.getSbn()), any(), anyInt());
|
||||||
assertFalse(mBubbleController.hasBubbles());
|
assertFalse(mBubbleController.hasBubbles());
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertTrue(mRow.isBubble());
|
assertTrue(mRow.isBubble());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,7 +482,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
||||||
assertNull(mBubbleData.getBubbleInStackWithKey(mRow2.getKey()));
|
assertNull(mBubbleData.getBubbleInStackWithKey(mRow2.getKey()));
|
||||||
|
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -498,8 +502,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
|
||||||
|
|
||||||
// Make sure the notif is suppressed
|
// Make sure the notif is suppressed
|
||||||
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
||||||
@@ -508,8 +511,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
mBubbleController.collapseStack();
|
mBubbleController.collapseStack();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
||||||
assertStackCollapsed();
|
assertStackCollapsed();
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -532,8 +534,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener, atLeastOnce()).onBubbleExpandChanged(
|
verify(mBubbleExpandListener, atLeastOnce()).onBubbleExpandChanged(
|
||||||
true, mRow2.getKey());
|
true, mRow2.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
|
||||||
|
|
||||||
// Last added is the one that is expanded
|
// Last added is the one that is expanded
|
||||||
assertEquals(mRow2.getKey(), mBubbleData.getSelectedBubble().getKey());
|
assertEquals(mRow2.getKey(), mBubbleData.getSelectedBubble().getKey());
|
||||||
@@ -557,8 +558,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
// Collapse
|
// Collapse
|
||||||
mBubbleController.collapseStack();
|
mBubbleController.collapseStack();
|
||||||
assertStackCollapsed();
|
assertStackCollapsed();
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -578,8 +578,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
|
||||||
|
|
||||||
// Notif is suppressed after expansion
|
// Notif is suppressed after expansion
|
||||||
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
||||||
@@ -604,8 +603,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
|
||||||
|
|
||||||
// Notif is suppressed after expansion
|
// Notif is suppressed after expansion
|
||||||
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
||||||
@@ -634,7 +632,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
BubbleStackView stackView = mBubbleController.getStackView();
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
|
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getKey());
|
||||||
@@ -666,7 +664,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
assertEquals(mBubbleData.getSelectedBubble().getKey(), BubbleOverflow.KEY);
|
assertEquals(mBubbleData.getSelectedBubble().getKey(), BubbleOverflow.KEY);
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, BubbleOverflow.KEY);
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, BubbleOverflow.KEY);
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -679,7 +677,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
BubbleStackView stackView = mBubbleController.getStackView();
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
|
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
|
||||||
@@ -694,7 +692,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
// We should be collapsed
|
// We should be collapsed
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
||||||
assertFalse(mBubbleController.hasBubbles());
|
assertFalse(mBubbleController.hasBubbles());
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -711,8 +709,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
|
verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
|
||||||
mRow.getKey());
|
mRow.getKey());
|
||||||
assertStackCollapsed();
|
assertStackCollapsed();
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -728,8 +725,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
|
||||||
mRow.getKey());
|
mRow.getKey());
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -746,8 +742,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
// Dot + flyout is hidden because notif is suppressed
|
// Dot + flyout is hidden because notif is suppressed
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -769,8 +764,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
// Dot + flyout is hidden because notif is suppressed
|
// Dot + flyout is hidden because notif is suppressed
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertFalse(mSysUiStateBubblesExpanded);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -784,7 +778,7 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
|
|
||||||
mBubbleController.expandStackAndSelectBubble(mBubbleEntry);
|
mBubbleController.expandStackAndSelectBubble(mBubbleEntry);
|
||||||
|
|
||||||
assertTrue(mSysUiStateBubblesExpanded);
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -1206,6 +1200,63 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
assertNotNull(info);
|
assertNotNull(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testShowManageMenuChangesSysuiState() {
|
||||||
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
|
// Expand the stack
|
||||||
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
|
mBubbleData.setExpanded(true);
|
||||||
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Show the menu
|
||||||
|
stackView.showManageMenu(true);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHideManageMenuChangesSysuiState() {
|
||||||
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
|
// Expand the stack
|
||||||
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
|
mBubbleData.setExpanded(true);
|
||||||
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Show the menu
|
||||||
|
stackView.showManageMenu(true);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Hide the menu
|
||||||
|
stackView.showManageMenu(false);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCollapseBubbleManageMenuChangesSysuiState() {
|
||||||
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
|
// Expand the stack
|
||||||
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
|
mBubbleData.setExpanded(true);
|
||||||
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Show the menu
|
||||||
|
stackView.showManageMenu(true);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Collapse the stack
|
||||||
|
mBubbleData.setExpanded(false);
|
||||||
|
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
}
|
||||||
|
|
||||||
/** Creates a bubble using the userId and package. */
|
/** Creates a bubble using the userId and package. */
|
||||||
private Bubble createBubble(int userId, String pkg) {
|
private Bubble createBubble(int userId, String pkg) {
|
||||||
final UserHandle userHandle = new UserHandle(userId);
|
final UserHandle userHandle = new UserHandle(userId);
|
||||||
@@ -1303,4 +1354,12 @@ public class BubblesTest extends SysuiTestCase {
|
|||||||
assertFalse(mBubbleController.getImplCachedState().isBubbleNotificationSuppressedFromShade(
|
assertFalse(mBubbleController.getImplCachedState().isBubbleNotificationSuppressedFromShade(
|
||||||
entry.getKey(), entry.getGroupKey()));
|
entry.getKey(), entry.getGroupKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the system ui states associated to bubbles are in the correct state.
|
||||||
|
*/
|
||||||
|
private void assertSysuiStates(boolean stackExpanded, boolean manageMenuExpanded) {
|
||||||
|
assertThat(mSysUiStateBubblesExpanded).isEqualTo(stackExpanded);
|
||||||
|
assertThat(mSysUiStateBubblesManageMenuExpanded).isEqualTo(manageMenuExpanded);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ import com.android.systemui.flags.FeatureFlags;
|
|||||||
import com.android.systemui.keyguard.KeyguardViewMediator;
|
import com.android.systemui.keyguard.KeyguardViewMediator;
|
||||||
import com.android.systemui.model.SysUiState;
|
import com.android.systemui.model.SysUiState;
|
||||||
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
||||||
|
import com.android.systemui.shared.system.QuickStepContract;
|
||||||
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
import com.android.systemui.statusbar.NotificationLockscreenUserManager;
|
||||||
import com.android.systemui.statusbar.RankingBuilder;
|
import com.android.systemui.statusbar.RankingBuilder;
|
||||||
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
import com.android.systemui.statusbar.SysuiStatusBarStateController;
|
||||||
@@ -160,7 +161,9 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
@Mock
|
@Mock
|
||||||
private AuthController mAuthController;
|
private AuthController mAuthController;
|
||||||
|
|
||||||
private SysUiState mSysUiState = new SysUiState();
|
private SysUiState mSysUiState;
|
||||||
|
private boolean mSysUiStateBubblesExpanded;
|
||||||
|
private boolean mSysUiStateBubblesManageMenuExpanded;
|
||||||
|
|
||||||
@Captor
|
@Captor
|
||||||
private ArgumentCaptor<NotifCollectionListener> mNotifListenerCaptor;
|
private ArgumentCaptor<NotifCollectionListener> mNotifListenerCaptor;
|
||||||
@@ -257,6 +260,15 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
mZenModeConfig.suppressedVisualEffects = 0;
|
mZenModeConfig.suppressedVisualEffects = 0;
|
||||||
when(mZenModeController.getConfig()).thenReturn(mZenModeConfig);
|
when(mZenModeController.getConfig()).thenReturn(mZenModeConfig);
|
||||||
|
|
||||||
|
mSysUiState = new SysUiState();
|
||||||
|
mSysUiState.addCallback(sysUiFlags -> {
|
||||||
|
mSysUiStateBubblesManageMenuExpanded =
|
||||||
|
(sysUiFlags
|
||||||
|
& QuickStepContract.SYSUI_STATE_BUBBLES_MANAGE_MENU_EXPANDED) != 0;
|
||||||
|
mSysUiStateBubblesExpanded =
|
||||||
|
(sysUiFlags & QuickStepContract.SYSUI_STATE_BUBBLES_EXPANDED) != 0;
|
||||||
|
});
|
||||||
|
|
||||||
mPositioner = new TestableBubblePositioner(mContext, mWindowManager);
|
mPositioner = new TestableBubblePositioner(mContext, mWindowManager);
|
||||||
mPositioner.setMaxBubbles(5);
|
mPositioner.setMaxBubbles(5);
|
||||||
mBubbleData = new BubbleData(mContext, mBubbleLogger, mPositioner, syncExecutor);
|
mBubbleData = new BubbleData(mContext, mBubbleLogger, mPositioner, syncExecutor);
|
||||||
@@ -325,6 +337,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
public void testAddBubble() {
|
public void testAddBubble() {
|
||||||
mBubbleController.updateBubble(mBubbleEntry);
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -332,6 +345,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
assertFalse(mBubbleController.hasBubbles());
|
assertFalse(mBubbleController.hasBubbles());
|
||||||
mBubbleController.updateBubble(mBubbleEntry);
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -345,6 +359,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
mRow.getKey(), Bubbles.DISMISS_USER_GESTURE);
|
mRow.getKey(), Bubbles.DISMISS_USER_GESTURE);
|
||||||
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
||||||
verify(mNotifCallback, times(2)).invalidateNotifications(anyString());
|
verify(mNotifCallback, times(2)).invalidateNotifications(anyString());
|
||||||
|
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -407,6 +423,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
verify(mNotifCallback, times(3)).invalidateNotifications(anyString());
|
verify(mNotifCallback, times(3)).invalidateNotifications(anyString());
|
||||||
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
assertNull(mBubbleData.getBubbleInStackWithKey(mRow.getKey()));
|
||||||
assertNull(mBubbleData.getBubbleInStackWithKey(mRow2.getKey()));
|
assertNull(mBubbleData.getBubbleInStackWithKey(mRow2.getKey()));
|
||||||
|
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -425,6 +443,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
// Make sure the notif is suppressed
|
// Make sure the notif is suppressed
|
||||||
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
||||||
@@ -433,6 +452,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
mBubbleController.collapseStack();
|
mBubbleController.collapseStack();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
||||||
assertStackCollapsed();
|
assertStackCollapsed();
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -455,6 +475,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener, atLeastOnce()).onBubbleExpandChanged(
|
verify(mBubbleExpandListener, atLeastOnce()).onBubbleExpandChanged(
|
||||||
true, mRow2.getKey());
|
true, mRow2.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
// Last added is the one that is expanded
|
// Last added is the one that is expanded
|
||||||
assertEquals(mRow2.getKey(), mBubbleData.getSelectedBubble().getKey());
|
assertEquals(mRow2.getKey(), mBubbleData.getSelectedBubble().getKey());
|
||||||
@@ -479,6 +500,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
// Collapse
|
// Collapse
|
||||||
mBubbleController.collapseStack();
|
mBubbleController.collapseStack();
|
||||||
assertStackCollapsed();
|
assertStackCollapsed();
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -498,6 +520,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
// Notif is suppressed after expansion
|
// Notif is suppressed after expansion
|
||||||
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
||||||
@@ -522,6 +545,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
// Notif is suppressed after expansion
|
// Notif is suppressed after expansion
|
||||||
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
assertBubbleNotificationSuppressedFromShade(mBubbleEntry);
|
||||||
@@ -550,6 +574,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
BubbleStackView stackView = mBubbleController.getStackView();
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
|
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow2.getKey());
|
||||||
|
|
||||||
@@ -580,6 +606,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
assertEquals(mBubbleData.getSelectedBubble().getKey(), BubbleOverflow.KEY);
|
assertEquals(mBubbleData.getSelectedBubble().getKey(), BubbleOverflow.KEY);
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, BubbleOverflow.KEY);
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, BubbleOverflow.KEY);
|
||||||
assertTrue(mBubbleController.hasBubbles());
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -592,6 +619,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
BubbleStackView stackView = mBubbleController.getStackView();
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
mBubbleData.setExpanded(true);
|
mBubbleData.setExpanded(true);
|
||||||
|
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true, mRow.getKey());
|
||||||
|
|
||||||
@@ -606,6 +634,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
// We should be collapsed
|
// We should be collapsed
|
||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
verify(mBubbleExpandListener).onBubbleExpandChanged(false, mRow.getKey());
|
||||||
assertFalse(mBubbleController.hasBubbles());
|
assertFalse(mBubbleController.hasBubbles());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -623,6 +652,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
|
verify(mBubbleExpandListener, never()).onBubbleExpandChanged(false /* expanded */,
|
||||||
mRow.getKey());
|
mRow.getKey());
|
||||||
assertStackCollapsed();
|
assertStackCollapsed();
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -638,6 +668,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
|
verify(mBubbleExpandListener).onBubbleExpandChanged(true /* expanded */,
|
||||||
mRow.getKey());
|
mRow.getKey());
|
||||||
assertStackExpanded();
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -654,6 +685,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
// Dot + flyout is hidden because notif is suppressed
|
// Dot + flyout is hidden because notif is suppressed
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -675,6 +707,7 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
// Dot + flyout is hidden because notif is suppressed
|
// Dot + flyout is hidden because notif is suppressed
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showDot());
|
||||||
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
assertFalse(mBubbleData.getBubbleInStackWithKey(mRow.getKey()).showFlyout());
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -980,6 +1013,63 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
verify(mDataRepository, times(1)).loadBubbles(anyInt(), any());
|
verify(mDataRepository, times(1)).loadBubbles(anyInt(), any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testShowManageMenuChangesSysuiState() {
|
||||||
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
|
// Expand the stack
|
||||||
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
|
mBubbleData.setExpanded(true);
|
||||||
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Show the menu
|
||||||
|
stackView.showManageMenu(true);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHideManageMenuChangesSysuiState() {
|
||||||
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
|
// Expand the stack
|
||||||
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
|
mBubbleData.setExpanded(true);
|
||||||
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Show the menu
|
||||||
|
stackView.showManageMenu(true);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Hide the menu
|
||||||
|
stackView.showManageMenu(false);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCollapseBubbleManageMenuChangesSysuiState() {
|
||||||
|
mBubbleController.updateBubble(mBubbleEntry);
|
||||||
|
assertTrue(mBubbleController.hasBubbles());
|
||||||
|
|
||||||
|
// Expand the stack
|
||||||
|
BubbleStackView stackView = mBubbleController.getStackView();
|
||||||
|
mBubbleData.setExpanded(true);
|
||||||
|
assertStackExpanded();
|
||||||
|
assertSysuiStates(true /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Show the menu
|
||||||
|
stackView.showManageMenu(true);
|
||||||
|
assertSysuiStates(true /* stackExpanded */, true /* mangeMenuExpanded */);
|
||||||
|
|
||||||
|
// Collapse the stack
|
||||||
|
mBubbleData.setExpanded(false);
|
||||||
|
|
||||||
|
assertSysuiStates(false /* stackExpanded */, false /* mangeMenuExpanded */);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the bubble metadata flags for this entry. These flags are normally set by
|
* Sets the bubble metadata flags for this entry. These flags are normally set by
|
||||||
* NotificationManagerService when the notification is sent, however, these tests do not
|
* NotificationManagerService when the notification is sent, however, these tests do not
|
||||||
@@ -1034,4 +1124,12 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
|
|||||||
assertFalse(mBubbleController.getImplCachedState().isBubbleNotificationSuppressedFromShade(
|
assertFalse(mBubbleController.getImplCachedState().isBubbleNotificationSuppressedFromShade(
|
||||||
entry.getKey(), entry.getGroupKey()));
|
entry.getKey(), entry.getGroupKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Asserts that the system ui states associated to bubbles are in the correct state.
|
||||||
|
*/
|
||||||
|
private void assertSysuiStates(boolean stackExpanded, boolean manageMenuExpanded) {
|
||||||
|
assertThat(mSysUiStateBubblesExpanded).isEqualTo(stackExpanded);
|
||||||
|
assertThat(mSysUiStateBubblesManageMenuExpanded).isEqualTo(manageMenuExpanded);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user