Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +6 −0 Original line number Diff line number Diff line Loading @@ -1551,6 +1551,12 @@ public class BubbleController implements ConfigurationChangeListener, Log.w(TAG, "Tried to add a bubble to the stack but the stack is null"); } }; } else if (mBubbleData.isExpanded() && mBubbleData.getSelectedBubble() != null) { callback = b -> { if (b.getKey().equals(mBubbleData.getSelectedBubbleKey())) { mLayerView.showExpandedView(b); } }; } for (int i = mBubbleData.getBubbles().size() - 1; i >= 0; i--) { Bubble bubble = mBubbleData.getBubbles().get(i); Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +5 −1 Original line number Diff line number Diff line Loading @@ -256,11 +256,15 @@ public class BubbleData { } /** * Returns a bubble bar update populated with the current list of active bubbles. * Returns a bubble bar update populated with the current list of active bubbles, expanded, * and selected state. */ public BubbleBarUpdate getInitialStateForBubbleBar() { BubbleBarUpdate initialState = mStateChange.getInitialState(); initialState.bubbleBarLocation = mPositioner.getBubbleBarLocation(); initialState.expanded = mExpanded; initialState.expandedChanged = mExpanded; // only matters if we're expanded initialState.selectedBubbleKey = getSelectedBubbleKey(); return initialState; } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -1203,6 +1203,25 @@ public class BubbleDataTest extends ShellTestCase { assertThat(update.currentBubbleList.get(0).getKey()).isEqualTo(mEntryA2.getKey()); assertThat(update.currentBubbleList.get(1).getKey()).isEqualTo(mEntryA1.getKey()); assertThat(update.bubbleBarLocation).isEqualTo(BubbleBarLocation.LEFT); assertThat(update.expandedChanged).isFalse(); assertThat(update.selectedBubbleKey).isEqualTo(mEntryA2.getKey()); } @Test public void test_getInitialStateForBubbleBar_includesExpandedState() { sendUpdatedEntryAtTime(mEntryA1, 1000); sendUpdatedEntryAtTime(mEntryA2, 2000); mPositioner.setBubbleBarLocation(BubbleBarLocation.LEFT); mBubbleData.setExpanded(true); BubbleBarUpdate update = mBubbleData.getInitialStateForBubbleBar(); assertThat(update.currentBubbleList).hasSize(2); assertThat(update.currentBubbleList.get(0).getKey()).isEqualTo(mEntryA2.getKey()); assertThat(update.currentBubbleList.get(1).getKey()).isEqualTo(mEntryA1.getKey()); assertThat(update.bubbleBarLocation).isEqualTo(BubbleBarLocation.LEFT); assertThat(update.expandedChanged).isTrue(); assertThat(update.expanded).isTrue(); assertThat(update.selectedBubbleKey).isEqualTo(mEntryA2.getKey()); } @Test Loading packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,7 @@ import com.android.wm.shell.bubbles.BubbleViewInfoTask; import com.android.wm.shell.bubbles.BubbleViewProvider; import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.bubbles.StackEducationView; import com.android.wm.shell.bubbles.bar.BubbleBarLayerView; import com.android.wm.shell.bubbles.properties.BubbleProperties; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.FloatingContentCoordinator; Loading Loading @@ -2108,6 +2109,33 @@ public class BubblesTest extends SysuiTestCase { assertBubbleIsInflatedForStack(mBubbleData.getOverflow()); } @Test public void registerBubbleBarListener_switchToBarWhileExpanded() { mBubbleProperties.mIsBubbleBarEnabled = true; mPositioner.setIsLargeScreen(true); mEntryListener.onEntryAdded(mRow); mBubbleController.updateBubble(mBubbleEntry); BubbleStackView stackView = mBubbleController.getStackView(); spyOn(stackView); mBubbleData.setExpanded(true); assertStackMode(); assertThat(mBubbleData.isExpanded()).isTrue(); assertThat(stackView.isExpanded()).isTrue(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); BubbleBarLayerView layerView = mBubbleController.getLayerView(); spyOn(layerView); assertBarMode(); assertThat(mBubbleData.isExpanded()).isTrue(); assertThat(layerView.isExpanded()).isTrue(); } @Test public void switchBetweenBarAndStack_noBubbles_shouldBeIgnored() { mBubbleProperties.mIsBubbleBarEnabled = false; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +6 −0 Original line number Diff line number Diff line Loading @@ -1551,6 +1551,12 @@ public class BubbleController implements ConfigurationChangeListener, Log.w(TAG, "Tried to add a bubble to the stack but the stack is null"); } }; } else if (mBubbleData.isExpanded() && mBubbleData.getSelectedBubble() != null) { callback = b -> { if (b.getKey().equals(mBubbleData.getSelectedBubbleKey())) { mLayerView.showExpandedView(b); } }; } for (int i = mBubbleData.getBubbles().size() - 1; i >= 0; i--) { Bubble bubble = mBubbleData.getBubbles().get(i); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +5 −1 Original line number Diff line number Diff line Loading @@ -256,11 +256,15 @@ public class BubbleData { } /** * Returns a bubble bar update populated with the current list of active bubbles. * Returns a bubble bar update populated with the current list of active bubbles, expanded, * and selected state. */ public BubbleBarUpdate getInitialStateForBubbleBar() { BubbleBarUpdate initialState = mStateChange.getInitialState(); initialState.bubbleBarLocation = mPositioner.getBubbleBarLocation(); initialState.expanded = mExpanded; initialState.expandedChanged = mExpanded; // only matters if we're expanded initialState.selectedBubbleKey = getSelectedBubbleKey(); return initialState; } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java +19 −0 Original line number Diff line number Diff line Loading @@ -1203,6 +1203,25 @@ public class BubbleDataTest extends ShellTestCase { assertThat(update.currentBubbleList.get(0).getKey()).isEqualTo(mEntryA2.getKey()); assertThat(update.currentBubbleList.get(1).getKey()).isEqualTo(mEntryA1.getKey()); assertThat(update.bubbleBarLocation).isEqualTo(BubbleBarLocation.LEFT); assertThat(update.expandedChanged).isFalse(); assertThat(update.selectedBubbleKey).isEqualTo(mEntryA2.getKey()); } @Test public void test_getInitialStateForBubbleBar_includesExpandedState() { sendUpdatedEntryAtTime(mEntryA1, 1000); sendUpdatedEntryAtTime(mEntryA2, 2000); mPositioner.setBubbleBarLocation(BubbleBarLocation.LEFT); mBubbleData.setExpanded(true); BubbleBarUpdate update = mBubbleData.getInitialStateForBubbleBar(); assertThat(update.currentBubbleList).hasSize(2); assertThat(update.currentBubbleList.get(0).getKey()).isEqualTo(mEntryA2.getKey()); assertThat(update.currentBubbleList.get(1).getKey()).isEqualTo(mEntryA1.getKey()); assertThat(update.bubbleBarLocation).isEqualTo(BubbleBarLocation.LEFT); assertThat(update.expandedChanged).isTrue(); assertThat(update.expanded).isTrue(); assertThat(update.selectedBubbleKey).isEqualTo(mEntryA2.getKey()); } @Test Loading
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +28 −0 Original line number Diff line number Diff line Loading @@ -169,6 +169,7 @@ import com.android.wm.shell.bubbles.BubbleViewInfoTask; import com.android.wm.shell.bubbles.BubbleViewProvider; import com.android.wm.shell.bubbles.Bubbles; import com.android.wm.shell.bubbles.StackEducationView; import com.android.wm.shell.bubbles.bar.BubbleBarLayerView; import com.android.wm.shell.bubbles.properties.BubbleProperties; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.FloatingContentCoordinator; Loading Loading @@ -2108,6 +2109,33 @@ public class BubblesTest extends SysuiTestCase { assertBubbleIsInflatedForStack(mBubbleData.getOverflow()); } @Test public void registerBubbleBarListener_switchToBarWhileExpanded() { mBubbleProperties.mIsBubbleBarEnabled = true; mPositioner.setIsLargeScreen(true); mEntryListener.onEntryAdded(mRow); mBubbleController.updateBubble(mBubbleEntry); BubbleStackView stackView = mBubbleController.getStackView(); spyOn(stackView); mBubbleData.setExpanded(true); assertStackMode(); assertThat(mBubbleData.isExpanded()).isTrue(); assertThat(stackView.isExpanded()).isTrue(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); BubbleBarLayerView layerView = mBubbleController.getLayerView(); spyOn(layerView); assertBarMode(); assertThat(mBubbleData.isExpanded()).isTrue(); assertThat(layerView.isExpanded()).isTrue(); } @Test public void switchBetweenBarAndStack_noBubbles_shouldBeIgnored() { mBubbleProperties.mIsBubbleBarEnabled = false; Loading