Commit 696fa9c8 authored by Trevor Perrier's avatar Trevor Perrier Committed by Commit Bot

[Android] Call installActivity after applyOverrideConfiguration

This CL fixes a crash caused by SplitCompat.installActivity being called
before ChromeBaseAppCompatACtivity.applyOverrideConfiguration.

The crash occurs because installActivity ends up calling getAssets,
which can not be called before applyOverrideConfiguration.

Bug: 1128698
Change-Id: If9e8e6d4bfa29a3fc18ea7509379ee78a2ec1a54
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422185
Commit-Queue: Trevor  Perrier <perrier@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809039}
parent fb9306dd
...@@ -35,15 +35,16 @@ public class ChromeBaseAppCompatActivity ...@@ -35,15 +35,16 @@ public class ChromeBaseAppCompatActivity
super.attachBaseContext(newBase); super.attachBaseContext(newBase);
mNightModeStateProvider = createNightModeStateProvider(); mNightModeStateProvider = createNightModeStateProvider();
// If the activity locale will be overridden enable using language splits.
AppLocaleUtils.maybeInstallActivitySplitCompat(this);
Configuration config = new Configuration(); Configuration config = new Configuration();
// Pre-Android O, fontScale gets initialized to 1 in the constructor. Set it to 0 so // Pre-Android O, fontScale gets initialized to 1 in the constructor. Set it to 0 so
// that applyOverrideConfiguration() does not interpret it as an overridden value. // that applyOverrideConfiguration() does not interpret it as an overridden value.
// 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);
// If the activity locale will be overridden enable using language splits.
// Must be called after applyOverrideConfiguration.
AppLocaleUtils.maybeInstallActivitySplitCompat(this);
} }
@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