Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleControllerBubbleBarTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ class BubbleControllerBubbleBarTest { mainExecutor.flushAll() bgExecutor.flushAll() bubbleController.setLauncherHasBubbleBar(true) bubbleController.registerBubbleStateListener(FakeBubblesStateListener()) } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +60 −18 Original line number Diff line number Diff line Loading @@ -295,8 +295,16 @@ public class BubbleController implements ConfigurationChangeListener, private final Optional<OneHandedController> mOneHandedOptional; /** Drag and drop controller to register listener for onDragStarted. */ private final DragAndDropController mDragAndDropController; /** Used to send bubble events to launcher. */ /** * Used to send bubble events to launcher. * Set when taskbar is created in launcher and bubble bar gets initialized. * Can be cleared during Launcher lifecycle changes, for example when taskbar gets recreated * during rotation. */ @Nullable private Bubbles.BubbleStateListener mBubbleStateListener; /** True when launcher can show the bubble bar. */ private boolean mLauncherHasBubbleBar; /** * Used to track previous navigation mode to detect switch to buttons navigation. Set to * true to switch the bubble bar to the opposite side for 3 nav buttons mode on device boot. Loading Loading @@ -592,9 +600,8 @@ public class BubbleController implements ConfigurationChangeListener, /** * Sets a listener to be notified of bubble updates. This is used by launcher so that * it may render bubbles in itself. Only one listener is supported. * * <p>If bubble bar is supported, bubble views will be updated to switch to bar mode. */ @VisibleForTesting public void registerBubbleStateListener(Bubbles.BubbleStateListener listener) { final boolean bubbleBarAllowed = Flags.enableBubbleBar() && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones()) Loading @@ -602,8 +609,10 @@ public class BubbleController implements ConfigurationChangeListener, if (bubbleBarAllowed) { // Only set the listener if we can show the bubble bar. mBubbleStateListener = listener; setUpBubbleViewsForMode(); if (mLauncherHasBubbleBar) { // Launcher is ready, send initial listener update. sendInitialListenerUpdate(); } } else { mBubbleStateListener = null; } Loading @@ -611,13 +620,31 @@ public class BubbleController implements ConfigurationChangeListener, /** * Unregisters the {@link Bubbles.BubbleStateListener}. * * <p>If there's an existing listener, then we're switching back to stack mode and bubble views * will be updated accordingly. */ @VisibleForTesting public void unregisterBubbleStateListener() { if (mBubbleStateListener != null) { mBubbleStateListener = null; } /** * Store whether Launcher can show bubbles in Bubble Bar. * <p> * If {@code launcherHasBubbleBar} is set to {@code true}, bubble views will be updated to * switch to bar mode. If it is set to {@code false}, bubble views will be updated to switch * to stack mode. */ @VisibleForTesting public void setLauncherHasBubbleBar(boolean launcherHasBubbleBar) { if (launcherHasBubbleBar == mLauncherHasBubbleBar) return; mLauncherHasBubbleBar = launcherHasBubbleBar; if (mLauncherHasBubbleBar) { setUpBubbleViewsForMode(); if (mBubbleStateListener != null) { // Listener got set first, send it an initial update. sendInitialListenerUpdate(); } } else { unregisterBubbleStateListener(); setUpBubbleViewsForMode(); } } Loading Loading @@ -788,7 +815,7 @@ public class BubbleController implements ConfigurationChangeListener, public boolean isShowingAsBubbleBar() { return Flags.enableBubbleBar() && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones()) && mBubbleStateListener != null; && mLauncherHasBubbleBar; } /** Loading @@ -810,11 +837,13 @@ public class BubbleController implements ConfigurationChangeListener, @UpdateSource int source) { if (isShowingAsBubbleBar()) { updateExpandedViewForBubbleBarLocation(bubbleBarLocation, source); if (mBubbleStateListener != null) { BubbleBarUpdate bubbleBarUpdate = new BubbleBarUpdate(); bubbleBarUpdate.bubbleBarLocation = bubbleBarLocation; mBubbleStateListener.onBubbleStateChange(bubbleBarUpdate); } } } private void updateExpandedViewForBubbleBarLocation(BubbleBarLocation bubbleBarLocation, @UpdateSource int source) { Loading Loading @@ -874,7 +903,7 @@ public class BubbleController implements ConfigurationChangeListener, * {@link #setBubbleBarLocation(BubbleBarLocation, int)}. */ public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { if (isShowingAsBubbleBar()) { if (isShowingAsBubbleBar() && mBubbleStateListener != null) { mBubbleStateListener.animateBubbleBarLocation(bubbleBarLocation); } } Loading @@ -883,7 +912,9 @@ public class BubbleController implements ConfigurationChangeListener, public void onDragItemOverBubbleBarDragZone(@Nullable BubbleBarLocation bubbleBarLocation) { if (bubbleBarLocation == null) return; if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) { if (mBubbleStateListener != null) { mBubbleStateListener.onDragItemOverBubbleBarDragZone(bubbleBarLocation); } showBubbleBarExpandedViewDropTarget(bubbleBarLocation); } } Loading @@ -891,7 +922,9 @@ public class BubbleController implements ConfigurationChangeListener, @Override public void onItemDraggedOutsideBubbleBarDropZone() { if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) { if (mBubbleStateListener != null) { mBubbleStateListener.onItemDraggedOutsideBubbleBarDropZone(); } hideBubbleBarExpandedViewDropTarget(); } } Loading Loading @@ -2531,7 +2564,7 @@ public class BubbleController implements ConfigurationChangeListener, if (isShowingAsBubbleBar()) { BubbleBarUpdate bubbleBarUpdate = update.toBubbleBarUpdate(); // Some updates aren't relevant to the bubble bar so check first. if (bubbleBarUpdate.anythingChanged()) { if (bubbleBarUpdate.anythingChanged() && mBubbleStateListener != null) { mBubbleStateListener.onBubbleStateChange(bubbleBarUpdate); } } Loading Loading @@ -2770,6 +2803,10 @@ public class BubbleController implements ConfigurationChangeListener, pw.print(prefix); pw.println(" currentUserId= " + mCurrentUserId); pw.print(prefix); pw.println(" isStatusBarShade= " + mIsStatusBarShade); pw.print(prefix); pw.println(" isShowingAsBubbleBar= " + isShowingAsBubbleBar()); pw.print(prefix); pw.println(" launcherHasBubbleBar= " + mLauncherHasBubbleBar); pw.print(prefix); pw.println(" bubbleStateListenerSet= " + (mBubbleStateListener != null)); pw.print(prefix); pw.println(" stackViewSet= " + (mStackView != null)); pw.print(prefix); pw.println(" layerViewSet= " + (mLayerView != null)); pw.print(prefix); pw.println(" isImeVisible= " + mBubblePositioner.isImeVisible()); pw.println(); Loading Loading @@ -3074,6 +3111,11 @@ public class BubbleController implements ConfigurationChangeListener, mMainExecutor.execute( () -> mController.moveDraggedBubbleToFullscreen(key, dropLocation)); } @Override public void setHasBubbleBar(boolean hasBubbleBar) { mMainExecutor.execute(() -> mController.setLauncherHasBubbleBar(hasBubbleBar)); } } private class BubblesImpl implements Bubbles { Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/IBubbles.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -61,4 +61,6 @@ interface IBubbles { oneway void showDropTarget(in boolean show, in @nullable BubbleBarLocation location) = 15; oneway void moveDraggedBubbleToFullscreen(in String key, in Point dropLocation) = 16; oneway void setHasBubbleBar(in boolean hasBubbleBar) = 17; } No newline at end of file packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +30 −6 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.stubbing.Answer; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; Loading @@ -220,9 +223,6 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.Executor; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; @SmallTest @RunWith(ParameterizedAndroidJunit4.class) @TestableLooper.RunWithLooper(setAsMainLooper = true) Loading Loading @@ -2397,6 +2397,7 @@ public class BubblesTest extends SysuiTestCase { assertStackMode(); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2415,6 +2416,7 @@ public class BubblesTest extends SysuiTestCase { assertStackMode(); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2437,17 +2439,20 @@ public class BubblesTest extends SysuiTestCase { assertBubbleIsInflatedForStack(mBubbleData.getBubbles().get(0)); assertBubbleIsInflatedForStack(mBubbleData.getOverflow()); mBubbleController.setLauncherHasBubbleBar(true); assertBarMode(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); assertBarMode(); assertThat(mBubbleData.getBubbles()).hasSize(1); assertBubbleIsInflatedForBar(mBubbleData.getBubbles().get(0)); assertBubbleIsInflatedForBar(mBubbleData.getOverflow()); mBubbleController.unregisterBubbleStateListener(); // Check that bubbles stay in bar mode until launcher switches back to stack assertBarMode(); mBubbleController.setLauncherHasBubbleBar(false); assertStackMode(); assertThat(mBubbleData.getBubbles()).hasSize(1); Loading @@ -2472,6 +2477,7 @@ public class BubblesTest extends SysuiTestCase { assertThat(stackView.isExpanded()).isTrue(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.setLauncherHasBubbleBar(true); mBubbleController.registerBubbleStateListener(bubbleStateListener); BubbleBarLayerView layerView = mBubbleController.getLayerView(); Loading @@ -2491,11 +2497,13 @@ public class BubblesTest extends SysuiTestCase { assertNoBubbleContainerViews(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.setLauncherHasBubbleBar(true); mBubbleController.registerBubbleStateListener(bubbleStateListener); assertNoBubbleContainerViews(); mBubbleController.unregisterBubbleStateListener(); mBubbleController.setLauncherHasBubbleBar(false); assertNoBubbleContainerViews(); } Loading @@ -2507,6 +2515,7 @@ public class BubblesTest extends SysuiTestCase { mEntryListener.onEntryAdded(mEntry); mBubbleController.updateBubble(mBubbleEntry); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mBubbleController.expandStackAndSelectBubbleFromLauncher(mBubbleEntry.getKey(), 1000); Loading @@ -2522,6 +2531,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dragBubbleBarBubble_selectedBubble_expandedViewCollapsesDuringDrag() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2550,6 +2560,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dragBubbleBarBubble_unselectedBubble_expandedViewCollapsesDuringDrag() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2578,6 +2589,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dismissBubbleBarBubble_selected_selectsAndExpandsNext() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2601,6 +2613,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dismissBubbleBarBubble_unselected_selectionDoesNotChange() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2652,6 +2665,7 @@ public class BubblesTest extends SysuiTestCase { public void setBubbleBarLocation_listenerNotified() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mBubbleController.setBubbleBarLocation(BubbleBarLocation.LEFT, Loading @@ -2666,6 +2680,7 @@ public class BubblesTest extends SysuiTestCase { public void setBubbleBarLocation_barDisabled_shouldBeIgnored() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mBubbleController.setBubbleBarLocation(BubbleBarLocation.LEFT, Loading Loading @@ -2737,6 +2752,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_addBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2750,6 +2766,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_updateBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2766,6 +2783,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_dragSelectedBubbleToDismiss() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2792,6 +2810,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_dragOtherBubbleToDismiss() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2830,6 +2849,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_expandAndCollapse() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2849,6 +2869,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_autoExpandingBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2864,6 +2885,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_switchBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2889,6 +2911,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_openOverflow() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2904,6 +2927,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_fromOverflowToBar() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleControllerBubbleBarTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ class BubbleControllerBubbleBarTest { mainExecutor.flushAll() bgExecutor.flushAll() bubbleController.setLauncherHasBubbleBar(true) bubbleController.registerBubbleStateListener(FakeBubblesStateListener()) } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +60 −18 Original line number Diff line number Diff line Loading @@ -295,8 +295,16 @@ public class BubbleController implements ConfigurationChangeListener, private final Optional<OneHandedController> mOneHandedOptional; /** Drag and drop controller to register listener for onDragStarted. */ private final DragAndDropController mDragAndDropController; /** Used to send bubble events to launcher. */ /** * Used to send bubble events to launcher. * Set when taskbar is created in launcher and bubble bar gets initialized. * Can be cleared during Launcher lifecycle changes, for example when taskbar gets recreated * during rotation. */ @Nullable private Bubbles.BubbleStateListener mBubbleStateListener; /** True when launcher can show the bubble bar. */ private boolean mLauncherHasBubbleBar; /** * Used to track previous navigation mode to detect switch to buttons navigation. Set to * true to switch the bubble bar to the opposite side for 3 nav buttons mode on device boot. Loading Loading @@ -592,9 +600,8 @@ public class BubbleController implements ConfigurationChangeListener, /** * Sets a listener to be notified of bubble updates. This is used by launcher so that * it may render bubbles in itself. Only one listener is supported. * * <p>If bubble bar is supported, bubble views will be updated to switch to bar mode. */ @VisibleForTesting public void registerBubbleStateListener(Bubbles.BubbleStateListener listener) { final boolean bubbleBarAllowed = Flags.enableBubbleBar() && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones()) Loading @@ -602,8 +609,10 @@ public class BubbleController implements ConfigurationChangeListener, if (bubbleBarAllowed) { // Only set the listener if we can show the bubble bar. mBubbleStateListener = listener; setUpBubbleViewsForMode(); if (mLauncherHasBubbleBar) { // Launcher is ready, send initial listener update. sendInitialListenerUpdate(); } } else { mBubbleStateListener = null; } Loading @@ -611,13 +620,31 @@ public class BubbleController implements ConfigurationChangeListener, /** * Unregisters the {@link Bubbles.BubbleStateListener}. * * <p>If there's an existing listener, then we're switching back to stack mode and bubble views * will be updated accordingly. */ @VisibleForTesting public void unregisterBubbleStateListener() { if (mBubbleStateListener != null) { mBubbleStateListener = null; } /** * Store whether Launcher can show bubbles in Bubble Bar. * <p> * If {@code launcherHasBubbleBar} is set to {@code true}, bubble views will be updated to * switch to bar mode. If it is set to {@code false}, bubble views will be updated to switch * to stack mode. */ @VisibleForTesting public void setLauncherHasBubbleBar(boolean launcherHasBubbleBar) { if (launcherHasBubbleBar == mLauncherHasBubbleBar) return; mLauncherHasBubbleBar = launcherHasBubbleBar; if (mLauncherHasBubbleBar) { setUpBubbleViewsForMode(); if (mBubbleStateListener != null) { // Listener got set first, send it an initial update. sendInitialListenerUpdate(); } } else { unregisterBubbleStateListener(); setUpBubbleViewsForMode(); } } Loading Loading @@ -788,7 +815,7 @@ public class BubbleController implements ConfigurationChangeListener, public boolean isShowingAsBubbleBar() { return Flags.enableBubbleBar() && (mBubblePositioner.isLargeScreen() || Flags.enableBubbleBarOnPhones()) && mBubbleStateListener != null; && mLauncherHasBubbleBar; } /** Loading @@ -810,11 +837,13 @@ public class BubbleController implements ConfigurationChangeListener, @UpdateSource int source) { if (isShowingAsBubbleBar()) { updateExpandedViewForBubbleBarLocation(bubbleBarLocation, source); if (mBubbleStateListener != null) { BubbleBarUpdate bubbleBarUpdate = new BubbleBarUpdate(); bubbleBarUpdate.bubbleBarLocation = bubbleBarLocation; mBubbleStateListener.onBubbleStateChange(bubbleBarUpdate); } } } private void updateExpandedViewForBubbleBarLocation(BubbleBarLocation bubbleBarLocation, @UpdateSource int source) { Loading Loading @@ -874,7 +903,7 @@ public class BubbleController implements ConfigurationChangeListener, * {@link #setBubbleBarLocation(BubbleBarLocation, int)}. */ public void animateBubbleBarLocation(BubbleBarLocation bubbleBarLocation) { if (isShowingAsBubbleBar()) { if (isShowingAsBubbleBar() && mBubbleStateListener != null) { mBubbleStateListener.animateBubbleBarLocation(bubbleBarLocation); } } Loading @@ -883,7 +912,9 @@ public class BubbleController implements ConfigurationChangeListener, public void onDragItemOverBubbleBarDragZone(@Nullable BubbleBarLocation bubbleBarLocation) { if (bubbleBarLocation == null) return; if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) { if (mBubbleStateListener != null) { mBubbleStateListener.onDragItemOverBubbleBarDragZone(bubbleBarLocation); } showBubbleBarExpandedViewDropTarget(bubbleBarLocation); } } Loading @@ -891,7 +922,9 @@ public class BubbleController implements ConfigurationChangeListener, @Override public void onItemDraggedOutsideBubbleBarDropZone() { if (isShowingAsBubbleBar() && BubbleAnythingFlagHelper.enableCreateAnyBubble()) { if (mBubbleStateListener != null) { mBubbleStateListener.onItemDraggedOutsideBubbleBarDropZone(); } hideBubbleBarExpandedViewDropTarget(); } } Loading Loading @@ -2531,7 +2564,7 @@ public class BubbleController implements ConfigurationChangeListener, if (isShowingAsBubbleBar()) { BubbleBarUpdate bubbleBarUpdate = update.toBubbleBarUpdate(); // Some updates aren't relevant to the bubble bar so check first. if (bubbleBarUpdate.anythingChanged()) { if (bubbleBarUpdate.anythingChanged() && mBubbleStateListener != null) { mBubbleStateListener.onBubbleStateChange(bubbleBarUpdate); } } Loading Loading @@ -2770,6 +2803,10 @@ public class BubbleController implements ConfigurationChangeListener, pw.print(prefix); pw.println(" currentUserId= " + mCurrentUserId); pw.print(prefix); pw.println(" isStatusBarShade= " + mIsStatusBarShade); pw.print(prefix); pw.println(" isShowingAsBubbleBar= " + isShowingAsBubbleBar()); pw.print(prefix); pw.println(" launcherHasBubbleBar= " + mLauncherHasBubbleBar); pw.print(prefix); pw.println(" bubbleStateListenerSet= " + (mBubbleStateListener != null)); pw.print(prefix); pw.println(" stackViewSet= " + (mStackView != null)); pw.print(prefix); pw.println(" layerViewSet= " + (mLayerView != null)); pw.print(prefix); pw.println(" isImeVisible= " + mBubblePositioner.isImeVisible()); pw.println(); Loading Loading @@ -3074,6 +3111,11 @@ public class BubbleController implements ConfigurationChangeListener, mMainExecutor.execute( () -> mController.moveDraggedBubbleToFullscreen(key, dropLocation)); } @Override public void setHasBubbleBar(boolean hasBubbleBar) { mMainExecutor.execute(() -> mController.setLauncherHasBubbleBar(hasBubbleBar)); } } private class BubblesImpl implements Bubbles { Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/IBubbles.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -61,4 +61,6 @@ interface IBubbles { oneway void showDropTarget(in boolean show, in @nullable BubbleBarLocation location) = 15; oneway void moveDraggedBubbleToFullscreen(in String key, in Point dropLocation) = 16; oneway void setHasBubbleBar(in boolean hasBubbleBar) = 17; } No newline at end of file
packages/SystemUI/tests/src/com/android/systemui/wmshell/BubblesTest.java +30 −6 Original line number Diff line number Diff line Loading @@ -212,6 +212,9 @@ import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.stubbing.Answer; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; Loading @@ -220,9 +223,6 @@ import java.util.List; import java.util.Optional; import java.util.concurrent.Executor; import platform.test.runner.parameterized.ParameterizedAndroidJunit4; import platform.test.runner.parameterized.Parameters; @SmallTest @RunWith(ParameterizedAndroidJunit4.class) @TestableLooper.RunWithLooper(setAsMainLooper = true) Loading Loading @@ -2397,6 +2397,7 @@ public class BubblesTest extends SysuiTestCase { assertStackMode(); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2415,6 +2416,7 @@ public class BubblesTest extends SysuiTestCase { assertStackMode(); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2437,17 +2439,20 @@ public class BubblesTest extends SysuiTestCase { assertBubbleIsInflatedForStack(mBubbleData.getBubbles().get(0)); assertBubbleIsInflatedForStack(mBubbleData.getOverflow()); mBubbleController.setLauncherHasBubbleBar(true); assertBarMode(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); assertBarMode(); assertThat(mBubbleData.getBubbles()).hasSize(1); assertBubbleIsInflatedForBar(mBubbleData.getBubbles().get(0)); assertBubbleIsInflatedForBar(mBubbleData.getOverflow()); mBubbleController.unregisterBubbleStateListener(); // Check that bubbles stay in bar mode until launcher switches back to stack assertBarMode(); mBubbleController.setLauncherHasBubbleBar(false); assertStackMode(); assertThat(mBubbleData.getBubbles()).hasSize(1); Loading @@ -2472,6 +2477,7 @@ public class BubblesTest extends SysuiTestCase { assertThat(stackView.isExpanded()).isTrue(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.setLauncherHasBubbleBar(true); mBubbleController.registerBubbleStateListener(bubbleStateListener); BubbleBarLayerView layerView = mBubbleController.getLayerView(); Loading @@ -2491,11 +2497,13 @@ public class BubblesTest extends SysuiTestCase { assertNoBubbleContainerViews(); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.setLauncherHasBubbleBar(true); mBubbleController.registerBubbleStateListener(bubbleStateListener); assertNoBubbleContainerViews(); mBubbleController.unregisterBubbleStateListener(); mBubbleController.setLauncherHasBubbleBar(false); assertNoBubbleContainerViews(); } Loading @@ -2507,6 +2515,7 @@ public class BubblesTest extends SysuiTestCase { mEntryListener.onEntryAdded(mEntry); mBubbleController.updateBubble(mBubbleEntry); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mBubbleController.expandStackAndSelectBubbleFromLauncher(mBubbleEntry.getKey(), 1000); Loading @@ -2522,6 +2531,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dragBubbleBarBubble_selectedBubble_expandedViewCollapsesDuringDrag() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2550,6 +2560,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dragBubbleBarBubble_unselectedBubble_expandedViewCollapsesDuringDrag() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2578,6 +2589,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dismissBubbleBarBubble_selected_selectsAndExpandsNext() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2601,6 +2613,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void dismissBubbleBarBubble_unselected_selectionDoesNotChange() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2652,6 +2665,7 @@ public class BubblesTest extends SysuiTestCase { public void setBubbleBarLocation_listenerNotified() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mBubbleController.setBubbleBarLocation(BubbleBarLocation.LEFT, Loading @@ -2666,6 +2680,7 @@ public class BubblesTest extends SysuiTestCase { public void setBubbleBarLocation_barDisabled_shouldBeIgnored() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); mBubbleController.setBubbleBarLocation(BubbleBarLocation.LEFT, Loading Loading @@ -2737,6 +2752,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_addBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2750,6 +2766,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_updateBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2766,6 +2783,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_dragSelectedBubbleToDismiss() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2792,6 +2810,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_dragOtherBubbleToDismiss() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading Loading @@ -2830,6 +2849,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_expandAndCollapse() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2849,6 +2869,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_autoExpandingBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2864,6 +2885,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_switchBubble() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2889,6 +2911,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_openOverflow() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading @@ -2904,6 +2927,7 @@ public class BubblesTest extends SysuiTestCase { @Test public void testEventLogging_bubbleBar_fromOverflowToBar() { mPositioner.setIsLargeScreen(true); mBubbleController.setLauncherHasBubbleBar(true); FakeBubbleStateListener bubbleStateListener = new FakeBubbleStateListener(); mBubbleController.registerBubbleStateListener(bubbleStateListener); Loading