Commit 47b7ce81 authored by Trevor Perrier's avatar Trevor Perrier Committed by Commit Bot

[Android] add SplitCompat.installActivity to createConfigurationContext

This CL calls SplitCompat.installActivity on the context returned by
|ChromeBaseAppCompatActivity.createConfigurationContext|.

This is needed because internally |applyOverrideConfiguration|
creates a new context each time getResources() is called. This new
context does not have access to the SplitCompat language
packs. By calling SplitCompat.installActivity on this new activity
hopefully the localization resources will be found.

Bug: 1128698
Change-Id: I121ae24a84e456b9cacdfabefc310a0e7ee1c6f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2430825Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Commit-Queue: Trevor  Perrier <perrier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810727}
parent 18dd4668
...@@ -41,10 +41,14 @@ public class ChromeBaseAppCompatActivity ...@@ -41,10 +41,14 @@ public class ChromeBaseAppCompatActivity
// https://crbug.com/834191 // https://crbug.com/834191
config.fontScale = 0; config.fontScale = 0;
if (applyOverrides(newBase, config)) applyOverrideConfiguration(config); if (applyOverrides(newBase, config)) applyOverrideConfiguration(config);
}
@Override
public Context createConfigurationContext(Configuration overrideConfiguration) {
Context newContext = super.createConfigurationContext(overrideConfiguration);
// If the activity locale will be overridden enable using language splits. // If the activity locale will be overridden enable using language splits.
// Must be called after applyOverrideConfiguration. AppLocaleUtils.maybeInstallActivitySplitCompat(newContext);
AppLocaleUtils.maybeInstallActivitySplitCompat(this); return newContext;
} }
@Override @Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment