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

Commit 866fd680 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Return asset manager with correct config from ContextThemeWrapper"

parents f1438309 99bf63fd
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) {