summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-11 05:08:28 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-05-11 05:08:28 +0000
commita7520e60adf855f2d2309d5f7a006247484ae894 (patch)
tree8bf1cca3c6a8489ef15a8084f45a3b3a0f43c0ce
parentc84e272e99e3bfc87ae4763ebf31cb06ad7cefa2 (diff)
parent245fadb7cda4feb035a343b4aa9d3762a281a03b (diff)
downloadlocalepicker-android13-mainline-scheduling-release.tar.gz
Snap for 8570526 from 245fadb7cda4feb035a343b4aa9d3762a281a03b to mainline-scheduling-releaseaml_sch_331113000aml_sch_331111000android13-mainline-scheduling-release
Change-Id: I151791d08318aa8dab35920a2a8ceb717ccc2d22
-rw-r--r--src/com/android/localepicker/LocaleStore.java5
-rw-r--r--tests/Android.bp52
-rw-r--r--tests/Android.mk72
3 files changed, 55 insertions, 74 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
diff --git a/tests/Android.bp b/tests/Android.bp
new file mode 100644
index 0000000..e008473
--- /dev/null
+++ b/tests/Android.bp
@@ -0,0 +1,52 @@
+//
+// Copyright (C) 2008 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+///////////////////////////////////////////////////////////////
+// Build test package for locale picker lib. //
+///////////////////////////////////////////////////////////////
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_app {
+
+ name: "LocalePickerTest",
+
+ srcs: ["src/**/*.java"],
+ java_resource_dirs: ["config"],
+
+ platform_apis: true,
+ optimize: {
+ enabled: false,
+ },
+
+ static_libs: [
+ "localepicker",
+ "robolectric_android-all-stub",
+ "Robolectric_all-target",
+ "mockito-robolectric-prebuilt",
+ "truth-prebuilt",
+ ],
+}
+
+///////////////////////////////////////////////////////////////
+// LocalePicker Robolectric test target. //
+///////////////////////////////////////////////////////////////
+android_robolectric_test {
+ name: "LocalePickerRoboTests",
+ srcs: ["src/**/*.java"],
+ instrumentation_for: "LocalePickerTest",
+}
diff --git a/tests/Android.mk b/tests/Android.mk
deleted file mode 100644
index 138dc4d..0000000
--- a/tests/Android.mk
+++ /dev/null
@@ -1,72 +0,0 @@
-#############################################################
-# Build test package for locale picker lib. #
-#############################################################
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PACKAGE_NAME := LocalePickerTest
-
-LOCAL_PRIVATE_PLATFORM_APIS := true
-LOCAL_PROGUARD_ENABLED := disabled
-
-LOCAL_STATIC_ANDROID_LIBRARIES += localepicker
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-include $(BUILD_PACKAGE)
-
-#############################################################
-# LocalePicker Robolectric test target. #
-#############################################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := LocalePickerRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_JAVA_RESOURCE_DIRS := config
-
-LOCAL_JAVA_LIBRARIES := \
- robolectric_android-all-stub \
- Robolectric_all-target \
- mockito-robolectric-prebuilt \
- truth-prebuilt
-
-LOCAL_INSTRUMENTATION_FOR := LocalePickerTest
-
-LOCAL_MODULE_TAGS := optional
-
-# Generate test_config.properties
-include external/robolectric-shadows/gen_test_config.mk
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#############################################################
-# LocalePicker runner target to run the previous target. #
-#############################################################
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := RunLocalePickerRoboTests
-LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0
-LOCAL_LICENSE_CONDITIONS := notice
-
-LOCAL_JAVA_LIBRARIES := \
- LocalePickerRoboTests \
- robolectric_android-all-stub \
- Robolectric_all-target \
- mockito-robolectric-prebuilt \
- truth-prebuilt
-
-LOCAL_TEST_PACKAGE := LocalePickerTest
-
-LOCAL_INSTRUMENT_SOURCE_DIRS := $(LOCAL_PATH)/../src
-
-include external/robolectric-shadows/run_robotests.mk