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

Commit 0831835a authored by Roman Birg's avatar Roman Birg Committed by Gerrit Code Review
Browse files

ResourcesManager: fix lookups with ThemeConfig



Always include a theme config in resource keys, regardless of whether
it is deemed as themeable or not.

This prevents creating additional asset managers for each top level
resource call. Instead it will cache them properly.

Change-Id: I687311275d62773460e7771a2e223b75ff94ed8f
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent b61449ee
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -177,9 +177,8 @@ public class ResourcesManager {
            Configuration overrideConfiguration, CompatibilityInfo compatInfo, IBinder token,
            Context context, boolean isThemeable) {
        final float scale = compatInfo.applicationScale;
        final ThemeConfig themeConfig = isThemeable ? getThemeConfig() : null;
        ResourcesKey key = new ResourcesKey(resDir, displayId, overrideConfiguration, scale,
                isThemeable, themeConfig, token);
                isThemeable, getThemeConfig(), token);
        Resources r;
        synchronized (this) {
            // Resources is app scale dependent.
@@ -317,19 +316,14 @@ public class ResourcesManager {
            CompatibilityInfo compatInfo, IBinder token, boolean isThemeable) {
        Resources r;

        ThemeConfig themeConfig;
        if (isThemeable) {
        ThemeConfig.Builder builder = new ThemeConfig.Builder();
        builder.defaultOverlay(themePackageName);
        builder.defaultIcon(themePackageName);
        builder.defaultFont(themePackageName);
            themeConfig = builder.build();
        } else {
            themeConfig = null;
        }
        ThemeConfig themeConfig = builder.build();

        ResourcesKey key = new ResourcesKey(resDir, displayId, overrideConfiguration,
                compatInfo.applicationScale, isThemeable, isThemeable ? themeConfig : null, token);
                compatInfo.applicationScale, isThemeable, themeConfig, token);

        synchronized (this) {
            WeakReference<Resources> wr = mActiveResources.get(key);