Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +49 −29 Original line number Diff line number Diff line Loading @@ -39,14 +39,14 @@ class Bubble { private final String mKey; private final String mGroupId; private String mAppName; private NotificationEntry mEntry; private boolean mInflated; public NotificationEntry entry; BubbleView iconView; BubbleExpandedView expandedView; private BubbleView mIconView; private BubbleExpandedView mExpandedView; private long mLastUpdated; private long mLastAccessed; private PackageManager mPm; private boolean mIsRemoved; public static String groupId(NotificationEntry entry) { UserHandle user = entry.notification.getUser(); Loading @@ -56,25 +56,25 @@ class Bubble { /** Used in tests when no UI is required. */ @VisibleForTesting(visibility = PRIVATE) Bubble(Context context, NotificationEntry e) { entry = e; mEntry = e; mKey = e.key; mLastUpdated = e.notification.getPostTime(); mGroupId = groupId(e); mPm = context.getPackageManager(); PackageManager pm = context.getPackageManager(); ApplicationInfo info; try { info = mPm.getApplicationInfo( entry.notification.getPackageName(), info = pm.getApplicationInfo( mEntry.notification.getPackageName(), PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_DIRECT_BOOT_AWARE); if (info != null) { mAppName = String.valueOf(mPm.getApplicationLabel(info)); mAppName = String.valueOf(pm.getApplicationLabel(info)); } } catch (PackageManager.NameNotFoundException unused) { mAppName = entry.notification.getPackageName(); mAppName = mEntry.notification.getPackageName(); } } Loading @@ -82,12 +82,16 @@ class Bubble { return mKey; } public NotificationEntry getEntry() { return mEntry; } public String getGroupId() { return mGroupId; } public String getPackageName() { return entry.notification.getPackageName(); return mEntry.notification.getPackageName(); } public String getAppName() { Loading @@ -99,22 +103,30 @@ class Bubble { } public void updateDotVisibility() { if (iconView != null) { iconView.updateDotVisibility(true /* animate */); if (mIconView != null) { mIconView.updateDotVisibility(true /* animate */); } } public BubbleView getIconView() { return mIconView; } public BubbleExpandedView getExpandedView() { return mExpandedView; } void inflate(LayoutInflater inflater, BubbleStackView stackView) { if (mInflated) { return; } iconView = (BubbleView) inflater.inflate( mIconView = (BubbleView) inflater.inflate( R.layout.bubble_view, stackView, false /* attachToRoot */); iconView.setNotif(entry); mIconView.setNotif(mEntry); expandedView = (BubbleExpandedView) inflater.inflate( mExpandedView = (BubbleExpandedView) inflater.inflate( R.layout.bubble_expanded_view, stackView, false /* attachToRoot */); expandedView.setEntry(entry, stackView, mAppName); mExpandedView.setEntry(mEntry, stackView, mAppName); mInflated = true; } Loading @@ -128,25 +140,33 @@ class Bubble { * and setting {@code false} actually means rendering the expanded view in transparent. */ void setContentVisibility(boolean visibility) { if (expandedView != null) { expandedView.setContentVisibility(visibility); if (mExpandedView != null) { mExpandedView.setContentVisibility(visibility); } } void setDismissed() { entry.setBubbleDismissed(true); void setRemoved() { mIsRemoved = true; // TODO: move this somewhere where it can be guaranteed not to run until safe from flicker if (expandedView != null) { expandedView.cleanUpExpandedState(); if (mExpandedView != null) { mExpandedView.cleanUpExpandedState(); } } void setRemoved(boolean removed) { mIsRemoved = removed; } public boolean isRemoved() { return mIsRemoved; } void setEntry(NotificationEntry entry) { this.entry = entry; this.mEntry = entry; mLastUpdated = entry.notification.getPostTime(); if (mInflated) { iconView.update(entry); expandedView.update(entry); mIconView.update(entry); mExpandedView.update(entry); } } Loading Loading @@ -175,7 +195,7 @@ class Bubble { * @return the display id of the virtual display on which bubble contents is drawn. */ int getDisplayId() { return expandedView != null ? expandedView.getVirtualDisplayId() : INVALID_DISPLAY; return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY; } /** Loading @@ -183,14 +203,14 @@ class Bubble { */ void markAsAccessedAt(long lastAccessedMillis) { mLastAccessed = lastAccessedMillis; entry.setShowInShadeWhenBubble(false); mEntry.setShowInShadeWhenBubble(false); } /** * @return whether bubble is from a notification associated with a foreground service. */ public boolean isOngoing() { return entry.isForegroundService(); return mEntry.isForegroundService(); } @Override Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +13 −11 Original line number Diff line number Diff line Loading @@ -408,7 +408,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // TEMP: refactor to change this to pass entry Bubble bubble = mBubbleData.getBubbleWithKey(key); if (bubble != null) { mBubbleData.notificationEntryRemoved(bubble.entry, reason); mBubbleData.notificationEntryRemoved(bubble.getEntry(), reason); } } Loading @@ -420,7 +420,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (!mBubbleData.hasBubbleWithKey(key)) { return false; } NotificationEntry entry = mBubbleData.getBubbleWithKey(key).entry; Bubble bubble = mBubbleData.getBubbleWithKey(key); NotificationEntry entry = bubble.getEntry(); final boolean isClearAll = reason == REASON_CANCEL_ALL; final boolean isUserDimiss = reason == REASON_CANCEL; Loading @@ -434,7 +435,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // The bubble notification sticks around in the data as long as the bubble is // not dismissed and the app hasn't cancelled the notification. boolean bubbleExtended = entry.isBubble() && !entry.isBubbleDismissed() boolean bubbleExtended = entry.isBubble() && !bubble.isRemoved() && userRemovedNotif; if (bubbleExtended) { entry.setShowInShadeWhenBubble(false); Loading @@ -443,7 +444,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } mNotificationEntryManager.updateNotifications(); return true; } else if (!userRemovedNotif && !entry.isBubbleDismissed()) { } else if (!userRemovedNotif && !bubble.isRemoved()) { // This wasn't a user removal so we should remove the bubble as well mBubbleData.notificationEntryRemoved(entry, DISMISS_NOTIF_CANCEL); return false; Loading Loading @@ -488,7 +489,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE); } else if (shouldBubble) { updateShowInShadeForSuppressNotification(entry); entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed Bubble b = mBubbleData.getBubbleWithKey(entry.key); b.setRemoved(false); // updates come back as bubbles even if dismissed updateBubble(entry); } } Loading Loading @@ -531,13 +533,13 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mStackView.removeBubble(bubble); if (!mBubbleData.hasBubbleWithKey(bubble.getKey()) && !bubble.entry.showInShadeWhenBubble()) { && !bubble.getEntry().showInShadeWhenBubble()) { // The bubble is gone & the notification is gone, time to actually remove it mNotificationEntryManager.performRemoveNotification(bubble.entry.notification, UNDEFINED_DISMISS_REASON); mNotificationEntryManager.performRemoveNotification( bubble.getEntry().notification, UNDEFINED_DISMISS_REASON); } else { // Update the flag for SysUI bubble.entry.notification.getNotification().flags &= ~FLAG_BUBBLE; bubble.getEntry().notification.getNotification().flags &= ~FLAG_BUBBLE; // Make sure NoMan knows it's not a bubble anymore so anyone querying it will // get right result back Loading Loading @@ -758,8 +760,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (expandedBubble.getDisplayId() == displayId) { mBubbleData.setExpanded(false); } if (expandedBubble.expandedView != null) { expandedBubble.expandedView.notifyDisplayEmpty(); if (expandedBubble.getExpandedView() != null) { expandedBubble.getExpandedView().notifyDisplayEmpty(); } } } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +4 −4 Original line number Diff line number Diff line Loading @@ -302,8 +302,8 @@ public class BubbleData { Bubble newSelected = mBubbles.get(newIndex); setSelectedBubbleInternal(newSelected); } bubbleToRemove.setDismissed(); maybeSendDeleteIntent(reason, bubbleToRemove.entry); bubbleToRemove.setRemoved(); maybeSendDeleteIntent(reason, bubbleToRemove.getEntry()); } public void dismissAll(@DismissReason int reason) { Loading @@ -317,8 +317,8 @@ public class BubbleData { setSelectedBubbleInternal(null); while (!mBubbles.isEmpty()) { Bubble bubble = mBubbles.remove(0); bubble.setDismissed(); maybeSendDeleteIntent(reason, bubble.entry); bubble.setRemoved(); maybeSendDeleteIntent(reason, bubble.getEntry()); mStateChange.bubbleRemoved(bubble, reason); } dispatchPendingChanges(); Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +38 −38 Original line number Diff line number Diff line Loading @@ -387,7 +387,7 @@ public class BubbleStackView extends FrameLayout { .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)); mExpandedViewYAnim.addEndListener((anim, cancelled, value, velocity) -> { if (mIsExpanded && mExpandedBubble != null) { mExpandedBubble.expandedView.updateView(); mExpandedBubble.getExpandedView().updateView(); } }); Loading @@ -411,7 +411,7 @@ public class BubbleStackView extends FrameLayout { mExpandedAnimationController.updateYPosition( // Update the insets after we're done translating otherwise position // calculation for them won't be correct. () -> mExpandedBubble.expandedView.updateInsets(insets)); () -> mExpandedBubble.getExpandedView().updateInsets(insets)); return view.onApplyWindowInsets(insets); }); Loading Loading @@ -463,8 +463,8 @@ public class BubbleStackView extends FrameLayout { */ public void onThemeChanged() { for (Bubble b: mBubbleData.getBubbles()) { b.iconView.updateViews(); b.expandedView.applyThemeAttrs(); b.getIconView().updateViews(); b.getExpandedView().applyThemeAttrs(); } } Loading Loading @@ -580,7 +580,7 @@ public class BubbleStackView extends FrameLayout { } Bubble topBubble = mBubbleData.getBubbles().get(0); String appName = topBubble.getAppName(); Notification notification = topBubble.entry.notification.getNotification(); Notification notification = topBubble.getEntry().notification.getNotification(); CharSequence titleCharSeq = notification.extras.getCharSequence(Notification.EXTRA_TITLE); String titleStr = getResources().getString(R.string.stream_notification); if (titleCharSeq != null) { Loading Loading @@ -654,7 +654,7 @@ public class BubbleStackView extends FrameLayout { * The {@link BubbleView} that is expanded, null if one does not exist. */ BubbleView getExpandedBubbleView() { return mExpandedBubble != null ? mExpandedBubble.iconView : null; return mExpandedBubble != null ? mExpandedBubble.getIconView() : null; } /** Loading @@ -675,7 +675,7 @@ public class BubbleStackView extends FrameLayout { Bubble bubbleToExpand = mBubbleData.getBubbleWithKey(key); if (bubbleToExpand != null) { setSelectedBubble(bubbleToExpand); bubbleToExpand.entry.setShowInShadeWhenBubble(false); bubbleToExpand.getEntry().setShowInShadeWhenBubble(false); setExpanded(true); } } Loading @@ -699,14 +699,14 @@ public class BubbleStackView extends FrameLayout { Log.d(TAG, "addBubble: " + bubble); } bubble.inflate(mInflater, this); bubble.iconView.setBubbleIconFactory(mBubbleIconFactory); bubble.iconView.updateViews(); bubble.getIconView().setBubbleIconFactory(mBubbleIconFactory); bubble.getIconView().updateViews(); mBubbleContainer.addView(bubble.iconView, 0, mBubbleContainer.addView(bubble.getIconView(), 0, new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); ViewClippingUtil.setClippingDeactivated(bubble.iconView, true, mClippingParameters); if (bubble.iconView != null) { bubble.iconView.setSuppressDot(mSuppressNewDot, false /* animate */); ViewClippingUtil.setClippingDeactivated(bubble.getIconView(), true, mClippingParameters); if (bubble.getIconView() != null) { bubble.getIconView().setSuppressDot(mSuppressNewDot, false /* animate */); } animateInFlyoutForBubble(bubble); requestUpdate(); Loading @@ -720,7 +720,7 @@ public class BubbleStackView extends FrameLayout { Log.d(TAG, "removeBubble: " + bubble); } // Remove it from the views int removedIndex = mBubbleContainer.indexOfChild(bubble.iconView); int removedIndex = mBubbleContainer.indexOfChild(bubble.getIconView()); if (removedIndex >= 0) { mBubbleContainer.removeViewAt(removedIndex); logBubbleEvent(bubble, StatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED); Loading @@ -740,7 +740,7 @@ public class BubbleStackView extends FrameLayout { public void updateBubbleOrder(List<Bubble> bubbles) { for (int i = 0; i < bubbles.size(); i++) { Bubble bubble = bubbles.get(i); mBubbleContainer.reorderView(bubble.iconView, i); mBubbleContainer.reorderView(bubble.getIconView(), i); } } Loading Loading @@ -774,8 +774,8 @@ public class BubbleStackView extends FrameLayout { requestUpdate(); logBubbleEvent(previouslySelected, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); logBubbleEvent(bubbleToSelect, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); notifyExpansionChanged(previouslySelected.entry, false /* expanded */); notifyExpansionChanged(bubbleToSelect == null ? null : bubbleToSelect.entry, notifyExpansionChanged(previouslySelected.getEntry(), false /* expanded */); notifyExpansionChanged(bubbleToSelect == null ? null : bubbleToSelect.getEntry(), true /* expanded */); }); } Loading Loading @@ -803,7 +803,7 @@ public class BubbleStackView extends FrameLayout { logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED); } notifyExpansionChanged(mExpandedBubble.entry, mIsExpanded); notifyExpansionChanged(mExpandedBubble.getEntry(), mIsExpanded); } /** Loading Loading @@ -1353,7 +1353,7 @@ public class BubbleStackView extends FrameLayout { */ @VisibleForTesting void animateInFlyoutForBubble(Bubble bubble) { final CharSequence updateMessage = bubble.entry.getUpdateMessage(getContext()); final CharSequence updateMessage = bubble.getEntry().getUpdateMessage(getContext()); // Show the message if one exists, and we're not expanded or animating expansion. if (updateMessage != null Loading @@ -1361,9 +1361,9 @@ public class BubbleStackView extends FrameLayout { && !mIsExpansionAnimating && !mIsGestureInProgress && !mSuppressFlyout) { if (bubble.iconView != null) { if (bubble.getIconView() != null) { // Temporarily suppress the dot while the flyout is visible. bubble.iconView.setSuppressDot( bubble.getIconView().setSuppressDot( true /* suppressDot */, false /* animate */); mFlyoutDragDeltaX = 0f; Loading @@ -1374,14 +1374,14 @@ public class BubbleStackView extends FrameLayout { } mAfterFlyoutHides = () -> { if (bubble.iconView == null) { if (bubble.getIconView() == null) { return; } // If we're going to suppress the dot, make it visible first so it'll // visibly animate away. if (mSuppressNewDot) { bubble.iconView.setSuppressDot( bubble.getIconView().setSuppressDot( false /* suppressDot */, false /* animate */); } Loading @@ -1389,7 +1389,7 @@ public class BubbleStackView extends FrameLayout { // stop suppressing it with no animation (since the flyout has // transformed into the dot). If we are suppressing due to DND, animate // it away. bubble.iconView.setSuppressDot( bubble.getIconView().setSuppressDot( mSuppressNewDot /* suppressDot */, mSuppressNewDot /* animate */); }; Loading @@ -1405,7 +1405,7 @@ public class BubbleStackView extends FrameLayout { mFlyout.showFlyout( updateMessage, mStackAnimationController.getStackPosition(), getWidth(), mStackAnimationController.isStackOnLeftSide(), bubble.iconView.getBadgeColor(), mAfterFlyoutHides); bubble.getIconView().getBadgeColor(), mAfterFlyoutHides); }); } Loading Loading @@ -1485,8 +1485,8 @@ public class BubbleStackView extends FrameLayout { } mExpandedViewContainer.removeAllViews(); if (mExpandedBubble != null && mIsExpanded) { mExpandedViewContainer.addView(mExpandedBubble.expandedView); mExpandedBubble.expandedView.populateExpandedView(); mExpandedViewContainer.addView(mExpandedBubble.getExpandedView()); mExpandedBubble.getExpandedView().populateExpandedView(); mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE); mExpandedViewContainer.setAlpha(1.0f); } Loading @@ -1501,12 +1501,12 @@ public class BubbleStackView extends FrameLayout { if (mIsExpanded) { // First update the view so that it calculates a new height (ensuring the y position // calculation is correct) mExpandedBubble.expandedView.updateView(); mExpandedBubble.getExpandedView().updateView(); final float y = getExpandedViewY(); if (!mExpandedViewYAnim.isRunning()) { // We're not animating so set the value mExpandedViewContainer.setTranslationY(y); mExpandedBubble.expandedView.updateView(); mExpandedBubble.getExpandedView().updateView(); } else { // We are animating so update the value; there is an end listener on the animator // that will ensure expandedeView.updateView gets called. Loading Loading @@ -1552,7 +1552,7 @@ public class BubbleStackView extends FrameLayout { // Remove padding when deriving pointer location from bubbles. float bubbleCenter = bubbleLeftFromScreenLeft + halfBubble - mExpandedViewPadding; expandedBubble.expandedView.setPointerPosition(bubbleCenter); expandedBubble.getExpandedView().setPointerPosition(bubbleCenter); } /** Loading @@ -1573,7 +1573,7 @@ public class BubbleStackView extends FrameLayout { if (bubble == null) { return 0; } return mBubbleContainer.indexOfChild(bubble.iconView); return mBubbleContainer.indexOfChild(bubble.getIconView()); } /** Loading Loading @@ -1606,8 +1606,8 @@ public class BubbleStackView extends FrameLayout { * @param action the user interaction enum. */ private void logBubbleEvent(@Nullable Bubble bubble, int action) { if (bubble == null || bubble.entry == null || bubble.entry.notification == null) { if (bubble == null || bubble.getEntry() == null || bubble.getEntry().notification == null) { StatsLog.write(StatsLog.BUBBLE_UI_CHANGED, null /* package name */, null /* notification channel */, Loading @@ -1621,7 +1621,7 @@ public class BubbleStackView extends FrameLayout { false /* on-going bubble */, false /* isAppForeground (unused) */); } else { StatusBarNotification notification = bubble.entry.notification; StatusBarNotification notification = bubble.getEntry().notification; StatsLog.write(StatsLog.BUBBLE_UI_CHANGED, notification.getPackageName(), notification.getNotification().getChannelId(), Loading @@ -1631,8 +1631,8 @@ public class BubbleStackView extends FrameLayout { action, getNormalizedXPosition(), getNormalizedYPosition(), bubble.entry.showInShadeWhenBubble(), bubble.entry.isForegroundService(), bubble.getEntry().showInShadeWhenBubble(), bubble.getEntry().isForegroundService(), false /* isAppForeground (unused) */); } } Loading @@ -1645,7 +1645,7 @@ public class BubbleStackView extends FrameLayout { if (!isExpanded()) { return false; } return mExpandedBubble.expandedView.performBackPressIfNeeded(); return mExpandedBubble.getExpandedView().performBackPressIfNeeded(); } /** For debugging only */ Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +0 −13 Original line number Diff line number Diff line Loading @@ -163,11 +163,6 @@ public final class NotificationEntry { */ private boolean mShowInShadeWhenBubble = true; /** * Whether the user has dismissed this notification when it was in bubble form. */ private boolean mUserDismissedBubble; /** * Whether this notification is shown to the user as a high priority notification: visible on * the lock screen/status bar and in the top section in the shade. Loading Loading @@ -225,14 +220,6 @@ public final class NotificationEntry { return (notification.getNotification().flags & FLAG_BUBBLE) != 0; } public void setBubbleDismissed(boolean userDismissed) { mUserDismissedBubble = userDismissed; } public boolean isBubbleDismissed() { return mUserDismissedBubble; } /** * Sets whether this notification should be shown in the shade when it is also displayed as a * bubble. Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +49 −29 Original line number Diff line number Diff line Loading @@ -39,14 +39,14 @@ class Bubble { private final String mKey; private final String mGroupId; private String mAppName; private NotificationEntry mEntry; private boolean mInflated; public NotificationEntry entry; BubbleView iconView; BubbleExpandedView expandedView; private BubbleView mIconView; private BubbleExpandedView mExpandedView; private long mLastUpdated; private long mLastAccessed; private PackageManager mPm; private boolean mIsRemoved; public static String groupId(NotificationEntry entry) { UserHandle user = entry.notification.getUser(); Loading @@ -56,25 +56,25 @@ class Bubble { /** Used in tests when no UI is required. */ @VisibleForTesting(visibility = PRIVATE) Bubble(Context context, NotificationEntry e) { entry = e; mEntry = e; mKey = e.key; mLastUpdated = e.notification.getPostTime(); mGroupId = groupId(e); mPm = context.getPackageManager(); PackageManager pm = context.getPackageManager(); ApplicationInfo info; try { info = mPm.getApplicationInfo( entry.notification.getPackageName(), info = pm.getApplicationInfo( mEntry.notification.getPackageName(), PackageManager.MATCH_UNINSTALLED_PACKAGES | PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.MATCH_DIRECT_BOOT_UNAWARE | PackageManager.MATCH_DIRECT_BOOT_AWARE); if (info != null) { mAppName = String.valueOf(mPm.getApplicationLabel(info)); mAppName = String.valueOf(pm.getApplicationLabel(info)); } } catch (PackageManager.NameNotFoundException unused) { mAppName = entry.notification.getPackageName(); mAppName = mEntry.notification.getPackageName(); } } Loading @@ -82,12 +82,16 @@ class Bubble { return mKey; } public NotificationEntry getEntry() { return mEntry; } public String getGroupId() { return mGroupId; } public String getPackageName() { return entry.notification.getPackageName(); return mEntry.notification.getPackageName(); } public String getAppName() { Loading @@ -99,22 +103,30 @@ class Bubble { } public void updateDotVisibility() { if (iconView != null) { iconView.updateDotVisibility(true /* animate */); if (mIconView != null) { mIconView.updateDotVisibility(true /* animate */); } } public BubbleView getIconView() { return mIconView; } public BubbleExpandedView getExpandedView() { return mExpandedView; } void inflate(LayoutInflater inflater, BubbleStackView stackView) { if (mInflated) { return; } iconView = (BubbleView) inflater.inflate( mIconView = (BubbleView) inflater.inflate( R.layout.bubble_view, stackView, false /* attachToRoot */); iconView.setNotif(entry); mIconView.setNotif(mEntry); expandedView = (BubbleExpandedView) inflater.inflate( mExpandedView = (BubbleExpandedView) inflater.inflate( R.layout.bubble_expanded_view, stackView, false /* attachToRoot */); expandedView.setEntry(entry, stackView, mAppName); mExpandedView.setEntry(mEntry, stackView, mAppName); mInflated = true; } Loading @@ -128,25 +140,33 @@ class Bubble { * and setting {@code false} actually means rendering the expanded view in transparent. */ void setContentVisibility(boolean visibility) { if (expandedView != null) { expandedView.setContentVisibility(visibility); if (mExpandedView != null) { mExpandedView.setContentVisibility(visibility); } } void setDismissed() { entry.setBubbleDismissed(true); void setRemoved() { mIsRemoved = true; // TODO: move this somewhere where it can be guaranteed not to run until safe from flicker if (expandedView != null) { expandedView.cleanUpExpandedState(); if (mExpandedView != null) { mExpandedView.cleanUpExpandedState(); } } void setRemoved(boolean removed) { mIsRemoved = removed; } public boolean isRemoved() { return mIsRemoved; } void setEntry(NotificationEntry entry) { this.entry = entry; this.mEntry = entry; mLastUpdated = entry.notification.getPostTime(); if (mInflated) { iconView.update(entry); expandedView.update(entry); mIconView.update(entry); mExpandedView.update(entry); } } Loading Loading @@ -175,7 +195,7 @@ class Bubble { * @return the display id of the virtual display on which bubble contents is drawn. */ int getDisplayId() { return expandedView != null ? expandedView.getVirtualDisplayId() : INVALID_DISPLAY; return mExpandedView != null ? mExpandedView.getVirtualDisplayId() : INVALID_DISPLAY; } /** Loading @@ -183,14 +203,14 @@ class Bubble { */ void markAsAccessedAt(long lastAccessedMillis) { mLastAccessed = lastAccessedMillis; entry.setShowInShadeWhenBubble(false); mEntry.setShowInShadeWhenBubble(false); } /** * @return whether bubble is from a notification associated with a foreground service. */ public boolean isOngoing() { return entry.isForegroundService(); return mEntry.isForegroundService(); } @Override Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +13 −11 Original line number Diff line number Diff line Loading @@ -408,7 +408,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // TEMP: refactor to change this to pass entry Bubble bubble = mBubbleData.getBubbleWithKey(key); if (bubble != null) { mBubbleData.notificationEntryRemoved(bubble.entry, reason); mBubbleData.notificationEntryRemoved(bubble.getEntry(), reason); } } Loading @@ -420,7 +420,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (!mBubbleData.hasBubbleWithKey(key)) { return false; } NotificationEntry entry = mBubbleData.getBubbleWithKey(key).entry; Bubble bubble = mBubbleData.getBubbleWithKey(key); NotificationEntry entry = bubble.getEntry(); final boolean isClearAll = reason == REASON_CANCEL_ALL; final boolean isUserDimiss = reason == REASON_CANCEL; Loading @@ -434,7 +435,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // The bubble notification sticks around in the data as long as the bubble is // not dismissed and the app hasn't cancelled the notification. boolean bubbleExtended = entry.isBubble() && !entry.isBubbleDismissed() boolean bubbleExtended = entry.isBubble() && !bubble.isRemoved() && userRemovedNotif; if (bubbleExtended) { entry.setShowInShadeWhenBubble(false); Loading @@ -443,7 +444,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi } mNotificationEntryManager.updateNotifications(); return true; } else if (!userRemovedNotif && !entry.isBubbleDismissed()) { } else if (!userRemovedNotif && !bubble.isRemoved()) { // This wasn't a user removal so we should remove the bubble as well mBubbleData.notificationEntryRemoved(entry, DISMISS_NOTIF_CANCEL); return false; Loading Loading @@ -488,7 +489,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE); } else if (shouldBubble) { updateShowInShadeForSuppressNotification(entry); entry.setBubbleDismissed(false); // updates come back as bubbles even if dismissed Bubble b = mBubbleData.getBubbleWithKey(entry.key); b.setRemoved(false); // updates come back as bubbles even if dismissed updateBubble(entry); } } Loading Loading @@ -531,13 +533,13 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mStackView.removeBubble(bubble); if (!mBubbleData.hasBubbleWithKey(bubble.getKey()) && !bubble.entry.showInShadeWhenBubble()) { && !bubble.getEntry().showInShadeWhenBubble()) { // The bubble is gone & the notification is gone, time to actually remove it mNotificationEntryManager.performRemoveNotification(bubble.entry.notification, UNDEFINED_DISMISS_REASON); mNotificationEntryManager.performRemoveNotification( bubble.getEntry().notification, UNDEFINED_DISMISS_REASON); } else { // Update the flag for SysUI bubble.entry.notification.getNotification().flags &= ~FLAG_BUBBLE; bubble.getEntry().notification.getNotification().flags &= ~FLAG_BUBBLE; // Make sure NoMan knows it's not a bubble anymore so anyone querying it will // get right result back Loading Loading @@ -758,8 +760,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi if (expandedBubble.getDisplayId() == displayId) { mBubbleData.setExpanded(false); } if (expandedBubble.expandedView != null) { expandedBubble.expandedView.notifyDisplayEmpty(); if (expandedBubble.getExpandedView() != null) { expandedBubble.getExpandedView().notifyDisplayEmpty(); } } } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +4 −4 Original line number Diff line number Diff line Loading @@ -302,8 +302,8 @@ public class BubbleData { Bubble newSelected = mBubbles.get(newIndex); setSelectedBubbleInternal(newSelected); } bubbleToRemove.setDismissed(); maybeSendDeleteIntent(reason, bubbleToRemove.entry); bubbleToRemove.setRemoved(); maybeSendDeleteIntent(reason, bubbleToRemove.getEntry()); } public void dismissAll(@DismissReason int reason) { Loading @@ -317,8 +317,8 @@ public class BubbleData { setSelectedBubbleInternal(null); while (!mBubbles.isEmpty()) { Bubble bubble = mBubbles.remove(0); bubble.setDismissed(); maybeSendDeleteIntent(reason, bubble.entry); bubble.setRemoved(); maybeSendDeleteIntent(reason, bubble.getEntry()); mStateChange.bubbleRemoved(bubble, reason); } dispatchPendingChanges(); Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +38 −38 Original line number Diff line number Diff line Loading @@ -387,7 +387,7 @@ public class BubbleStackView extends FrameLayout { .setDampingRatio(SpringForce.DAMPING_RATIO_LOW_BOUNCY)); mExpandedViewYAnim.addEndListener((anim, cancelled, value, velocity) -> { if (mIsExpanded && mExpandedBubble != null) { mExpandedBubble.expandedView.updateView(); mExpandedBubble.getExpandedView().updateView(); } }); Loading @@ -411,7 +411,7 @@ public class BubbleStackView extends FrameLayout { mExpandedAnimationController.updateYPosition( // Update the insets after we're done translating otherwise position // calculation for them won't be correct. () -> mExpandedBubble.expandedView.updateInsets(insets)); () -> mExpandedBubble.getExpandedView().updateInsets(insets)); return view.onApplyWindowInsets(insets); }); Loading Loading @@ -463,8 +463,8 @@ public class BubbleStackView extends FrameLayout { */ public void onThemeChanged() { for (Bubble b: mBubbleData.getBubbles()) { b.iconView.updateViews(); b.expandedView.applyThemeAttrs(); b.getIconView().updateViews(); b.getExpandedView().applyThemeAttrs(); } } Loading Loading @@ -580,7 +580,7 @@ public class BubbleStackView extends FrameLayout { } Bubble topBubble = mBubbleData.getBubbles().get(0); String appName = topBubble.getAppName(); Notification notification = topBubble.entry.notification.getNotification(); Notification notification = topBubble.getEntry().notification.getNotification(); CharSequence titleCharSeq = notification.extras.getCharSequence(Notification.EXTRA_TITLE); String titleStr = getResources().getString(R.string.stream_notification); if (titleCharSeq != null) { Loading Loading @@ -654,7 +654,7 @@ public class BubbleStackView extends FrameLayout { * The {@link BubbleView} that is expanded, null if one does not exist. */ BubbleView getExpandedBubbleView() { return mExpandedBubble != null ? mExpandedBubble.iconView : null; return mExpandedBubble != null ? mExpandedBubble.getIconView() : null; } /** Loading @@ -675,7 +675,7 @@ public class BubbleStackView extends FrameLayout { Bubble bubbleToExpand = mBubbleData.getBubbleWithKey(key); if (bubbleToExpand != null) { setSelectedBubble(bubbleToExpand); bubbleToExpand.entry.setShowInShadeWhenBubble(false); bubbleToExpand.getEntry().setShowInShadeWhenBubble(false); setExpanded(true); } } Loading @@ -699,14 +699,14 @@ public class BubbleStackView extends FrameLayout { Log.d(TAG, "addBubble: " + bubble); } bubble.inflate(mInflater, this); bubble.iconView.setBubbleIconFactory(mBubbleIconFactory); bubble.iconView.updateViews(); bubble.getIconView().setBubbleIconFactory(mBubbleIconFactory); bubble.getIconView().updateViews(); mBubbleContainer.addView(bubble.iconView, 0, mBubbleContainer.addView(bubble.getIconView(), 0, new FrameLayout.LayoutParams(WRAP_CONTENT, WRAP_CONTENT)); ViewClippingUtil.setClippingDeactivated(bubble.iconView, true, mClippingParameters); if (bubble.iconView != null) { bubble.iconView.setSuppressDot(mSuppressNewDot, false /* animate */); ViewClippingUtil.setClippingDeactivated(bubble.getIconView(), true, mClippingParameters); if (bubble.getIconView() != null) { bubble.getIconView().setSuppressDot(mSuppressNewDot, false /* animate */); } animateInFlyoutForBubble(bubble); requestUpdate(); Loading @@ -720,7 +720,7 @@ public class BubbleStackView extends FrameLayout { Log.d(TAG, "removeBubble: " + bubble); } // Remove it from the views int removedIndex = mBubbleContainer.indexOfChild(bubble.iconView); int removedIndex = mBubbleContainer.indexOfChild(bubble.getIconView()); if (removedIndex >= 0) { mBubbleContainer.removeViewAt(removedIndex); logBubbleEvent(bubble, StatsLog.BUBBLE_UICHANGED__ACTION__DISMISSED); Loading @@ -740,7 +740,7 @@ public class BubbleStackView extends FrameLayout { public void updateBubbleOrder(List<Bubble> bubbles) { for (int i = 0; i < bubbles.size(); i++) { Bubble bubble = bubbles.get(i); mBubbleContainer.reorderView(bubble.iconView, i); mBubbleContainer.reorderView(bubble.getIconView(), i); } } Loading Loading @@ -774,8 +774,8 @@ public class BubbleStackView extends FrameLayout { requestUpdate(); logBubbleEvent(previouslySelected, StatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED); logBubbleEvent(bubbleToSelect, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); notifyExpansionChanged(previouslySelected.entry, false /* expanded */); notifyExpansionChanged(bubbleToSelect == null ? null : bubbleToSelect.entry, notifyExpansionChanged(previouslySelected.getEntry(), false /* expanded */); notifyExpansionChanged(bubbleToSelect == null ? null : bubbleToSelect.getEntry(), true /* expanded */); }); } Loading Loading @@ -803,7 +803,7 @@ public class BubbleStackView extends FrameLayout { logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED); logBubbleEvent(mExpandedBubble, StatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED); } notifyExpansionChanged(mExpandedBubble.entry, mIsExpanded); notifyExpansionChanged(mExpandedBubble.getEntry(), mIsExpanded); } /** Loading Loading @@ -1353,7 +1353,7 @@ public class BubbleStackView extends FrameLayout { */ @VisibleForTesting void animateInFlyoutForBubble(Bubble bubble) { final CharSequence updateMessage = bubble.entry.getUpdateMessage(getContext()); final CharSequence updateMessage = bubble.getEntry().getUpdateMessage(getContext()); // Show the message if one exists, and we're not expanded or animating expansion. if (updateMessage != null Loading @@ -1361,9 +1361,9 @@ public class BubbleStackView extends FrameLayout { && !mIsExpansionAnimating && !mIsGestureInProgress && !mSuppressFlyout) { if (bubble.iconView != null) { if (bubble.getIconView() != null) { // Temporarily suppress the dot while the flyout is visible. bubble.iconView.setSuppressDot( bubble.getIconView().setSuppressDot( true /* suppressDot */, false /* animate */); mFlyoutDragDeltaX = 0f; Loading @@ -1374,14 +1374,14 @@ public class BubbleStackView extends FrameLayout { } mAfterFlyoutHides = () -> { if (bubble.iconView == null) { if (bubble.getIconView() == null) { return; } // If we're going to suppress the dot, make it visible first so it'll // visibly animate away. if (mSuppressNewDot) { bubble.iconView.setSuppressDot( bubble.getIconView().setSuppressDot( false /* suppressDot */, false /* animate */); } Loading @@ -1389,7 +1389,7 @@ public class BubbleStackView extends FrameLayout { // stop suppressing it with no animation (since the flyout has // transformed into the dot). If we are suppressing due to DND, animate // it away. bubble.iconView.setSuppressDot( bubble.getIconView().setSuppressDot( mSuppressNewDot /* suppressDot */, mSuppressNewDot /* animate */); }; Loading @@ -1405,7 +1405,7 @@ public class BubbleStackView extends FrameLayout { mFlyout.showFlyout( updateMessage, mStackAnimationController.getStackPosition(), getWidth(), mStackAnimationController.isStackOnLeftSide(), bubble.iconView.getBadgeColor(), mAfterFlyoutHides); bubble.getIconView().getBadgeColor(), mAfterFlyoutHides); }); } Loading Loading @@ -1485,8 +1485,8 @@ public class BubbleStackView extends FrameLayout { } mExpandedViewContainer.removeAllViews(); if (mExpandedBubble != null && mIsExpanded) { mExpandedViewContainer.addView(mExpandedBubble.expandedView); mExpandedBubble.expandedView.populateExpandedView(); mExpandedViewContainer.addView(mExpandedBubble.getExpandedView()); mExpandedBubble.getExpandedView().populateExpandedView(); mExpandedViewContainer.setVisibility(mIsExpanded ? VISIBLE : GONE); mExpandedViewContainer.setAlpha(1.0f); } Loading @@ -1501,12 +1501,12 @@ public class BubbleStackView extends FrameLayout { if (mIsExpanded) { // First update the view so that it calculates a new height (ensuring the y position // calculation is correct) mExpandedBubble.expandedView.updateView(); mExpandedBubble.getExpandedView().updateView(); final float y = getExpandedViewY(); if (!mExpandedViewYAnim.isRunning()) { // We're not animating so set the value mExpandedViewContainer.setTranslationY(y); mExpandedBubble.expandedView.updateView(); mExpandedBubble.getExpandedView().updateView(); } else { // We are animating so update the value; there is an end listener on the animator // that will ensure expandedeView.updateView gets called. Loading Loading @@ -1552,7 +1552,7 @@ public class BubbleStackView extends FrameLayout { // Remove padding when deriving pointer location from bubbles. float bubbleCenter = bubbleLeftFromScreenLeft + halfBubble - mExpandedViewPadding; expandedBubble.expandedView.setPointerPosition(bubbleCenter); expandedBubble.getExpandedView().setPointerPosition(bubbleCenter); } /** Loading @@ -1573,7 +1573,7 @@ public class BubbleStackView extends FrameLayout { if (bubble == null) { return 0; } return mBubbleContainer.indexOfChild(bubble.iconView); return mBubbleContainer.indexOfChild(bubble.getIconView()); } /** Loading Loading @@ -1606,8 +1606,8 @@ public class BubbleStackView extends FrameLayout { * @param action the user interaction enum. */ private void logBubbleEvent(@Nullable Bubble bubble, int action) { if (bubble == null || bubble.entry == null || bubble.entry.notification == null) { if (bubble == null || bubble.getEntry() == null || bubble.getEntry().notification == null) { StatsLog.write(StatsLog.BUBBLE_UI_CHANGED, null /* package name */, null /* notification channel */, Loading @@ -1621,7 +1621,7 @@ public class BubbleStackView extends FrameLayout { false /* on-going bubble */, false /* isAppForeground (unused) */); } else { StatusBarNotification notification = bubble.entry.notification; StatusBarNotification notification = bubble.getEntry().notification; StatsLog.write(StatsLog.BUBBLE_UI_CHANGED, notification.getPackageName(), notification.getNotification().getChannelId(), Loading @@ -1631,8 +1631,8 @@ public class BubbleStackView extends FrameLayout { action, getNormalizedXPosition(), getNormalizedYPosition(), bubble.entry.showInShadeWhenBubble(), bubble.entry.isForegroundService(), bubble.getEntry().showInShadeWhenBubble(), bubble.getEntry().isForegroundService(), false /* isAppForeground (unused) */); } } Loading @@ -1645,7 +1645,7 @@ public class BubbleStackView extends FrameLayout { if (!isExpanded()) { return false; } return mExpandedBubble.expandedView.performBackPressIfNeeded(); return mExpandedBubble.getExpandedView().performBackPressIfNeeded(); } /** For debugging only */ Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/NotificationEntry.java +0 −13 Original line number Diff line number Diff line Loading @@ -163,11 +163,6 @@ public final class NotificationEntry { */ private boolean mShowInShadeWhenBubble = true; /** * Whether the user has dismissed this notification when it was in bubble form. */ private boolean mUserDismissedBubble; /** * Whether this notification is shown to the user as a high priority notification: visible on * the lock screen/status bar and in the top section in the shade. Loading Loading @@ -225,14 +220,6 @@ public final class NotificationEntry { return (notification.getNotification().flags & FLAG_BUBBLE) != 0; } public void setBubbleDismissed(boolean userDismissed) { mUserDismissedBubble = userDismissed; } public boolean isBubbleDismissed() { return mUserDismissedBubble; } /** * Sets whether this notification should be shown in the shade when it is also displayed as a * bubble. Loading