Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +3 −1 Original line number Diff line number Diff line Loading @@ -356,8 +356,10 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe ensureStackViewCreated(); mStackView.addBubble(notif); } Bubble bubble = mBubbleData.getBubble(notif.key); if (shouldAutoExpand(notif)) { mStackView.setExpandedBubble(notif); mStackView.setSelectedBubble(bubble); mStackView.setExpanded(true); } updateVisibility(); } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +68 −31 Original line number Diff line number Diff line Loading @@ -441,54 +441,80 @@ public class BubbleStackView extends FrameLayout { * Sets the bubble that should be expanded and expands if needed. * * @param key the {@link NotificationEntry#key} associated with the bubble to expand. * @deprecated replaced by setSelectedBubble(Bubble) + setExpanded(true) */ @Deprecated void setExpandedBubble(String key) { Bubble bubbleToExpand = mBubbleData.getBubble(key); if (mIsExpanded && !bubbleToExpand.equals(mExpandedBubble)) { // Previously expanded, notify that this bubble is no longer expanded notifyExpansionChanged(mExpandedBubble.entry, false /* expanded */); if (bubbleToExpand != null) { setSelectedBubble(bubbleToExpand); bubbleToExpand.entry.setShowInShadeWhenBubble(false); setExpanded(true); } Bubble prevBubble = mExpandedBubble; mExpandedBubble = bubbleToExpand; if (!mIsExpanded) { // If we weren't previously expanded we should animate open. animateExpansion(true /* expand */); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); mExpandedBubble.entry.setShowInShadeWhenBubble(false); notifyExpansionChanged(mExpandedBubble.entry, true /* expanded */); } else { } /** * Sets the entry that should be expanded and expands if needed. */ @VisibleForTesting void setExpandedBubble(NotificationEntry entry) { for (int i = 0; i < mBubbleContainer.getChildCount(); i++) { BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); if (entry.equals(bv.getEntry())) { setExpandedBubble(entry.key); } } } /** * Changes the currently selected bubble. If the stack is already expanded, the newly selected * bubble will be shown immediately. This does not change the expanded state or change the * position of any bubble. */ public void setSelectedBubble(Bubble bubbleToSelect) { if (mExpandedBubble != null && mExpandedBubble.equals(bubbleToSelect)) { return; } final Bubble previouslySelected = mExpandedBubble; mExpandedBubble = bubbleToSelect; if (mIsExpanded) { // Make the container of the expanded view transparent before removing the expanded view // from it. Otherwise a punch hole created by {@link android.view.SurfaceView} in the // expanded view becomes visible on the screen. See b/126856255 mExpandedViewContainer.setAlpha(0.0f); mSurfaceSynchronizer.syncSurfaceAndRun(new Runnable() { @Override public void run() { mSurfaceSynchronizer.syncSurfaceAndRun(() -> { updateExpandedBubble(); updatePointerPosition(); requestUpdate(); logBubbleEvent(prevBubble, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); mExpandedBubble.entry.setShowInShadeWhenBubble(false); notifyExpansionChanged(mExpandedBubble.entry, true /* expanded */); } logBubbleEvent(previouslySelected, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); logBubbleEvent(bubbleToSelect, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); notifyExpansionChanged(previouslySelected.entry, false /* expanded */); notifyExpansionChanged(bubbleToSelect.entry, true /* expanded */); }); } } /** * Sets the entry that should be expanded and expands if needed. * Changes the expanded state of the stack. * * @param expanded whether the bubble stack should appear expanded */ @VisibleForTesting void setExpandedBubble(NotificationEntry entry) { for (int i = 0; i < mBubbleContainer.getChildCount(); i++) { BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); if (entry.equals(bv.getEntry())) { setExpandedBubble(entry.key); public void setExpanded(boolean expanded) { if (expanded == mIsExpanded) { return; } if (mIsExpanded) { // Collapse the stack animateExpansion(false /* expand */); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); } else { // Expand the stack animateExpansion(true /* expand */); // TODO: move next line to BubbleData logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED); } notifyExpansionChanged(mExpandedBubble.entry, mIsExpanded); } /** Loading Loading @@ -652,7 +678,10 @@ public class BubbleStackView extends FrameLayout { * Collapses the stack of bubbles. * <p> * Must be called from the main thread. * * @deprecated use {@link #setExpanded(boolean)} and {@link #setSelectedBubble(Bubble)} */ @Deprecated @MainThread public void collapseStack() { if (mIsExpanded) { Loading @@ -663,6 +692,11 @@ public class BubbleStackView extends FrameLayout { } } /** * @deprecated use {@link #setExpanded(boolean)} and {@link #setSelectedBubble(Bubble)} */ @Deprecated @MainThread void collapseStack(Runnable endRunnable) { collapseStack(); // TODO - use the runnable at end of animation Loading @@ -673,7 +707,10 @@ public class BubbleStackView extends FrameLayout { * Expands the stack of bubbles. * <p> * Must be called from the main thread. * * @deprecated use {@link #setExpanded(boolean)} and {@link #setSelectedBubble(Bubble)} */ @Deprecated @MainThread public void expandStack() { if (!mIsExpanded) { Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +3 −1 Original line number Diff line number Diff line Loading @@ -356,8 +356,10 @@ public class BubbleController implements BubbleExpandedView.OnBubbleBlockedListe ensureStackViewCreated(); mStackView.addBubble(notif); } Bubble bubble = mBubbleData.getBubble(notif.key); if (shouldAutoExpand(notif)) { mStackView.setExpandedBubble(notif); mStackView.setSelectedBubble(bubble); mStackView.setExpanded(true); } updateVisibility(); } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +68 −31 Original line number Diff line number Diff line Loading @@ -441,54 +441,80 @@ public class BubbleStackView extends FrameLayout { * Sets the bubble that should be expanded and expands if needed. * * @param key the {@link NotificationEntry#key} associated with the bubble to expand. * @deprecated replaced by setSelectedBubble(Bubble) + setExpanded(true) */ @Deprecated void setExpandedBubble(String key) { Bubble bubbleToExpand = mBubbleData.getBubble(key); if (mIsExpanded && !bubbleToExpand.equals(mExpandedBubble)) { // Previously expanded, notify that this bubble is no longer expanded notifyExpansionChanged(mExpandedBubble.entry, false /* expanded */); if (bubbleToExpand != null) { setSelectedBubble(bubbleToExpand); bubbleToExpand.entry.setShowInShadeWhenBubble(false); setExpanded(true); } Bubble prevBubble = mExpandedBubble; mExpandedBubble = bubbleToExpand; if (!mIsExpanded) { // If we weren't previously expanded we should animate open. animateExpansion(true /* expand */); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); mExpandedBubble.entry.setShowInShadeWhenBubble(false); notifyExpansionChanged(mExpandedBubble.entry, true /* expanded */); } else { } /** * Sets the entry that should be expanded and expands if needed. */ @VisibleForTesting void setExpandedBubble(NotificationEntry entry) { for (int i = 0; i < mBubbleContainer.getChildCount(); i++) { BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); if (entry.equals(bv.getEntry())) { setExpandedBubble(entry.key); } } } /** * Changes the currently selected bubble. If the stack is already expanded, the newly selected * bubble will be shown immediately. This does not change the expanded state or change the * position of any bubble. */ public void setSelectedBubble(Bubble bubbleToSelect) { if (mExpandedBubble != null && mExpandedBubble.equals(bubbleToSelect)) { return; } final Bubble previouslySelected = mExpandedBubble; mExpandedBubble = bubbleToSelect; if (mIsExpanded) { // Make the container of the expanded view transparent before removing the expanded view // from it. Otherwise a punch hole created by {@link android.view.SurfaceView} in the // expanded view becomes visible on the screen. See b/126856255 mExpandedViewContainer.setAlpha(0.0f); mSurfaceSynchronizer.syncSurfaceAndRun(new Runnable() { @Override public void run() { mSurfaceSynchronizer.syncSurfaceAndRun(() -> { updateExpandedBubble(); updatePointerPosition(); requestUpdate(); logBubbleEvent(prevBubble, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); mExpandedBubble.entry.setShowInShadeWhenBubble(false); notifyExpansionChanged(mExpandedBubble.entry, true /* expanded */); } logBubbleEvent(previouslySelected, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); logBubbleEvent(bubbleToSelect, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); notifyExpansionChanged(previouslySelected.entry, false /* expanded */); notifyExpansionChanged(bubbleToSelect.entry, true /* expanded */); }); } } /** * Sets the entry that should be expanded and expands if needed. * Changes the expanded state of the stack. * * @param expanded whether the bubble stack should appear expanded */ @VisibleForTesting void setExpandedBubble(NotificationEntry entry) { for (int i = 0; i < mBubbleContainer.getChildCount(); i++) { BubbleView bv = (BubbleView) mBubbleContainer.getChildAt(i); if (entry.equals(bv.getEntry())) { setExpandedBubble(entry.key); public void setExpanded(boolean expanded) { if (expanded == mIsExpanded) { return; } if (mIsExpanded) { // Collapse the stack animateExpansion(false /* expand */); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); } else { // Expand the stack animateExpansion(true /* expand */); // TODO: move next line to BubbleData logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED); } notifyExpansionChanged(mExpandedBubble.entry, mIsExpanded); } /** Loading Loading @@ -652,7 +678,10 @@ public class BubbleStackView extends FrameLayout { * Collapses the stack of bubbles. * <p> * Must be called from the main thread. * * @deprecated use {@link #setExpanded(boolean)} and {@link #setSelectedBubble(Bubble)} */ @Deprecated @MainThread public void collapseStack() { if (mIsExpanded) { Loading @@ -663,6 +692,11 @@ public class BubbleStackView extends FrameLayout { } } /** * @deprecated use {@link #setExpanded(boolean)} and {@link #setSelectedBubble(Bubble)} */ @Deprecated @MainThread void collapseStack(Runnable endRunnable) { collapseStack(); // TODO - use the runnable at end of animation Loading @@ -673,7 +707,10 @@ public class BubbleStackView extends FrameLayout { * Expands the stack of bubbles. * <p> * Must be called from the main thread. * * @deprecated use {@link #setExpanded(boolean)} and {@link #setSelectedBubble(Bubble)} */ @Deprecated @MainThread public void expandStack() { if (!mIsExpanded) { Loading