Files
rr3-apk/decompiled/sources/androidx/core/app/LocaleManagerCompat.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

89 lines
2.9 KiB
Java

package androidx.core.app;
import android.app.LocaleManager;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Build;
import android.os.LocaleList;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.core.os.LocaleListCompat;
import java.util.Locale;
/* loaded from: classes.dex */
public final class LocaleManagerCompat {
private LocaleManagerCompat() {
}
@NonNull
@AnyThread
public static LocaleListCompat getSystemLocales(@NonNull Context context) {
LocaleListCompat emptyLocaleList = LocaleListCompat.getEmptyLocaleList();
if (Build.VERSION.SDK_INT >= 33) {
Object localeManagerForApplication = getLocaleManagerForApplication(context);
return localeManagerForApplication != null ? LocaleListCompat.wrap(Api33Impl.localeManagerGetSystemLocales(localeManagerForApplication)) : emptyLocaleList;
}
return getConfigurationLocales(Resources.getSystem().getConfiguration());
}
@NonNull
@AnyThread
public static LocaleListCompat getApplicationLocales(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= 33) {
Object localeManagerForApplication = getLocaleManagerForApplication(context);
if (localeManagerForApplication != null) {
return LocaleListCompat.wrap(Api33Impl.localeManagerGetApplicationLocales(localeManagerForApplication));
}
return LocaleListCompat.getEmptyLocaleList();
}
return LocaleListCompat.forLanguageTags(AppLocalesStorageHelper.readLocales(context));
}
@RequiresApi(33)
private static Object getLocaleManagerForApplication(Context context) {
return context.getSystemService("locale");
}
@VisibleForTesting
public static LocaleListCompat getConfigurationLocales(Configuration configuration) {
return Api24Impl.getLocales(configuration);
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static String toLanguageTag(Locale locale) {
return locale.toLanguageTag();
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
public static LocaleListCompat getLocales(Configuration configuration) {
return LocaleListCompat.forLanguageTags(configuration.getLocales().toLanguageTags());
}
}
@RequiresApi(33)
public static class Api33Impl {
private Api33Impl() {
}
public static LocaleList localeManagerGetSystemLocales(Object obj) {
return ((LocaleManager) obj).getSystemLocales();
}
public static LocaleList localeManagerGetApplicationLocales(Object obj) {
return ((LocaleManager) obj).getApplicationLocales();
}
}
}