Merge "Avoid another concurrent modification exception in ShortcutHelper." into rvc-dev am: 831ac87a9b am: ed1fd6a0a2

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

Change-Id: Ib1403c576adcfb397bd220f6e658b52a32440317
This commit is contained in:
Josh Tsuji
2020-07-01 15:43:40 +00:00
committed by Automerger Merge Worker

View File

@@ -102,9 +102,13 @@ public class ShortcutHelper {
HashMap<String, String> shortcutBubbles = mActiveShortcutBubbles.get(packageName);
ArrayList<String> bubbleKeysToRemove = new ArrayList<>();
if (shortcutBubbles != null) {
// Copy to avoid a concurrent modification exception when we remove bubbles from
// shortcutBubbles.
final Set<String> shortcutIds = new HashSet<>(shortcutBubbles.keySet());
// If we can't find one of our bubbles in the shortcut list, that bubble needs
// to be removed.
for (String shortcutId : shortcutBubbles.keySet()) {
for (String shortcutId : shortcutIds) {
boolean foundShortcut = false;
for (int i = 0; i < shortcuts.size(); i++) {
if (shortcuts.get(i).getId().equals(shortcutId)) {