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

Commit 427433ab authored by Bharadwaj Narasimha's avatar Bharadwaj Narasimha Committed by Clark Scheff
Browse files

Themes: Don't cache explicitly themed resources

When a nav bar should be unchanged in the process of
customization(like changing icons,fonts)
the nav bar changes due to explicitly caching themed
resources.

Change-Id: I3135fac9df82a0551879908f6bf24deba0da0339
parent 330d823c
Loading
Loading
Loading
Loading
+1 −26
Original line number Diff line number Diff line
@@ -335,18 +335,6 @@ public class ResourcesManager {
        ResourcesKey key = new ResourcesKey(resDir, displayId, null, compatInfo.applicationScale,
                isThemeable, themeConfig);

        synchronized (this) {
            WeakReference<Resources> wr = mActiveResources.get(key);
            r = wr != null ? wr.get() : null;
            if (r != null && r.getAssets().isUpToDate()) {
                if (false) {
                    Slog.w(TAG, "Returning cached resources " + r + " " + resDir
                            + ": appScale=" + r.getCompatibilityInfo().applicationScale);
                }
                return r;
            }
        }

        AssetManager assets = new AssetManager();
        assets.setAppName(packageName);
        assets.setThemeSupport(isThemeable);
@@ -387,21 +375,8 @@ public class ResourcesManager {
                    + r.getCompatibilityInfo().applicationScale);
        }

        synchronized (this) {
            WeakReference<Resources> wr = mActiveResources.get(key);
            Resources existing = wr != null ? wr.get() : null;
            if (existing != null && existing.getAssets().isUpToDate()) {
                // Someone else already created the resources while we were
                // unlocked; go ahead and use theirs.
                r.getAssets().close();
                return existing;
            }

            // XXX need to remove entries when weak references go away
            mActiveResources.put(key, new WeakReference<Resources>(r));
        return r;
    }
    }

    /**
     * Creates a map between an activity & app's icon ids to its component info. This map