Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99bf63fd authored by Alan Viverette's avatar Alan Viverette
Browse files

Return asset manager with correct config from ContextThemeWrapper

Bug: 23416037
Change-Id: Ia87bebbe6f23214c892bc2ca19d4112853023235
parent fa0f7cdd
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.view;
import android.annotation.StyleRes;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.res.AssetManager;
import android.content.res.Configuration;
import android.content.res.Resources;

@@ -60,11 +61,12 @@ public class ContextThemeWrapper extends ContextWrapper {
     * information.
     *
     * <p>This method can only be called once, and must be called before any
     * calls to {@link #getResources()} are made.
     * calls to {@link #getResources()} or {@link #getAssets()} are made.
     */
    public void applyOverrideConfiguration(Configuration overrideConfiguration) {
        if (mResources != null) {
            throw new IllegalStateException("getResources() has already been called");
            throw new IllegalStateException(
                    "getResources() or getAssets() has already been called");
        }
        if (mOverrideConfiguration != null) {
            throw new IllegalStateException("Override configuration has already been set");
@@ -72,6 +74,12 @@ public class ContextThemeWrapper extends ContextWrapper {
        mOverrideConfiguration = new Configuration(overrideConfiguration);
    }

    @Override
    public AssetManager getAssets() {
        // Ensure we're returning assets with the correct configuration.
        return getResources().getAssets();
    }

    @Override
    public Resources getResources() {
        if (mResources != null) {