Merge "Only update the cached state if the value changed" into tm-qpr-dev am: dc0b0fd918

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19610626

Change-Id: I6b3b3e7d488bbd3bd65d8fa46c8453bedc94b6df
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
index 8771ceb..de26b549 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java
@@ -1094,13 +1094,16 @@
     }
 
     void updateNotNotifyingEntry(Bubble b, BubbleEntry entry, boolean showInShade) {
+        boolean showInShadeBefore = b.showInShade();
         boolean isBubbleSelected = Objects.equals(b, mBubbleData.getSelectedBubble());
         boolean isBubbleExpandedAndSelected = isStackExpanded() && isBubbleSelected;
         b.setEntry(entry);
         boolean suppress = isBubbleExpandedAndSelected || !showInShade || !b.showInShade();
         b.setSuppressNotification(suppress);
         b.setShowDot(!isBubbleExpandedAndSelected);
-        mImpl.mCachedState.updateBubbleSuppressedState(b);
+        if (showInShadeBefore != b.showInShade()) {
+            mImpl.mCachedState.updateBubbleSuppressedState(b);
+        }
     }
 
     @VisibleForTesting