Loading packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +1 −0 Original line number Diff line number Diff line Loading @@ -694,6 +694,7 @@ class Bubble implements BubbleViewProvider { pw.print(" showInShade: "); pw.println(showInShade()); pw.print(" showDot: "); pw.println(showDot()); pw.print(" showFlyout: "); pw.println(showFlyout()); pw.print(" lastActivity: "); pw.println(getLastActivity()); pw.print(" desiredHeight: "); pw.println(getDesiredHeightString()); pw.print(" suppressNotif: "); pw.println(shouldSuppressNotification()); pw.print(" autoExpand: "); pw.println(shouldAutoExpand()); Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +6 −20 Original line number Diff line number Diff line Loading @@ -196,7 +196,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi private INotificationManager mINotificationManager; // Callback that updates BubbleOverflowActivity on data change. @Nullable private Runnable mOverflowCallback = null; @Nullable private BubbleData.Listener mOverflowListener = null; // Only load overflow data from disk once private boolean mOverflowDataLoaded = false; Loading Loading @@ -722,8 +722,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mInflateSynchronously = inflateSynchronously; } void setOverflowCallback(Runnable updateOverflow) { mOverflowCallback = updateOverflow; void setOverflowListener(BubbleData.Listener listener) { mOverflowListener = listener; } /** Loading Loading @@ -1327,9 +1327,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // Lazy load overflow bubbles from disk loadOverflowBubblesFromDisk(); // Update bubbles in overflow. if (mOverflowCallback != null) { mOverflowCallback.run(); if (mOverflowListener != null) { mOverflowListener.applyUpdate(update); } // Collapsing? Do this first before remaining steps. Loading Loading @@ -1438,21 +1439,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi cb.invalidateNotifications("BubbleData.Listener.applyUpdate"); } updateStack(); if (DEBUG_BUBBLE_CONTROLLER) { Log.d(TAG, "\n[BubbleData] bubbles:"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mBubbleData.getBubbles(), mBubbleData.getSelectedBubble())); if (mStackView != null) { Log.d(TAG, "\n[BubbleStackView]"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mStackView.getBubblesOnScreen(), mStackView.getExpandedBubble())); } Log.d(TAG, "\n[BubbleData] overflow:"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mBubbleData.getOverflowBubbles(), null) + "\n"); } } }; Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +18 −3 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class BubbleData { @Nullable Bubble selectedBubble; @Nullable Bubble addedBubble; @Nullable Bubble updatedBubble; @Nullable Bubble addedOverflowBubble; @Nullable Bubble removedOverflowBubble; // Pair with Bubble and @DismissReason Integer final List<Pair<Bubble, Integer>> removedBubbles = new ArrayList<>(); Loading @@ -93,6 +95,8 @@ public class BubbleData { || addedBubble != null || updatedBubble != null || !removedBubbles.isEmpty() || addedOverflowBubble != null || removedOverflowBubble != null || orderChanged; } Loading Loading @@ -486,8 +490,9 @@ public class BubbleData { b.stopInflation(); } mLogger.logOverflowRemove(b, reason); mStateChange.bubbleRemoved(b, reason); mOverflowBubbles.remove(b); mStateChange.bubbleRemoved(b, reason); mStateChange.removedOverflowBubble = b; } return; } Loading Loading @@ -532,6 +537,7 @@ public class BubbleData { } mLogger.logOverflowAdd(bubble, reason); mOverflowBubbles.add(0, bubble); mStateChange.addedOverflowBubble = bubble; bubble.stopInflation(); if (mOverflowBubbles.size() == mMaxOverflowBubbles + 1) { // Remove oldest bubble. Loading @@ -542,6 +548,7 @@ public class BubbleData { mStateChange.bubbleRemoved(oldest, BubbleController.DISMISS_OVERFLOW_MAX_REACHED); mLogger.log(bubble, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_MAX_REACHED); mOverflowBubbles.remove(oldest); mStateChange.removedOverflowBubble = oldest; } } Loading Loading @@ -821,11 +828,19 @@ public class BubbleData { : "null"); pw.print("expanded: "); pw.println(mExpanded); pw.print("count: "); pw.print("stack bubble count: "); pw.println(mBubbles.size()); for (Bubble bubble : mBubbles) { bubble.dump(fd, pw, args); } pw.print("overflow bubble count: "); pw.println(mOverflowBubbles.size()); for (Bubble bubble : mOverflowBubbles) { bubble.dump(fd, pw, args); } pw.print("summaryKeys: "); pw.println(mSuppressedGroupKeys.size()); for (String key : mSuppressedGroupKeys.keySet()) { Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java +50 −21 Original line number Diff line number Diff line Loading @@ -108,14 +108,10 @@ public class BubbleOverflowActivity extends Activity { mEmptyStateSubtitle = findViewById(R.id.bubble_overflow_empty_subtitle); mEmptyStateImage = findViewById(R.id.bubble_overflow_empty_state_image); updateDimensions(); onDataChanged(mBubbleController.getOverflowBubbles()); mBubbleController.setOverflowCallback(() -> { onDataChanged(mBubbleController.getOverflowBubbles()); }); updateOverflow(); } void updateDimensions() { void updateOverflow() { Resources res = getResources(); final int columns = res.getInteger(R.integer.bubbles_overflow_columns); mRecyclerView.setLayoutManager( Loading @@ -137,6 +133,22 @@ public class BubbleOverflowActivity extends Activity { mAdapter = new BubbleOverflowAdapter(getApplicationContext(), mOverflowBubbles, mBubbleController::promoteBubbleFromOverflow, viewWidth, viewHeight); mRecyclerView.setAdapter(mAdapter); mOverflowBubbles.clear(); mOverflowBubbles.addAll(mBubbleController.getOverflowBubbles()); mAdapter.notifyDataSetChanged(); updateEmptyStateVisibility(); mBubbleController.setOverflowListener(mDataListener); updateTheme(); } void updateEmptyStateVisibility() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); } } /** Loading Loading @@ -168,23 +180,41 @@ public class BubbleOverflowActivity extends Activity { mEmptyStateSubtitle.setTextColor(textColor); } void onDataChanged(List<Bubble> bubbles) { mOverflowBubbles.clear(); mOverflowBubbles.addAll(bubbles); mAdapter.notifyDataSetChanged(); private final BubbleData.Listener mDataListener = new BubbleData.Listener() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); @Override public void applyUpdate(BubbleData.Update update) { Bubble toRemove = update.removedOverflowBubble; if (toRemove != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "remove: " + toRemove); } toRemove.cleanupViews(); final int i = mOverflowBubbles.indexOf(toRemove); mOverflowBubbles.remove(toRemove); mAdapter.notifyItemRemoved(i); } Bubble toAdd = update.addedOverflowBubble; if (toAdd != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "Updated overflow bubbles:\n" + BubbleDebugConfig.formatBubblesString( mOverflowBubbles, /*selected*/ null)); Log.d(TAG, "add: " + toAdd); } mOverflowBubbles.add(0, toAdd); mAdapter.notifyItemInserted(0); } updateEmptyStateVisibility(); if (DEBUG_OVERFLOW) { Log.d(TAG, BubbleDebugConfig.formatBubblesString( mBubbleController.getOverflowBubbles(), null)); } } }; @Override public void onStart() { super.onStart(); Loading @@ -198,8 +228,7 @@ public class BubbleOverflowActivity extends Activity { @Override public void onResume() { super.onResume(); updateDimensions(); updateTheme(); updateOverflow(); } @Override Loading packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +4 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,10 @@ public class BubbleStackView extends FrameLayout /** Description of current animation controller state. */ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("Stack view state:"); String bubblesOnScreen = BubbleDebugConfig.formatBubblesString( getBubblesOnScreen(), getExpandedBubble()); pw.print(" bubbles on screen: "); pw.println(bubblesOnScreen); pw.print(" gestureInProgress: "); pw.println(mIsGestureInProgress); pw.print(" showingDismiss: "); pw.println(mDismissView.isShowing()); pw.print(" isExpansionAnimating: "); pw.println(mIsExpansionAnimating); Loading Loading
packages/SystemUI/src/com/android/systemui/bubbles/Bubble.java +1 −0 Original line number Diff line number Diff line Loading @@ -694,6 +694,7 @@ class Bubble implements BubbleViewProvider { pw.print(" showInShade: "); pw.println(showInShade()); pw.print(" showDot: "); pw.println(showDot()); pw.print(" showFlyout: "); pw.println(showFlyout()); pw.print(" lastActivity: "); pw.println(getLastActivity()); pw.print(" desiredHeight: "); pw.println(getDesiredHeightString()); pw.print(" suppressNotif: "); pw.println(shouldSuppressNotification()); pw.print(" autoExpand: "); pw.println(shouldAutoExpand()); Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +6 −20 Original line number Diff line number Diff line Loading @@ -196,7 +196,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi private INotificationManager mINotificationManager; // Callback that updates BubbleOverflowActivity on data change. @Nullable private Runnable mOverflowCallback = null; @Nullable private BubbleData.Listener mOverflowListener = null; // Only load overflow data from disk once private boolean mOverflowDataLoaded = false; Loading Loading @@ -722,8 +722,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi mInflateSynchronously = inflateSynchronously; } void setOverflowCallback(Runnable updateOverflow) { mOverflowCallback = updateOverflow; void setOverflowListener(BubbleData.Listener listener) { mOverflowListener = listener; } /** Loading Loading @@ -1327,9 +1327,10 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // Lazy load overflow bubbles from disk loadOverflowBubblesFromDisk(); // Update bubbles in overflow. if (mOverflowCallback != null) { mOverflowCallback.run(); if (mOverflowListener != null) { mOverflowListener.applyUpdate(update); } // Collapsing? Do this first before remaining steps. Loading Loading @@ -1438,21 +1439,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi cb.invalidateNotifications("BubbleData.Listener.applyUpdate"); } updateStack(); if (DEBUG_BUBBLE_CONTROLLER) { Log.d(TAG, "\n[BubbleData] bubbles:"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mBubbleData.getBubbles(), mBubbleData.getSelectedBubble())); if (mStackView != null) { Log.d(TAG, "\n[BubbleStackView]"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mStackView.getBubblesOnScreen(), mStackView.getExpandedBubble())); } Log.d(TAG, "\n[BubbleData] overflow:"); Log.d(TAG, BubbleDebugConfig.formatBubblesString(mBubbleData.getOverflowBubbles(), null) + "\n"); } } }; Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleData.java +18 −3 Original line number Diff line number Diff line Loading @@ -75,6 +75,8 @@ public class BubbleData { @Nullable Bubble selectedBubble; @Nullable Bubble addedBubble; @Nullable Bubble updatedBubble; @Nullable Bubble addedOverflowBubble; @Nullable Bubble removedOverflowBubble; // Pair with Bubble and @DismissReason Integer final List<Pair<Bubble, Integer>> removedBubbles = new ArrayList<>(); Loading @@ -93,6 +95,8 @@ public class BubbleData { || addedBubble != null || updatedBubble != null || !removedBubbles.isEmpty() || addedOverflowBubble != null || removedOverflowBubble != null || orderChanged; } Loading Loading @@ -486,8 +490,9 @@ public class BubbleData { b.stopInflation(); } mLogger.logOverflowRemove(b, reason); mStateChange.bubbleRemoved(b, reason); mOverflowBubbles.remove(b); mStateChange.bubbleRemoved(b, reason); mStateChange.removedOverflowBubble = b; } return; } Loading Loading @@ -532,6 +537,7 @@ public class BubbleData { } mLogger.logOverflowAdd(bubble, reason); mOverflowBubbles.add(0, bubble); mStateChange.addedOverflowBubble = bubble; bubble.stopInflation(); if (mOverflowBubbles.size() == mMaxOverflowBubbles + 1) { // Remove oldest bubble. Loading @@ -542,6 +548,7 @@ public class BubbleData { mStateChange.bubbleRemoved(oldest, BubbleController.DISMISS_OVERFLOW_MAX_REACHED); mLogger.log(bubble, BubbleLogger.Event.BUBBLE_OVERFLOW_REMOVE_MAX_REACHED); mOverflowBubbles.remove(oldest); mStateChange.removedOverflowBubble = oldest; } } Loading Loading @@ -821,11 +828,19 @@ public class BubbleData { : "null"); pw.print("expanded: "); pw.println(mExpanded); pw.print("count: "); pw.print("stack bubble count: "); pw.println(mBubbles.size()); for (Bubble bubble : mBubbles) { bubble.dump(fd, pw, args); } pw.print("overflow bubble count: "); pw.println(mOverflowBubbles.size()); for (Bubble bubble : mOverflowBubbles) { bubble.dump(fd, pw, args); } pw.print("summaryKeys: "); pw.println(mSuppressedGroupKeys.size()); for (String key : mSuppressedGroupKeys.keySet()) { Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleOverflowActivity.java +50 −21 Original line number Diff line number Diff line Loading @@ -108,14 +108,10 @@ public class BubbleOverflowActivity extends Activity { mEmptyStateSubtitle = findViewById(R.id.bubble_overflow_empty_subtitle); mEmptyStateImage = findViewById(R.id.bubble_overflow_empty_state_image); updateDimensions(); onDataChanged(mBubbleController.getOverflowBubbles()); mBubbleController.setOverflowCallback(() -> { onDataChanged(mBubbleController.getOverflowBubbles()); }); updateOverflow(); } void updateDimensions() { void updateOverflow() { Resources res = getResources(); final int columns = res.getInteger(R.integer.bubbles_overflow_columns); mRecyclerView.setLayoutManager( Loading @@ -137,6 +133,22 @@ public class BubbleOverflowActivity extends Activity { mAdapter = new BubbleOverflowAdapter(getApplicationContext(), mOverflowBubbles, mBubbleController::promoteBubbleFromOverflow, viewWidth, viewHeight); mRecyclerView.setAdapter(mAdapter); mOverflowBubbles.clear(); mOverflowBubbles.addAll(mBubbleController.getOverflowBubbles()); mAdapter.notifyDataSetChanged(); updateEmptyStateVisibility(); mBubbleController.setOverflowListener(mDataListener); updateTheme(); } void updateEmptyStateVisibility() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); } } /** Loading Loading @@ -168,23 +180,41 @@ public class BubbleOverflowActivity extends Activity { mEmptyStateSubtitle.setTextColor(textColor); } void onDataChanged(List<Bubble> bubbles) { mOverflowBubbles.clear(); mOverflowBubbles.addAll(bubbles); mAdapter.notifyDataSetChanged(); private final BubbleData.Listener mDataListener = new BubbleData.Listener() { if (mOverflowBubbles.isEmpty()) { mEmptyState.setVisibility(View.VISIBLE); } else { mEmptyState.setVisibility(View.GONE); @Override public void applyUpdate(BubbleData.Update update) { Bubble toRemove = update.removedOverflowBubble; if (toRemove != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "remove: " + toRemove); } toRemove.cleanupViews(); final int i = mOverflowBubbles.indexOf(toRemove); mOverflowBubbles.remove(toRemove); mAdapter.notifyItemRemoved(i); } Bubble toAdd = update.addedOverflowBubble; if (toAdd != null) { if (DEBUG_OVERFLOW) { Log.d(TAG, "Updated overflow bubbles:\n" + BubbleDebugConfig.formatBubblesString( mOverflowBubbles, /*selected*/ null)); Log.d(TAG, "add: " + toAdd); } mOverflowBubbles.add(0, toAdd); mAdapter.notifyItemInserted(0); } updateEmptyStateVisibility(); if (DEBUG_OVERFLOW) { Log.d(TAG, BubbleDebugConfig.formatBubblesString( mBubbleController.getOverflowBubbles(), null)); } } }; @Override public void onStart() { super.onStart(); Loading @@ -198,8 +228,7 @@ public class BubbleOverflowActivity extends Activity { @Override public void onResume() { super.onResume(); updateDimensions(); updateTheme(); updateOverflow(); } @Override Loading
packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +4 −0 Original line number Diff line number Diff line Loading @@ -276,6 +276,10 @@ public class BubbleStackView extends FrameLayout /** Description of current animation controller state. */ public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { pw.println("Stack view state:"); String bubblesOnScreen = BubbleDebugConfig.formatBubblesString( getBubblesOnScreen(), getExpandedBubble()); pw.print(" bubbles on screen: "); pw.println(bubblesOnScreen); pw.print(" gestureInProgress: "); pw.println(mIsGestureInProgress); pw.print(" showingDismiss: "); pw.println(mDismissView.isShowing()); pw.print(" isExpansionAnimating: "); pw.println(mIsExpansionAnimating); Loading