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

Commit 20f17359 authored by Roman Birg's avatar Roman Birg Committed by d34d
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>
TICKET: CYNGNOS-1041
parent 20569b3f
Loading
Loading
Loading
Loading
+7 −13
Original line number Diff line number Diff line
@@ -171,9 +171,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.
@@ -311,19 +310,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);