Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +4 −15 Original line number Diff line number Diff line Loading @@ -455,8 +455,7 @@ public class BubbleController implements ConfigurationChangeListener, ProtoLog.d(WM_SHELL_BUBBLES, "onActivityRestartAttempt - taskId=%d selecting matching bubble=%s", task.taskId, b.getKey()); mBubbleData.setSelectedBubble(b); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(b); return; } } Loading Loading @@ -593,13 +592,6 @@ public class BubbleController implements ConfigurationChangeListener, } } private void openBubbleOverflow() { ensureBubbleViewsAndWindowCreated(); mBubbleData.setShowingOverflow(true); mBubbleData.setSelectedBubble(mBubbleData.getOverflow()); mBubbleData.setExpanded(true); } /** * Called when the status bar has become visible or invisible (either permanently or * temporarily). Loading Loading @@ -1247,8 +1239,7 @@ public class BubbleController implements ConfigurationChangeListener, } if (mBubbleData.hasBubbleInStackWithKey(b.getKey())) { // already in the stack mBubbleData.setSelectedBubble(b); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(b); } else if (mBubbleData.hasOverflowBubbleWithKey(b.getKey())) { // promote it out of the overflow promoteBubbleFromOverflow(b); Loading @@ -1273,8 +1264,7 @@ public class BubbleController implements ConfigurationChangeListener, String key = entry.getKey(); Bubble bubble = mBubbleData.getBubbleInStackWithKey(key); if (bubble != null) { mBubbleData.setSelectedBubble(bubble); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(bubble); } else { bubble = mBubbleData.getOverflowBubbleWithKey(key); if (bubble != null) { Loading Loading @@ -1367,8 +1357,7 @@ public class BubbleController implements ConfigurationChangeListener, } else { // App bubble is not selected, select it & expand Log.i(TAG, " showOrHideAppBubble, expand and select existing app bubble"); mBubbleData.setSelectedBubble(existingAppBubble); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(existingAppBubble); } } else { // Check if it exists in the overflow Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +13 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,19 @@ public class BubbleData { mSelectedBubble = bubble; } /** * Sets the selected bubble and expands it. * * <p>This dispatches a single state update for both changes and should be used instead of * calling {@link #setSelectedBubble(BubbleViewProvider)} followed by * {@link #setExpanded(boolean)} immediately after, which will generate 2 separate updates. */ public void setSelectedBubbleAndExpandStack(BubbleViewProvider bubble) { setSelectedBubbleInternal(bubble); setExpandedInternal(true); dispatchPendingChanges(); } public void setSelectedBubble(BubbleViewProvider bubble) { setSelectedBubbleInternal(bubble); dispatchPendingChanges(); Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -1222,6 +1222,19 @@ public class BubbleDataTest extends ShellTestCase { assertThat(update.bubbleBarLocation).isEqualTo(BubbleBarLocation.LEFT); } @Test public void setSelectedBubbleAndExpandStack() { sendUpdatedEntryAtTime(mEntryA1, 1000); sendUpdatedEntryAtTime(mEntryA2, 2000); mBubbleData.setListener(mListener); mBubbleData.setSelectedBubbleAndExpandStack(mBubbleA1); verifyUpdateReceived(); assertSelectionChangedTo(mBubbleA1); assertExpandedChangedTo(true); } private void verifyUpdateReceived() { verify(mListener).applyUpdate(mUpdateCaptor.capture()); reset(mListener); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +4 −15 Original line number Diff line number Diff line Loading @@ -455,8 +455,7 @@ public class BubbleController implements ConfigurationChangeListener, ProtoLog.d(WM_SHELL_BUBBLES, "onActivityRestartAttempt - taskId=%d selecting matching bubble=%s", task.taskId, b.getKey()); mBubbleData.setSelectedBubble(b); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(b); return; } } Loading Loading @@ -593,13 +592,6 @@ public class BubbleController implements ConfigurationChangeListener, } } private void openBubbleOverflow() { ensureBubbleViewsAndWindowCreated(); mBubbleData.setShowingOverflow(true); mBubbleData.setSelectedBubble(mBubbleData.getOverflow()); mBubbleData.setExpanded(true); } /** * Called when the status bar has become visible or invisible (either permanently or * temporarily). Loading Loading @@ -1247,8 +1239,7 @@ public class BubbleController implements ConfigurationChangeListener, } if (mBubbleData.hasBubbleInStackWithKey(b.getKey())) { // already in the stack mBubbleData.setSelectedBubble(b); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(b); } else if (mBubbleData.hasOverflowBubbleWithKey(b.getKey())) { // promote it out of the overflow promoteBubbleFromOverflow(b); Loading @@ -1273,8 +1264,7 @@ public class BubbleController implements ConfigurationChangeListener, String key = entry.getKey(); Bubble bubble = mBubbleData.getBubbleInStackWithKey(key); if (bubble != null) { mBubbleData.setSelectedBubble(bubble); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(bubble); } else { bubble = mBubbleData.getOverflowBubbleWithKey(key); if (bubble != null) { Loading Loading @@ -1367,8 +1357,7 @@ public class BubbleController implements ConfigurationChangeListener, } else { // App bubble is not selected, select it & expand Log.i(TAG, " showOrHideAppBubble, expand and select existing app bubble"); mBubbleData.setSelectedBubble(existingAppBubble); mBubbleData.setExpanded(true); mBubbleData.setSelectedBubbleAndExpandStack(existingAppBubble); } } else { // Check if it exists in the overflow Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleData.java +13 −0 Original line number Diff line number Diff line Loading @@ -365,6 +365,19 @@ public class BubbleData { mSelectedBubble = bubble; } /** * Sets the selected bubble and expands it. * * <p>This dispatches a single state update for both changes and should be used instead of * calling {@link #setSelectedBubble(BubbleViewProvider)} followed by * {@link #setExpanded(boolean)} immediately after, which will generate 2 separate updates. */ public void setSelectedBubbleAndExpandStack(BubbleViewProvider bubble) { setSelectedBubbleInternal(bubble); setExpandedInternal(true); dispatchPendingChanges(); } public void setSelectedBubble(BubbleViewProvider bubble) { setSelectedBubbleInternal(bubble); dispatchPendingChanges(); Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleDataTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -1222,6 +1222,19 @@ public class BubbleDataTest extends ShellTestCase { assertThat(update.bubbleBarLocation).isEqualTo(BubbleBarLocation.LEFT); } @Test public void setSelectedBubbleAndExpandStack() { sendUpdatedEntryAtTime(mEntryA1, 1000); sendUpdatedEntryAtTime(mEntryA2, 2000); mBubbleData.setListener(mListener); mBubbleData.setSelectedBubbleAndExpandStack(mBubbleA1); verifyUpdateReceived(); assertSelectionChangedTo(mBubbleA1); assertExpandedChangedTo(true); } private void verifyUpdateReceived() { verify(mListener).applyUpdate(mUpdateCaptor.capture()); reset(mListener); Loading