diff options
| author | Mady Mellor <madym@google.com> | 2020-06-10 14:50:59 -0700 |
|---|---|---|
| committer | Mady Mellor <madym@google.com> | 2020-06-11 01:50:25 +0000 |
| commit | f4afd8db2fa4ae24ddea46dd5dc38beddd408159 (patch) | |
| tree | f5cf84173c0802c041149eb831c2059624c394f5 | |
| parent | 266bf584c75d7761f5069f031fb2800c1283d048 (diff) | |
Fix duplicate bubbles in overflow
If multiple calls to applyUpdate happen, we could load & add the bubbles
from disk multiple times resulting in dupes. This adds a flag to only do
it once.
Test: manual
Fixes: 158353722
Change-Id: I5a14574a78ce0b1c55b3b32d2348aa3c4241a341
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java index 2affe0605d89..873b0785bd7f 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleController.java @@ -55,7 +55,6 @@ import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.res.Configuration; import android.graphics.PixelFormat; -import android.graphics.Rect; import android.os.Binder; import android.os.Handler; import android.os.RemoteException; @@ -180,6 +179,9 @@ public class BubbleController implements ConfigurationController.ConfigurationLi // Callback that updates BubbleOverflowActivity on data change. @Nullable private Runnable mOverflowCallback = null; + // Only load overflow data from disk once + private boolean mOverflowDataLoaded = false; + private final NotificationInterruptStateProvider mNotificationInterruptStateProvider; private IStatusBarService mBarService; private WindowManager mWindowManager; @@ -193,9 +195,6 @@ public class BubbleController implements ConfigurationController.ConfigurationLi /** Whether or not the BubbleStackView has been added to the WindowManager. */ private boolean mAddedToWindowManager = false; - // Used for determining view rect for touch interaction - private Rect mTempRect = new Rect(); - // Listens to user switch so bubbles can be saved and restored. private final NotificationLockscreenUserManager mNotifUserManager; @@ -962,13 +961,14 @@ public class BubbleController implements ConfigurationController.ConfigurationLi * Fills the overflow bubbles by loading them from disk. */ void loadOverflowBubblesFromDisk() { - if (!mBubbleData.getOverflowBubbles().isEmpty()) { + if (!mBubbleData.getOverflowBubbles().isEmpty() || mOverflowDataLoaded) { // we don't need to load overflow bubbles from disk if it is already in memory return; } + mOverflowDataLoaded = true; mDataRepository.loadBubbles((bubbles) -> { bubbles.forEach(bubble -> { - if (mBubbleData.getBubbles().contains(bubble)) { + if (mBubbleData.hasAnyBubbleWithKey(bubble.getKey())) { // if the bubble is already active, there's no need to push it to overflow return; } |
