diff options
author | Cyril Lee <cyrillee@google.com> | 2021-10-26 17:29:18 +0000 |
---|---|---|
committer | Cyril Lee <cyrillee@google.com> | 2022-05-02 17:18:10 +0000 |
commit | fa53f6ee90425b3f31f4dbe621e65efd7754821e (patch) | |
tree | 8bf1cca3c6a8489ef15a8084f45a3b3a0f43c0ce | |
parent | d77b797aa56f64bbb99ca532c16d0112a97841fe (diff) | |
download | localepicker-fa53f6ee90425b3f31f4dbe621e65efd7754821e.tar.gz |
Fix getLevelLocales crash due to modify collection during iterationt_frc_odp_330442040t_frc_odp_330442000t_frc_ase_330444010android13-frc-odp-releaseandroid13-dev
Bug: 196308793
Test: mm LocalePickerRoboTests
Change-Id: I1eb7e02cc2b805b381f3dd3439ec68f958949e48
-rw-r--r-- | src/com/android/localepicker/LocaleStore.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/com/android/localepicker/LocaleStore.java b/src/com/android/localepicker/LocaleStore.java index ff4f85a..c799bd3 100644 --- a/src/com/android/localepicker/LocaleStore.java +++ b/src/com/android/localepicker/LocaleStore.java @@ -27,9 +27,9 @@ import android.telephony.TelephonyManager; import androidx.annotation.VisibleForTesting; import java.io.Serializable; +import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; -import java.util.IllformedLocaleException; import java.util.Locale; import java.util.Set; @@ -352,7 +352,8 @@ public class LocaleStore { String parentId = parent == null ? null : parent.getId(); HashSet<LocaleInfo> result = new HashSet<>(); - for (LocaleStore.LocaleInfo li : sLocaleCache.values()) { + ArrayList<LocaleStore.LocaleInfo> localeInfos = new ArrayList<>(sLocaleCache.values()); + for (LocaleStore.LocaleInfo li : localeInfos) { int level = getLevel(ignorables, li, translatedOnly); if (level == 2) { if (parent != null) { // region selection |