Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +2 −31 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ class Bubble implements BubbleViewProvider { private NotificationEntry mEntry; private final String mKey; private final String mGroupId; private long mLastUpdated; private long mLastAccessed; Loading Loading @@ -96,17 +95,10 @@ class Bubble implements BubbleViewProvider { private int mDotColor; private Path mDotPath; public static String groupId(NotificationEntry entry) { UserHandle user = entry.getSbn().getUser(); return user.getIdentifier() + "|" + entry.getSbn().getPackageName(); } // TODO: Decouple Bubble from NotificationEntry and transform ShortcutInfo into Bubble Bubble(ShortcutInfo shortcutInfo) { mShortcutInfo = shortcutInfo; mKey = shortcutInfo.getId(); mGroupId = shortcutInfo.getId(); } /** Used in tests when no UI is required. */ Loading @@ -116,7 +108,6 @@ class Bubble implements BubbleViewProvider { mEntry = e; mKey = e.getKey(); mLastUpdated = e.getSbn().getPostTime(); mGroupId = groupId(e); mSuppressionListener = listener; } Loading @@ -129,10 +120,6 @@ class Bubble implements BubbleViewProvider { return mEntry; } public String getGroupId() { return mGroupId; } public String getPackageName() { return mEntry.getSbn().getPackageName(); } Loading Loading @@ -297,19 +284,12 @@ class Bubble implements BubbleViewProvider { } /** * @return the newer of {@link #getLastUpdateTime()} and {@link #getLastAccessTime()} * @return the last time this bubble was updated or accessed, whichever is most recent. */ long getLastActivity() { return Math.max(mLastUpdated, mLastAccessed); } /** * @return the timestamp in milliseconds of the most recent notification entry for this bubble */ long getLastUpdateTime() { return mLastUpdated; } /** * @return if the bubble was ever expanded */ Loading Loading @@ -411,15 +391,6 @@ class Bubble implements BubbleViewProvider { return mFlyoutMessage; } /** * Returns whether the notification for this bubble is a foreground service. It shows that this * is an ongoing bubble. */ boolean isOngoing() { int flags = mEntry.getSbn().getNotification().flags; return (flags & Notification.FLAG_FOREGROUND_SERVICE) != 0; } float getDesiredHeight(Context context) { Notification.BubbleMetadata data = mEntry.getBubbleMetadata(); boolean useRes = data.getDesiredHeightResId() != 0; Loading Loading @@ -562,7 +533,7 @@ class Bubble implements BubbleViewProvider { normalX, normalY, this.showInShade(), this.isOngoing(), false /* isOngoing (unused) */, false /* isAppForeground (unused) */); } } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +17 −143 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_DATA; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import static java.util.stream.Collectors.toList; import android.app.Notification; import android.app.PendingIntent; import android.content.Context; Loading @@ -45,7 +43,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import javax.inject.Inject; Loading @@ -62,9 +59,6 @@ public class BubbleData { private static final Comparator<Bubble> BUBBLES_BY_SORT_KEY_DESCENDING = Comparator.comparing(BubbleData::sortKey).reversed(); private static final Comparator<Map.Entry<String, Long>> GROUPS_BY_MAX_SORT_KEY_DESCENDING = Comparator.<Map.Entry<String, Long>, Long>comparing(Map.Entry::getValue).reversed(); /** Contains information about changes that have been made to the state of bubbles. */ static final class Update { boolean expandedChanged; Loading Loading @@ -295,8 +289,6 @@ public class BubbleData { if (!mExpanded) { setExpandedInternal(true); } } else if (mSelectedBubble == null) { setSelectedBubbleInternal(bubble); } boolean isBubbleExpandedAndSelected = mExpanded && mSelectedBubble == bubble; Loading Loading @@ -370,20 +362,11 @@ public class BubbleData { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "doAdd: " + bubble); } int minInsertPoint = 0; boolean newGroup = !hasBubbleWithGroupId(bubble.getGroupId()); if (isExpanded()) { // first bubble of a group goes to the beginning, otherwise within the existing group minInsertPoint = newGroup ? 0 : findFirstIndexForGroup(bubble.getGroupId()); } if (insertBubble(minInsertPoint, bubble) < mBubbles.size() - 1) { mStateChange.orderChanged = true; } mBubbles.add(0, bubble); mStateChange.addedBubble = bubble; // Adding the first bubble doesn't change the order mStateChange.orderChanged = mBubbles.size() > 1; if (!isExpanded()) { mStateChange.orderChanged |= packGroup(findFirstIndexForGroup(bubble.getGroupId())); // Top bubble becomes selected. setSelectedBubbleInternal(mBubbles.get(0)); } } Loading @@ -406,14 +389,10 @@ public class BubbleData { } mStateChange.updatedBubble = bubble; if (!isExpanded()) { // while collapsed, update causes re-pack int prevPos = mBubbles.indexOf(bubble); mBubbles.remove(bubble); int newPos = insertBubble(0, bubble); if (prevPos != newPos) { packGroup(newPos); mStateChange.orderChanged = true; } mBubbles.add(0, bubble); mStateChange.orderChanged = prevPos != 0; setSelectedBubbleInternal(mBubbles.get(0)); } } Loading Loading @@ -581,7 +560,6 @@ public class BubbleData { Log.e(TAG, "Attempt to expand stack without selected bubble!"); return; } mSelectedBubble.markUpdatedAt(mTimeSource.currentTimeMillis()); mSelectedBubble.markAsAccessedAt(mTimeSource.currentTimeMillis()); mStateChange.orderChanged |= repackAll(); } else if (!mBubbles.isEmpty()) { Loading @@ -596,17 +574,11 @@ public class BubbleData { } if (mBubbles.indexOf(mSelectedBubble) > 0) { // Move the selected bubble to the top while collapsed. if (!mSelectedBubble.isOngoing() && mBubbles.get(0).isOngoing()) { // The selected bubble cannot be raised to the first position because // there is an ongoing bubble there. Instead, force the top ongoing bubble // to become selected. setSelectedBubbleInternal(mBubbles.get(0)); } else { // Raise the selected bubble (and it's group) up to the front so the selected // bubble remains on top. int index = mBubbles.indexOf(mSelectedBubble); if (index != 0) { mBubbles.remove(mSelectedBubble); mBubbles.add(0, mSelectedBubble); mStateChange.orderChanged |= packGroup(0); mStateChange.orderChanged = true; } } } Loading @@ -616,91 +588,12 @@ public class BubbleData { } private static long sortKey(Bubble bubble) { long key = bubble.getLastUpdateTime(); if (bubble.isOngoing()) { // Set 2nd highest bit (signed long int), to partition between ongoing and regular key |= 0x4000000000000000L; } return key; return bubble.getLastActivity(); } /** * Locates and inserts the bubble into a sorted position. The is inserted * based on sort key, groupId is not considered. A call to {@link #packGroup(int)} may be * required to keep grouping intact. * * @param minPosition the first insert point to consider * @param newBubble the bubble to insert * @return the position where the bubble was inserted */ private int insertBubble(int minPosition, Bubble newBubble) { long newBubbleSortKey = sortKey(newBubble); String previousGroupId = null; for (int pos = minPosition; pos < mBubbles.size(); pos++) { Bubble bubbleAtPos = mBubbles.get(pos); String groupIdAtPos = bubbleAtPos.getGroupId(); boolean atStartOfGroup = !groupIdAtPos.equals(previousGroupId); if (atStartOfGroup && newBubbleSortKey > sortKey(bubbleAtPos)) { // Insert before the start of first group which has older bubbles. mBubbles.add(pos, newBubble); return pos; } previousGroupId = groupIdAtPos; } mBubbles.add(newBubble); return mBubbles.size() - 1; } private boolean hasBubbleWithGroupId(String groupId) { return mBubbles.stream().anyMatch(b -> b.getGroupId().equals(groupId)); } private int findFirstIndexForGroup(String appId) { for (int i = 0; i < mBubbles.size(); i++) { Bubble bubbleAtPos = mBubbles.get(i); if (bubbleAtPos.getGroupId().equals(appId)) { return i; } } return 0; } /** * Starting at the given position, moves all bubbles with the same group id to follow. Bubbles * at positions lower than {@code position} are unchanged. Relative order within the group * unchanged. Relative order of any other bubbles are also unchanged. * * @param position the position of the first bubble for the group * @return true if the position of any bubbles has changed as a result */ private boolean packGroup(int position) { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "packGroup: position=" + position); } Bubble groupStart = mBubbles.get(position); final String groupAppId = groupStart.getGroupId(); List<Bubble> moving = new ArrayList<>(); // Walk backward, collect bubbles within the group for (int i = mBubbles.size() - 1; i > position; i--) { if (mBubbles.get(i).getGroupId().equals(groupAppId)) { moving.add(0, mBubbles.get(i)); } } if (moving.isEmpty()) { return false; } mBubbles.removeAll(moving); mBubbles.addAll(position + 1, moving); return true; } /** * This applies a full sort and group pass to all existing bubbles. The bubbles are grouped * by groupId. Each group is then sorted by the max(lastUpdated) time of its bubbles. Bubbles * within each group are then sorted by lastUpdated descending. * This applies a full sort and group pass to all existing bubbles. * Bubbles are sorted by lastUpdated descending. * * @return true if the position of any bubbles changed as a result */ Loading @@ -711,31 +604,11 @@ public class BubbleData { if (mBubbles.isEmpty()) { return false; } Map<String, Long> groupLastActivity = new HashMap<>(); for (Bubble bubble : mBubbles) { long maxSortKeyForGroup = groupLastActivity.getOrDefault(bubble.getGroupId(), 0L); long sortKeyForBubble = sortKey(bubble); if (sortKeyForBubble > maxSortKeyForGroup) { groupLastActivity.put(bubble.getGroupId(), sortKeyForBubble); } } // Sort groups by their most recently active bubble List<String> groupsByMostRecentActivity = groupLastActivity.entrySet().stream() .sorted(GROUPS_BY_MAX_SORT_KEY_DESCENDING) .map(Map.Entry::getKey) .collect(toList()); List<Bubble> repacked = new ArrayList<>(mBubbles.size()); // For each group, add bubbles, freshest to oldest for (String appId : groupsByMostRecentActivity) { // Add bubbles, freshest to oldest mBubbles.stream() .filter((b) -> b.getGroupId().equals(appId)) .sorted(BUBBLES_BY_SORT_KEY_DESCENDING) .forEachOrdered(repacked::add); } if (repacked.equals(mBubbles)) { return false; } Loading Loading @@ -778,11 +651,12 @@ public class BubbleData { public List<Bubble> getBubbles() { return Collections.unmodifiableList(mBubbles); } /** * The set of bubbles in overflow. */ @VisibleForTesting(visibility = PRIVATE) public List<Bubble> getOverflowBubbles() { List<Bubble> getOverflowBubbles() { return Collections.unmodifiableList(mOverflowBubbles); } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleDebugConfig.java +2 −2 Original line number Diff line number Diff line Loading @@ -69,10 +69,10 @@ public class BubbleDebugConfig { && selected.getKey() != BubbleOverflow.KEY && bubble == selected); String arrow = isSelected ? "=>" : " "; sb.append(String.format("%s Bubble{act=%12d, ongoing=%d, key=%s}\n", sb.append(String.format("%s Bubble{act=%12d, showInShade=%d, key=%s}\n", arrow, bubble.getLastActivity(), (bubble.isOngoing() ? 1 : 0), (bubble.showInShade() ? 1 : 0), bubble.getKey())); } } Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +1 −5 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region; import android.os.Bundle; import android.os.Vibrator; import android.provider.Settings; import android.service.notification.StatusBarNotification; import android.util.Log; Loading Loading @@ -188,7 +187,6 @@ public class BubbleStackView extends FrameLayout private final SpringAnimation mExpandedViewYAnim; private final BubbleData mBubbleData; private final Vibrator mVibrator; private final ValueAnimator mDesaturateAndDarkenAnimator; private final Paint mDesaturateAndDarkenPaint = new Paint(); Loading Loading @@ -701,8 +699,6 @@ public class BubbleStackView extends FrameLayout // We use the real size & subtract screen decorations / window insets ourselves when needed wm.getDefaultDisplay().getRealSize(mDisplaySize); mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding); int elevation = res.getDimensionPixelSize(R.dimen.bubble_elevation); Loading Loading @@ -2334,7 +2330,7 @@ public class BubbleStackView extends FrameLayout getNormalizedXPosition(), getNormalizedYPosition(), bubble.showInShade(), bubble.isOngoing(), false /* isOngoing (unused) */, false /* isAppForeground (unused) */); } } packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java +81 −239 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +2 −31 Original line number Diff line number Diff line Loading @@ -57,7 +57,6 @@ class Bubble implements BubbleViewProvider { private NotificationEntry mEntry; private final String mKey; private final String mGroupId; private long mLastUpdated; private long mLastAccessed; Loading Loading @@ -96,17 +95,10 @@ class Bubble implements BubbleViewProvider { private int mDotColor; private Path mDotPath; public static String groupId(NotificationEntry entry) { UserHandle user = entry.getSbn().getUser(); return user.getIdentifier() + "|" + entry.getSbn().getPackageName(); } // TODO: Decouple Bubble from NotificationEntry and transform ShortcutInfo into Bubble Bubble(ShortcutInfo shortcutInfo) { mShortcutInfo = shortcutInfo; mKey = shortcutInfo.getId(); mGroupId = shortcutInfo.getId(); } /** Used in tests when no UI is required. */ Loading @@ -116,7 +108,6 @@ class Bubble implements BubbleViewProvider { mEntry = e; mKey = e.getKey(); mLastUpdated = e.getSbn().getPostTime(); mGroupId = groupId(e); mSuppressionListener = listener; } Loading @@ -129,10 +120,6 @@ class Bubble implements BubbleViewProvider { return mEntry; } public String getGroupId() { return mGroupId; } public String getPackageName() { return mEntry.getSbn().getPackageName(); } Loading Loading @@ -297,19 +284,12 @@ class Bubble implements BubbleViewProvider { } /** * @return the newer of {@link #getLastUpdateTime()} and {@link #getLastAccessTime()} * @return the last time this bubble was updated or accessed, whichever is most recent. */ long getLastActivity() { return Math.max(mLastUpdated, mLastAccessed); } /** * @return the timestamp in milliseconds of the most recent notification entry for this bubble */ long getLastUpdateTime() { return mLastUpdated; } /** * @return if the bubble was ever expanded */ Loading Loading @@ -411,15 +391,6 @@ class Bubble implements BubbleViewProvider { return mFlyoutMessage; } /** * Returns whether the notification for this bubble is a foreground service. It shows that this * is an ongoing bubble. */ boolean isOngoing() { int flags = mEntry.getSbn().getNotification().flags; return (flags & Notification.FLAG_FOREGROUND_SERVICE) != 0; } float getDesiredHeight(Context context) { Notification.BubbleMetadata data = mEntry.getBubbleMetadata(); boolean useRes = data.getDesiredHeightResId() != 0; Loading Loading @@ -562,7 +533,7 @@ class Bubble implements BubbleViewProvider { normalX, normalY, this.showInShade(), this.isOngoing(), false /* isOngoing (unused) */, false /* isAppForeground (unused) */); } } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +17 −143 Original line number Diff line number Diff line Loading @@ -21,8 +21,6 @@ import static com.android.systemui.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_DATA; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_BUBBLES; import static com.android.systemui.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME; import static java.util.stream.Collectors.toList; import android.app.Notification; import android.app.PendingIntent; import android.content.Context; Loading @@ -45,7 +43,6 @@ import java.util.Collections; import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import javax.inject.Inject; Loading @@ -62,9 +59,6 @@ public class BubbleData { private static final Comparator<Bubble> BUBBLES_BY_SORT_KEY_DESCENDING = Comparator.comparing(BubbleData::sortKey).reversed(); private static final Comparator<Map.Entry<String, Long>> GROUPS_BY_MAX_SORT_KEY_DESCENDING = Comparator.<Map.Entry<String, Long>, Long>comparing(Map.Entry::getValue).reversed(); /** Contains information about changes that have been made to the state of bubbles. */ static final class Update { boolean expandedChanged; Loading Loading @@ -295,8 +289,6 @@ public class BubbleData { if (!mExpanded) { setExpandedInternal(true); } } else if (mSelectedBubble == null) { setSelectedBubbleInternal(bubble); } boolean isBubbleExpandedAndSelected = mExpanded && mSelectedBubble == bubble; Loading Loading @@ -370,20 +362,11 @@ public class BubbleData { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "doAdd: " + bubble); } int minInsertPoint = 0; boolean newGroup = !hasBubbleWithGroupId(bubble.getGroupId()); if (isExpanded()) { // first bubble of a group goes to the beginning, otherwise within the existing group minInsertPoint = newGroup ? 0 : findFirstIndexForGroup(bubble.getGroupId()); } if (insertBubble(minInsertPoint, bubble) < mBubbles.size() - 1) { mStateChange.orderChanged = true; } mBubbles.add(0, bubble); mStateChange.addedBubble = bubble; // Adding the first bubble doesn't change the order mStateChange.orderChanged = mBubbles.size() > 1; if (!isExpanded()) { mStateChange.orderChanged |= packGroup(findFirstIndexForGroup(bubble.getGroupId())); // Top bubble becomes selected. setSelectedBubbleInternal(mBubbles.get(0)); } } Loading @@ -406,14 +389,10 @@ public class BubbleData { } mStateChange.updatedBubble = bubble; if (!isExpanded()) { // while collapsed, update causes re-pack int prevPos = mBubbles.indexOf(bubble); mBubbles.remove(bubble); int newPos = insertBubble(0, bubble); if (prevPos != newPos) { packGroup(newPos); mStateChange.orderChanged = true; } mBubbles.add(0, bubble); mStateChange.orderChanged = prevPos != 0; setSelectedBubbleInternal(mBubbles.get(0)); } } Loading Loading @@ -581,7 +560,6 @@ public class BubbleData { Log.e(TAG, "Attempt to expand stack without selected bubble!"); return; } mSelectedBubble.markUpdatedAt(mTimeSource.currentTimeMillis()); mSelectedBubble.markAsAccessedAt(mTimeSource.currentTimeMillis()); mStateChange.orderChanged |= repackAll(); } else if (!mBubbles.isEmpty()) { Loading @@ -596,17 +574,11 @@ public class BubbleData { } if (mBubbles.indexOf(mSelectedBubble) > 0) { // Move the selected bubble to the top while collapsed. if (!mSelectedBubble.isOngoing() && mBubbles.get(0).isOngoing()) { // The selected bubble cannot be raised to the first position because // there is an ongoing bubble there. Instead, force the top ongoing bubble // to become selected. setSelectedBubbleInternal(mBubbles.get(0)); } else { // Raise the selected bubble (and it's group) up to the front so the selected // bubble remains on top. int index = mBubbles.indexOf(mSelectedBubble); if (index != 0) { mBubbles.remove(mSelectedBubble); mBubbles.add(0, mSelectedBubble); mStateChange.orderChanged |= packGroup(0); mStateChange.orderChanged = true; } } } Loading @@ -616,91 +588,12 @@ public class BubbleData { } private static long sortKey(Bubble bubble) { long key = bubble.getLastUpdateTime(); if (bubble.isOngoing()) { // Set 2nd highest bit (signed long int), to partition between ongoing and regular key |= 0x4000000000000000L; } return key; return bubble.getLastActivity(); } /** * Locates and inserts the bubble into a sorted position. The is inserted * based on sort key, groupId is not considered. A call to {@link #packGroup(int)} may be * required to keep grouping intact. * * @param minPosition the first insert point to consider * @param newBubble the bubble to insert * @return the position where the bubble was inserted */ private int insertBubble(int minPosition, Bubble newBubble) { long newBubbleSortKey = sortKey(newBubble); String previousGroupId = null; for (int pos = minPosition; pos < mBubbles.size(); pos++) { Bubble bubbleAtPos = mBubbles.get(pos); String groupIdAtPos = bubbleAtPos.getGroupId(); boolean atStartOfGroup = !groupIdAtPos.equals(previousGroupId); if (atStartOfGroup && newBubbleSortKey > sortKey(bubbleAtPos)) { // Insert before the start of first group which has older bubbles. mBubbles.add(pos, newBubble); return pos; } previousGroupId = groupIdAtPos; } mBubbles.add(newBubble); return mBubbles.size() - 1; } private boolean hasBubbleWithGroupId(String groupId) { return mBubbles.stream().anyMatch(b -> b.getGroupId().equals(groupId)); } private int findFirstIndexForGroup(String appId) { for (int i = 0; i < mBubbles.size(); i++) { Bubble bubbleAtPos = mBubbles.get(i); if (bubbleAtPos.getGroupId().equals(appId)) { return i; } } return 0; } /** * Starting at the given position, moves all bubbles with the same group id to follow. Bubbles * at positions lower than {@code position} are unchanged. Relative order within the group * unchanged. Relative order of any other bubbles are also unchanged. * * @param position the position of the first bubble for the group * @return true if the position of any bubbles has changed as a result */ private boolean packGroup(int position) { if (DEBUG_BUBBLE_DATA) { Log.d(TAG, "packGroup: position=" + position); } Bubble groupStart = mBubbles.get(position); final String groupAppId = groupStart.getGroupId(); List<Bubble> moving = new ArrayList<>(); // Walk backward, collect bubbles within the group for (int i = mBubbles.size() - 1; i > position; i--) { if (mBubbles.get(i).getGroupId().equals(groupAppId)) { moving.add(0, mBubbles.get(i)); } } if (moving.isEmpty()) { return false; } mBubbles.removeAll(moving); mBubbles.addAll(position + 1, moving); return true; } /** * This applies a full sort and group pass to all existing bubbles. The bubbles are grouped * by groupId. Each group is then sorted by the max(lastUpdated) time of its bubbles. Bubbles * within each group are then sorted by lastUpdated descending. * This applies a full sort and group pass to all existing bubbles. * Bubbles are sorted by lastUpdated descending. * * @return true if the position of any bubbles changed as a result */ Loading @@ -711,31 +604,11 @@ public class BubbleData { if (mBubbles.isEmpty()) { return false; } Map<String, Long> groupLastActivity = new HashMap<>(); for (Bubble bubble : mBubbles) { long maxSortKeyForGroup = groupLastActivity.getOrDefault(bubble.getGroupId(), 0L); long sortKeyForBubble = sortKey(bubble); if (sortKeyForBubble > maxSortKeyForGroup) { groupLastActivity.put(bubble.getGroupId(), sortKeyForBubble); } } // Sort groups by their most recently active bubble List<String> groupsByMostRecentActivity = groupLastActivity.entrySet().stream() .sorted(GROUPS_BY_MAX_SORT_KEY_DESCENDING) .map(Map.Entry::getKey) .collect(toList()); List<Bubble> repacked = new ArrayList<>(mBubbles.size()); // For each group, add bubbles, freshest to oldest for (String appId : groupsByMostRecentActivity) { // Add bubbles, freshest to oldest mBubbles.stream() .filter((b) -> b.getGroupId().equals(appId)) .sorted(BUBBLES_BY_SORT_KEY_DESCENDING) .forEachOrdered(repacked::add); } if (repacked.equals(mBubbles)) { return false; } Loading Loading @@ -778,11 +651,12 @@ public class BubbleData { public List<Bubble> getBubbles() { return Collections.unmodifiableList(mBubbles); } /** * The set of bubbles in overflow. */ @VisibleForTesting(visibility = PRIVATE) public List<Bubble> getOverflowBubbles() { List<Bubble> getOverflowBubbles() { return Collections.unmodifiableList(mOverflowBubbles); } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleDebugConfig.java +2 −2 Original line number Diff line number Diff line Loading @@ -69,10 +69,10 @@ public class BubbleDebugConfig { && selected.getKey() != BubbleOverflow.KEY && bubble == selected); String arrow = isSelected ? "=>" : " "; sb.append(String.format("%s Bubble{act=%12d, ongoing=%d, key=%s}\n", sb.append(String.format("%s Bubble{act=%12d, showInShade=%d, key=%s}\n", arrow, bubble.getLastActivity(), (bubble.isOngoing() ? 1 : 0), (bubble.showInShade() ? 1 : 0), bubble.getKey())); } } Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +1 −5 Original line number Diff line number Diff line Loading @@ -49,7 +49,6 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region; import android.os.Bundle; import android.os.Vibrator; import android.provider.Settings; import android.service.notification.StatusBarNotification; import android.util.Log; Loading Loading @@ -188,7 +187,6 @@ public class BubbleStackView extends FrameLayout private final SpringAnimation mExpandedViewYAnim; private final BubbleData mBubbleData; private final Vibrator mVibrator; private final ValueAnimator mDesaturateAndDarkenAnimator; private final Paint mDesaturateAndDarkenPaint = new Paint(); Loading Loading @@ -701,8 +699,6 @@ public class BubbleStackView extends FrameLayout // We use the real size & subtract screen decorations / window insets ourselves when needed wm.getDefaultDisplay().getRealSize(mDisplaySize); mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); mExpandedViewPadding = res.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding); int elevation = res.getDimensionPixelSize(R.dimen.bubble_elevation); Loading Loading @@ -2334,7 +2330,7 @@ public class BubbleStackView extends FrameLayout getNormalizedXPosition(), getNormalizedYPosition(), bubble.showInShade(), bubble.isOngoing(), false /* isOngoing (unused) */, false /* isAppForeground (unused) */); } }
packages/SystemUI/tests/src/com/android/systemui/bubbles/BubbleDataTest.java +81 −239 File changed.Preview size limit exceeded, changes collapsed. Show changes