Merge "Fix issue with overridden configuration in onConfigurationChanged" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
a149c42071
@@ -91,6 +91,7 @@ import android.util.PrintWriterPrinter;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseIntArray;
|
||||
import android.util.SuperNotCalledException;
|
||||
import android.view.ContextThemeWrapper;
|
||||
import android.view.Display;
|
||||
import android.view.ThreadedRenderer;
|
||||
import android.view.View;
|
||||
@@ -4632,7 +4633,21 @@ public final class ActivityThread {
|
||||
}
|
||||
|
||||
if (reportToActivity) {
|
||||
cb.onConfigurationChanged(newConfig);
|
||||
Configuration configToReport = newConfig;
|
||||
|
||||
if (cb instanceof ContextThemeWrapper) {
|
||||
// ContextThemeWrappers may override the configuration for that context.
|
||||
// We must check and apply any overrides defined.
|
||||
ContextThemeWrapper contextThemeWrapper = (ContextThemeWrapper) cb;
|
||||
final Configuration localOverrideConfig =
|
||||
contextThemeWrapper.getOverrideConfiguration();
|
||||
if (localOverrideConfig != null) {
|
||||
configToReport = new Configuration(newConfig);
|
||||
configToReport.updateFrom(localOverrideConfig);
|
||||
}
|
||||
}
|
||||
|
||||
cb.onConfigurationChanged(configToReport);
|
||||
}
|
||||
|
||||
if (activity != null) {
|
||||
|
||||
@@ -101,6 +101,15 @@ public class ContextThemeWrapper extends ContextWrapper {
|
||||
mOverrideConfiguration = new Configuration(overrideConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by ActivityThread to apply the overridden configuration to onConfigurationChange
|
||||
* callbacks.
|
||||
* @hide
|
||||
*/
|
||||
public Configuration getOverrideConfiguration() {
|
||||
return mOverrideConfiguration;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetManager getAssets() {
|
||||
// Ensure we're returning assets with the correct configuration.
|
||||
|
||||
Reference in New Issue
Block a user