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

Commit b855c2d1 authored by Sergey Ten's avatar Sergey Ten
Browse files

Roll back (partially) my previous check in.

Turns out my previous check in (the one which removed
"unnecessary code"), removed code which should not
be removed. This change brings this code back.

CR:JoshG.
parent c32892a3
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import android.content.ComponentCallbacks;
import android.content.ComponentName;
import android.content.ContentProvider;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.IContentProvider;
import android.content.Intent;
import android.content.ServiceConnection;
@@ -3535,6 +3536,17 @@ public final class ActivityThread {
        for (int i=0; i<N; i++) {
            ComponentCallbacks cb = callbacks.get(i);
            performConfigurationChanged(cb, config);

            // We removed the old resources object from the mActiveResources
            // cache, now we need to trigger an update for each application.
            if ((diff & ActivityInfo.CONFIG_THEME_RESOURCE) != 0) {
                if (cb instanceof Activity || cb instanceof Application) {
                    Context context = ((ContextWrapper)cb).getBaseContext();
                    if (context instanceof ApplicationContext) {
                        ((ApplicationContext)context).refreshResourcesIfNecessary();
                    }
                }
            }
        }
    }

+14 −0
Original line number Diff line number Diff line
@@ -212,6 +212,20 @@ class ApplicationContext extends Context {
        return mResources;
    }

    /**
     * Refresh resources object which may have been changed by a theme
     * configuration change.
     */
    /* package */ void refreshResourcesIfNecessary() {
        if (mResources == Resources.getSystem()) {
            return;
        }

        if (mPackageInfo.mApplicationInfo.isThemeable) {
            mTheme = null;
        }
    }

    @Override
    public PackageManager getPackageManager() {
        if (mPackageManager != null) {