diff options
| author | 2023-11-16 11:58:13 -0800 | |
|---|---|---|
| committer | 2023-11-16 11:58:13 -0800 | |
| commit | a1beebfc73b62d97c22557c3dbde14b1047d8d75 (patch) | |
| tree | b7d2052fb9f4f478305c47d7895ce7a920df2b1d | |
| parent | becf170a090ef4f34f309304355b81445f5409d7 (diff) | |
Put retrieving the LocaleConfig at app start behind flag
Sometimes when an app is starting there is a crash when getting the
LocaleConfig during startup because it ends up reading from disk which
is disallowed on the UI thread. This puts that creation behind an
existing flag (which it probably should be anyway) to fix the problem
while we investigate a better way to do it.
Bug: 309232726
Test: automatic
Change-Id: I0686fafa0f2edec92c429ee72c653e13476cfbf8
| -rw-r--r-- | core/java/android/app/ContextImpl.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 08c18c8b7448..4f8e8dd813a1 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -3482,7 +3482,8 @@ class ContextImpl extends Context { mResources = r; // only do this if the user already has more than one preferred locale - if (r.getConfiguration().getLocales().size() > 1) { + if (android.content.res.Flags.defaultLocale() + && r.getConfiguration().getLocales().size() > 1) { LocaleConfig lc = getUserId() < 0 ? LocaleConfig.fromContextIgnoringOverride(this) : new LocaleConfig(this); |