Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +33 −11 Original line number Diff line number Diff line Loading @@ -61,6 +61,14 @@ class Bubble { private long mLastAccessed; private boolean mIsRemoved; /** * Whether this notification should be shown in the shade when it is also displayed as a bubble. * * <p>When a notification is a bubble we don't show it in the shade once the bubble has been * expanded</p> */ private boolean mShowInShadeWhenBubble = true; public static String groupId(NotificationEntry entry) { UserHandle user = entry.notification.getUser(); return user.getIdentifier() + "|" + entry.notification.getPackageName(); Loading Loading @@ -99,14 +107,6 @@ class Bubble { return mEntry; } public boolean showInShadeWhenBubble() { return mEntry.showInShadeWhenBubble(); } public void setShowInShadeWhenBubble(boolean showInShade) { mEntry.setShowInShadeWhenBubble(showInShade); } public String getGroupId() { return mGroupId; } Loading @@ -129,11 +129,11 @@ class Bubble { } } public BubbleView getIconView() { BubbleView getIconView() { return mIconView; } public BubbleExpandedView getExpandedView() { BubbleExpandedView getExpandedView() { return mExpandedView; } Loading Loading @@ -182,7 +182,7 @@ class Bubble { return mIsRemoved; } void setEntry(NotificationEntry entry) { void updateEntry(NotificationEntry entry) { mEntry = entry; mLastUpdated = entry.notification.getPostTime(); if (mInflated) { Loading Loading @@ -227,6 +227,23 @@ class Bubble { setShowInShadeWhenBubble(false); } /** * Whether this notification should be shown in the shade when it is also displayed as a * bubble. */ boolean showInShadeWhenBubble() { return !mEntry.isRowDismissed() && !shouldSuppressNotification() && (!mEntry.isClearable() || mShowInShadeWhenBubble); } /** * Sets whether this notification should be shown in the shade when it is also displayed as a * bubble. */ void setShowInShadeWhenBubble(boolean showInShade) { mShowInShadeWhenBubble = showInShade; } /** * Returns whether the notification for this bubble is a foreground service. It shows that this * is an ongoing bubble. Loading Loading @@ -355,6 +372,11 @@ class Bubble { return 0; } private boolean shouldSuppressNotification() { return mEntry.getBubbleMetadata() != null && mEntry.getBubbleMetadata().isNotificationSuppressed(); } @Override public String toString() { return "Bubble{" + mKey + '}'; Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +12 −25 Original line number Diff line number Diff line Loading @@ -80,7 +80,6 @@ import com.android.systemui.statusbar.notification.NotificationEntryListener; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; Loading Loading @@ -345,6 +344,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mBubbleData.setExpanded(false /* expanded */); } /** * Whether (1) there is a bubble associated with the provided key and * (2) if the notification for that bubble is hidden from the shade. * * False if there isn't a bubble or if the notification for that bubble appears in the shade. */ public boolean isBubbleNotificationSuppressedFromShade(String key) { return mBubbleData.hasBubbleWithKey(key) && !mBubbleData.getBubbleWithKey(key).showInShadeWhenBubble(); } void selectBubble(Bubble bubble) { mBubbleData.setSelectedBubble(bubble); } Loading Loading @@ -438,7 +448,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi boolean bubbleExtended = entry.isBubble() && !bubble.isRemoved() && userRemovedNotif; if (bubbleExtended) { entry.setShowInShadeWhenBubble(false); bubble.setShowInShadeWhenBubble(false); if (mStackView != null) { mStackView.updateDotVisibility(entry.key); } Loading @@ -457,17 +467,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi private final NotificationEntryListener mEntryListener = new NotificationEntryListener() { @Override public void onPendingEntryAdded(NotificationEntry entry) { if (!areBubblesEnabled(mContext)) { return; } if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && canLaunchInActivityView(mContext, entry)) { updateShowInShadeForSuppressNotification(entry); } } @Override public void onEntryInflated(NotificationEntry entry, @InflationFlag int inflatedFlags) { if (!areBubblesEnabled(mContext)) { return; } Loading @@ -488,7 +487,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // It was previously a bubble but no longer a bubble -- lets remove it removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE); } else if (shouldBubble) { updateShowInShadeForSuppressNotification(entry); Bubble b = mBubbleData.getBubbleWithKey(entry.key); b.setRemoved(false); // updates come back as bubbles even if dismissed updateBubble(entry); Loading Loading @@ -683,17 +681,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi return mStackView; } private void updateShowInShadeForSuppressNotification(NotificationEntry entry) { boolean suppressNotification = entry.getBubbleMetadata() != null && entry.getBubbleMetadata().isNotificationSuppressed(); Bubble b = mBubbleData.getBubbleWithKey(entry.key); if (b != null && mBubbleData.getSelectedBubble() == b && mBubbleData.isExpanded()) { // If we're expanded & selected don't show in shade suppressNotification = true; } entry.setShowInShadeWhenBubble(!suppressNotification); } static String formatBubblesString(List<Bubble> bubbles, Bubble selected) { StringBuilder sb = new StringBuilder(); for (Bubble bubble : bubbles) { Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +2 −1 Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ public class BubbleData { trim(); } else { // Updates an existing bubble bubble.setEntry(entry); bubble.updateEntry(entry); doUpdate(bubble); } if (shouldAutoExpand(entry)) { Loading @@ -187,6 +187,7 @@ public class BubbleData { } else if (mSelectedBubble == null) { setSelectedBubbleInternal(bubble); } bubble.setShowInShadeWhenBubble(!mExpanded || mSelectedBubble != bubble); dispatchPendingChanges(); } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +5 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import android.view.View; import android.view.ViewGroup; import com.android.systemui.R; import com.android.systemui.bubbles.BubbleData; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationEntryManager; Loading Loading @@ -79,7 +79,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle * possible. */ private final boolean mAlwaysExpandNonGroupedNotification; private final BubbleData mBubbleData; private final BubbleController mBubbleController; private final DynamicPrivacyController mDynamicPrivacyController; private final KeyguardBypassController mBypassController; Loading @@ -97,8 +97,8 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle StatusBarStateController statusBarStateController, NotificationEntryManager notificationEntryManager, Lazy<ShadeController> shadeController, BubbleData bubbleData, KeyguardBypassController bypassController, BubbleController bubbleController, DynamicPrivacyController privacyController) { mLockscreenUserManager = notificationLockscreenUserManager; mBypassController = bypassController; Loading @@ -110,7 +110,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle Resources res = context.getResources(); mAlwaysExpandNonGroupedNotification = res.getBoolean(R.bool.config_alwaysExpandNonGroupedNotifications); mBubbleData = bubbleData; mBubbleController = bubbleController; mDynamicPrivacyController = privacyController; privacyController.addListener(this); } Loading @@ -136,7 +136,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle for (int i = 0; i < N; i++) { NotificationEntry ent = activeNotifications.get(i); if (ent.isRowDismissed() || ent.isRowRemoved() || (mBubbleData.hasBubbleWithKey(ent.key) && !ent.showInShadeWhenBubble())) { || mBubbleController.isBubbleNotificationSuppressedFromShade(ent.key)) { // we don't want to update removed notifications because they could // temporarily become children if they were isolated before. continue; Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java +0 −5 Original line number Diff line number Diff line Loading @@ -133,11 +133,6 @@ public class NotificationFilter { } } } if (entry.isBubble() && !entry.showInShadeWhenBubble()) { return true; } return false; } Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +33 −11 Original line number Diff line number Diff line Loading @@ -61,6 +61,14 @@ class Bubble { private long mLastAccessed; private boolean mIsRemoved; /** * Whether this notification should be shown in the shade when it is also displayed as a bubble. * * <p>When a notification is a bubble we don't show it in the shade once the bubble has been * expanded</p> */ private boolean mShowInShadeWhenBubble = true; public static String groupId(NotificationEntry entry) { UserHandle user = entry.notification.getUser(); return user.getIdentifier() + "|" + entry.notification.getPackageName(); Loading Loading @@ -99,14 +107,6 @@ class Bubble { return mEntry; } public boolean showInShadeWhenBubble() { return mEntry.showInShadeWhenBubble(); } public void setShowInShadeWhenBubble(boolean showInShade) { mEntry.setShowInShadeWhenBubble(showInShade); } public String getGroupId() { return mGroupId; } Loading @@ -129,11 +129,11 @@ class Bubble { } } public BubbleView getIconView() { BubbleView getIconView() { return mIconView; } public BubbleExpandedView getExpandedView() { BubbleExpandedView getExpandedView() { return mExpandedView; } Loading Loading @@ -182,7 +182,7 @@ class Bubble { return mIsRemoved; } void setEntry(NotificationEntry entry) { void updateEntry(NotificationEntry entry) { mEntry = entry; mLastUpdated = entry.notification.getPostTime(); if (mInflated) { Loading Loading @@ -227,6 +227,23 @@ class Bubble { setShowInShadeWhenBubble(false); } /** * Whether this notification should be shown in the shade when it is also displayed as a * bubble. */ boolean showInShadeWhenBubble() { return !mEntry.isRowDismissed() && !shouldSuppressNotification() && (!mEntry.isClearable() || mShowInShadeWhenBubble); } /** * Sets whether this notification should be shown in the shade when it is also displayed as a * bubble. */ void setShowInShadeWhenBubble(boolean showInShade) { mShowInShadeWhenBubble = showInShade; } /** * Returns whether the notification for this bubble is a foreground service. It shows that this * is an ongoing bubble. Loading Loading @@ -355,6 +372,11 @@ class Bubble { return 0; } private boolean shouldSuppressNotification() { return mEntry.getBubbleMetadata() != null && mEntry.getBubbleMetadata().isNotificationSuppressed(); } @Override public String toString() { return "Bubble{" + mKey + '}'; Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +12 −25 Original line number Diff line number Diff line Loading @@ -80,7 +80,6 @@ import com.android.systemui.statusbar.notification.NotificationEntryListener; import com.android.systemui.statusbar.notification.NotificationEntryManager; import com.android.systemui.statusbar.notification.NotificationInterruptionStateProvider; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.row.NotificationContentInflater.InflationFlag; import com.android.systemui.statusbar.phone.StatusBarWindowController; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.ZenModeController; Loading Loading @@ -345,6 +344,17 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mBubbleData.setExpanded(false /* expanded */); } /** * Whether (1) there is a bubble associated with the provided key and * (2) if the notification for that bubble is hidden from the shade. * * False if there isn't a bubble or if the notification for that bubble appears in the shade. */ public boolean isBubbleNotificationSuppressedFromShade(String key) { return mBubbleData.hasBubbleWithKey(key) && !mBubbleData.getBubbleWithKey(key).showInShadeWhenBubble(); } void selectBubble(Bubble bubble) { mBubbleData.setSelectedBubble(bubble); } Loading Loading @@ -438,7 +448,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi boolean bubbleExtended = entry.isBubble() && !bubble.isRemoved() && userRemovedNotif; if (bubbleExtended) { entry.setShowInShadeWhenBubble(false); bubble.setShowInShadeWhenBubble(false); if (mStackView != null) { mStackView.updateDotVisibility(entry.key); } Loading @@ -457,17 +467,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi private final NotificationEntryListener mEntryListener = new NotificationEntryListener() { @Override public void onPendingEntryAdded(NotificationEntry entry) { if (!areBubblesEnabled(mContext)) { return; } if (mNotificationInterruptionStateProvider.shouldBubbleUp(entry) && canLaunchInActivityView(mContext, entry)) { updateShowInShadeForSuppressNotification(entry); } } @Override public void onEntryInflated(NotificationEntry entry, @InflationFlag int inflatedFlags) { if (!areBubblesEnabled(mContext)) { return; } Loading @@ -488,7 +487,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // It was previously a bubble but no longer a bubble -- lets remove it removeBubble(entry.key, DISMISS_NO_LONGER_BUBBLE); } else if (shouldBubble) { updateShowInShadeForSuppressNotification(entry); Bubble b = mBubbleData.getBubbleWithKey(entry.key); b.setRemoved(false); // updates come back as bubbles even if dismissed updateBubble(entry); Loading Loading @@ -683,17 +681,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi return mStackView; } private void updateShowInShadeForSuppressNotification(NotificationEntry entry) { boolean suppressNotification = entry.getBubbleMetadata() != null && entry.getBubbleMetadata().isNotificationSuppressed(); Bubble b = mBubbleData.getBubbleWithKey(entry.key); if (b != null && mBubbleData.getSelectedBubble() == b && mBubbleData.isExpanded()) { // If we're expanded & selected don't show in shade suppressNotification = true; } entry.setShowInShadeWhenBubble(!suppressNotification); } static String formatBubblesString(List<Bubble> bubbles, Bubble selected) { StringBuilder sb = new StringBuilder(); for (Bubble bubble : bubbles) { Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +2 −1 Original line number Diff line number Diff line Loading @@ -176,7 +176,7 @@ public class BubbleData { trim(); } else { // Updates an existing bubble bubble.setEntry(entry); bubble.updateEntry(entry); doUpdate(bubble); } if (shouldAutoExpand(entry)) { Loading @@ -187,6 +187,7 @@ public class BubbleData { } else if (mSelectedBubble == null) { setSelectedBubbleInternal(bubble); } bubble.setShowInShadeWhenBubble(!mExpanded || mSelectedBubble != bubble); dispatchPendingChanges(); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationViewHierarchyManager.java +5 −5 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ import android.view.View; import android.view.ViewGroup; import com.android.systemui.R; import com.android.systemui.bubbles.BubbleData; import com.android.systemui.bubbles.BubbleController; import com.android.systemui.plugins.statusbar.StatusBarStateController; import com.android.systemui.statusbar.notification.DynamicPrivacyController; import com.android.systemui.statusbar.notification.NotificationEntryManager; Loading Loading @@ -79,7 +79,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle * possible. */ private final boolean mAlwaysExpandNonGroupedNotification; private final BubbleData mBubbleData; private final BubbleController mBubbleController; private final DynamicPrivacyController mDynamicPrivacyController; private final KeyguardBypassController mBypassController; Loading @@ -97,8 +97,8 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle StatusBarStateController statusBarStateController, NotificationEntryManager notificationEntryManager, Lazy<ShadeController> shadeController, BubbleData bubbleData, KeyguardBypassController bypassController, BubbleController bubbleController, DynamicPrivacyController privacyController) { mLockscreenUserManager = notificationLockscreenUserManager; mBypassController = bypassController; Loading @@ -110,7 +110,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle Resources res = context.getResources(); mAlwaysExpandNonGroupedNotification = res.getBoolean(R.bool.config_alwaysExpandNonGroupedNotifications); mBubbleData = bubbleData; mBubbleController = bubbleController; mDynamicPrivacyController = privacyController; privacyController.addListener(this); } Loading @@ -136,7 +136,7 @@ public class NotificationViewHierarchyManager implements DynamicPrivacyControlle for (int i = 0; i < N; i++) { NotificationEntry ent = activeNotifications.get(i); if (ent.isRowDismissed() || ent.isRowRemoved() || (mBubbleData.hasBubbleWithKey(ent.key) && !ent.showInShadeWhenBubble())) { || mBubbleController.isBubbleNotificationSuppressedFromShade(ent.key)) { // we don't want to update removed notifications because they could // temporarily become children if they were isolated before. continue; Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationFilter.java +0 −5 Original line number Diff line number Diff line Loading @@ -133,11 +133,6 @@ public class NotificationFilter { } } } if (entry.isBubble() && !entry.showInShadeWhenBubble()) { return true; } return false; } Loading