Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 160b8cf

Browse files
authored
Split tests for computePlatformResolvedLocale with N (#32385)
1 parent d2dd953 commit 160b8cf

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

shell/platform/android/io/flutter/embedding/engine/FlutterJNI.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ public String[] computePlatformResolvedLocale(@NonNull String[] strings) {
12121212
String languageCode = strings[i + 0];
12131213
String countryCode = strings[i + 1];
12141214
String scriptCode = strings[i + 2];
1215-
// Convert to Locales via LocaleBuilder if available (API 24+) to include scriptCode.
1215+
// Convert to Locales via LocaleBuilder if available (API 21+) to include scriptCode.
12161216
if (Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
12171217
Locale.Builder localeBuilder = new Locale.Builder();
12181218
if (!languageCode.isEmpty()) {
@@ -1226,7 +1226,7 @@ public String[] computePlatformResolvedLocale(@NonNull String[] strings) {
12261226
}
12271227
supportedLocales.add(localeBuilder.build());
12281228
} else {
1229-
// Pre-API 24, we fall back on scriptCode-less locales.
1229+
// Pre-API 21, we fall back on scriptCode-less locales.
12301230
supportedLocales.add(new Locale(languageCode, countryCode));
12311231
}
12321232
}

shell/platform/android/test/io/flutter/plugin/localization/LocalizationPluginTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ public void computePlatformResolvedLocaleAPI26() {
140140

141141
// This test should be synced with the version for API 26.
142142
@Test
143-
@Config(sdk = Build.VERSION_CODES.N)
144-
public void computePlatformResolvedLocaleAPI24() {
143+
@Config(minSdk = Build.VERSION_CODES.N)
144+
public void computePlatformResolvedLocale_fromAndroidN() {
145145
// --- Test Setup ---
146146
FlutterJNI flutterJNI = new FlutterJNI();
147147

@@ -235,8 +235,8 @@ public void computePlatformResolvedLocaleAPI24() {
235235

236236
// Tests the legacy pre API 24 algorithm.
237237
@Test
238-
@Config(sdk = Build.VERSION_CODES.JELLY_BEAN)
239-
public void computePlatformResolvedLocaleAPI16() {
238+
@Config(minSdk = Build.VERSION_CODES.JELLY_BEAN, maxSdk = Build.VERSION_CODES.M)
239+
public void computePlatformResolvedLocale_beforeAndroidN() {
240240
// --- Test Setup ---
241241
FlutterJNI flutterJNI = new FlutterJNI();
242242

0 commit comments

Comments
 (0)