summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:47:55 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-06-15 21:47:55 +0000
commit892d834c6a01163cd646bd6a49719b58a3bdf690 (patch)
treefc9623505ca8e477585b6e349c3e30f71a266470
parentc5f467840616ed69c1dc0ae5b413adf96bb8b7b2 (diff)
parentc84e272e99e3bfc87ae4763ebf31cb06ad7cefa2 (diff)
downloadlocalepicker-aml_tz3_312511020.tar.gz
Change-Id: Icfa267cee629439c1681c3d295026b214ccceeb2
-rw-r--r--src/com/android/localepicker/LocaleStore.java5
-rw-r--r--tests/Android.bp52
-rw-r--r--tests/Android.mk72
3 files changed, 74 insertions, 55 deletions
diff --git a/src/com/android/localepicker/LocaleStore.java b/src/com/android/localepicker/LocaleStore.java
index c799bd3..ff4f85a 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,8 +352,7 @@ public class LocaleStore {
String parentId = parent == null ? null : parent.getId();
HashSet<LocaleInfo> result = new HashSet<>();
- ArrayList<LocaleStore.LocaleInfo> localeInfos = new ArrayList<>(sLocaleCache.values());
- for (LocaleStore.LocaleInfo li : localeInfos) {
+ for (LocaleStore.LocaleInfo li : sLocaleCache.values()) {
int level = getLevel(ignorables, li, translatedOnly);
if (level == 2) {
if (parent != null) { // region selection
diff --git a/tests/Android.bp b/tests/Android.bp
deleted file mode 100644
index e008473..0000000
--- a/tests/Android.bp
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// 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
new file mode 100644
index 0000000..138dc4d
--- /dev/null
+++ b/tests/Android.mk
@@ -0,0 +1,72 @@
+#############################################################
+# 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