Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +5 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,8 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.FrameLayout; import androidx.annotation.MainThread; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; Loading Loading @@ -289,7 +291,10 @@ public class BubbleController { /** * Removes the bubble associated with the {@param uri}. * <p> * Must be called from the main thread. */ @MainThread void removeBubble(String key) { BubbleView bv = mBubbles.remove(key); if (mStackView != null && bv != null) { Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +11 −8 Original line number Diff line number Diff line Loading @@ -296,19 +296,22 @@ public class BubbleStackView extends FrameLayout implements BubbleTouchHandler.F public void removeBubble(BubbleView bubbleView) { int removedIndex = mBubbleContainer.indexOfChild(bubbleView); mBubbleContainer.removeView(bubbleView); boolean wasExpanded = mIsExpanded; int bubbleCount = mBubbleContainer.getChildCount(); if (mIsExpanded && bubbleView.equals(mExpandedBubble) && bubbleCount > 0) { if (bubbleCount == 0) { // If no bubbles remain, collapse the entire stack. collapseStack(); return; } else if (bubbleView.equals(mExpandedBubble)) { // Was the current bubble just removed? // If we have other bubbles and are expanded go to the next one or previous // if the bubble removed was last int nextIndex = bubbleCount > removedIndex ? removedIndex : bubbleCount - 1; BubbleView expandedBubble = (BubbleView) mBubbleContainer.getChildAt(nextIndex); if (mIsExpanded) { setExpandedBubble(expandedBubble); requestUpdate(); } else { mExpandedBubble = null; } mIsExpanded = wasExpanded && mBubbleContainer.getChildCount() > 0; if (wasExpanded != mIsExpanded) { notifyExpansionChanged(mExpandedBubble, mIsExpanded); } logBubbleEvent(bubbleView, StatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED); } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java +17 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.android.internal.graphics.ColorUtils; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.statusbar.notification.collection.NotificationEntry; Loading @@ -59,6 +60,7 @@ public class BubbleView extends FrameLayout implements BubbleTouchHandler.Floati private NotificationEntry mEntry; private PendingIntent mAppOverlayIntent; private BubbleController mBubbleController; private ActivityView mActivityView; private boolean mActivityViewReady; private boolean mActivityViewStarted; Loading @@ -81,6 +83,7 @@ public class BubbleView extends FrameLayout implements BubbleTouchHandler.Floati // XXX: can this padding just be on the view and we look it up? mPadding = getResources().getDimensionPixelSize(R.dimen.bubble_view_padding); mIconInset = getResources().getDimensionPixelSize(R.dimen.bubble_icon_inset); mBubbleController = Dependency.get(BubbleController.class); } @Override Loading Loading @@ -248,6 +251,20 @@ public class BubbleView extends FrameLayout implements BubbleTouchHandler.Floati public void onActivityViewDestroyed(ActivityView view) { mActivityViewReady = false; } /** * This is only called for tasks on this ActivityView, which is also set to * single-task mode -- meaning never more than one task on this display. If a task * is being removed, it's the top Activity finishing and this bubble should * be removed or collapsed. */ @Override public void onTaskRemovalStarted(int taskId) { if (mEntry != null) { // Must post because this is called from a binder thread. post(() -> mBubbleController.removeBubble(mEntry.key)); } } }); } return mActivityView; Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +5 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,8 @@ import android.view.ViewGroup; import android.view.WindowManager; import android.widget.FrameLayout; import androidx.annotation.MainThread; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.statusbar.NotificationVisibility; import com.android.systemui.Dependency; Loading Loading @@ -289,7 +291,10 @@ public class BubbleController { /** * Removes the bubble associated with the {@param uri}. * <p> * Must be called from the main thread. */ @MainThread void removeBubble(String key) { BubbleView bv = mBubbles.remove(key); if (mStackView != null && bv != null) { Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +11 −8 Original line number Diff line number Diff line Loading @@ -296,19 +296,22 @@ public class BubbleStackView extends FrameLayout implements BubbleTouchHandler.F public void removeBubble(BubbleView bubbleView) { int removedIndex = mBubbleContainer.indexOfChild(bubbleView); mBubbleContainer.removeView(bubbleView); boolean wasExpanded = mIsExpanded; int bubbleCount = mBubbleContainer.getChildCount(); if (mIsExpanded && bubbleView.equals(mExpandedBubble) && bubbleCount > 0) { if (bubbleCount == 0) { // If no bubbles remain, collapse the entire stack. collapseStack(); return; } else if (bubbleView.equals(mExpandedBubble)) { // Was the current bubble just removed? // If we have other bubbles and are expanded go to the next one or previous // if the bubble removed was last int nextIndex = bubbleCount > removedIndex ? removedIndex : bubbleCount - 1; BubbleView expandedBubble = (BubbleView) mBubbleContainer.getChildAt(nextIndex); if (mIsExpanded) { setExpandedBubble(expandedBubble); requestUpdate(); } else { mExpandedBubble = null; } mIsExpanded = wasExpanded && mBubbleContainer.getChildCount() > 0; if (wasExpanded != mIsExpanded) { notifyExpansionChanged(mExpandedBubble, mIsExpanded); } logBubbleEvent(bubbleView, StatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED); } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleView.java +17 −0 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.widget.LinearLayout; import android.widget.TextView; import com.android.internal.graphics.ColorUtils; import com.android.systemui.Dependency; import com.android.systemui.Interpolators; import com.android.systemui.R; import com.android.systemui.statusbar.notification.collection.NotificationEntry; Loading @@ -59,6 +60,7 @@ public class BubbleView extends FrameLayout implements BubbleTouchHandler.Floati private NotificationEntry mEntry; private PendingIntent mAppOverlayIntent; private BubbleController mBubbleController; private ActivityView mActivityView; private boolean mActivityViewReady; private boolean mActivityViewStarted; Loading @@ -81,6 +83,7 @@ public class BubbleView extends FrameLayout implements BubbleTouchHandler.Floati // XXX: can this padding just be on the view and we look it up? mPadding = getResources().getDimensionPixelSize(R.dimen.bubble_view_padding); mIconInset = getResources().getDimensionPixelSize(R.dimen.bubble_icon_inset); mBubbleController = Dependency.get(BubbleController.class); } @Override Loading Loading @@ -248,6 +251,20 @@ public class BubbleView extends FrameLayout implements BubbleTouchHandler.Floati public void onActivityViewDestroyed(ActivityView view) { mActivityViewReady = false; } /** * This is only called for tasks on this ActivityView, which is also set to * single-task mode -- meaning never more than one task on this display. If a task * is being removed, it's the top Activity finishing and this bubble should * be removed or collapsed. */ @Override public void onTaskRemovalStarted(int taskId) { if (mEntry != null) { // Must post because this is called from a binder thread. post(() -> mBubbleController.removeBubble(mEntry.key)); } } }); } return mActivityView; Loading