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

Commit 3ff4c9a6 authored by Roman Birg's avatar Roman Birg Committed by Clark Scheff
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 723714ed
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -187,7 +187,7 @@ public class ResourcesManager {
        Configuration overrideConfigCopy = (overrideConfiguration != null)
                ? new Configuration(overrideConfiguration) : null;
        ResourcesKey key = new ResourcesKey(resDir, displayId, overrideConfiguration, scale,
                isThemeable, themeConfig);
                isThemeable, getThemeConfig());
        Resources r;
        synchronized (this) {
            // Resources is app scale dependent.
@@ -324,19 +324,14 @@ public class ResourcesManager {
            String themePackageName, CompatibilityInfo compatInfo, 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, null, compatInfo.applicationScale,
                isThemeable, isThemeable ? themeConfig : null);
                isThemeable, themeConfig);

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