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

Commit dbcee9e5 authored by sean_lu's avatar sean_lu Committed by Steve Kondik
Browse files

[Resources] fix preload drawables low issue

Symptom: preload drawables too few
Root Cause: verifyPreloadConfig() function not correct. We need to
convert the config to native config and mask the 0x40000000 bit.
Solution: correct the verifyPreloadConfig() function.
Project: AOSP
Note:

Change-Id: I63eb2a7bf50c89fcb37e62423aae8f4f7e81c6aa
parent 8ea883b7
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -2117,14 +2117,19 @@ public class Resources {
        return sPreloadedDrawables[0];
    }

    static private final int CONFIG_FONT_SCALE = ActivityInfo.activityInfoConfigToNative(
            ActivityInfo.CONFIG_FONT_SCALE);
    static private final int CONFIG_DENSITY = ActivityInfo.activityInfoConfigToNative(
            ActivityInfo.CONFIG_DENSITY);
    static private final int SPEC_PUBLIC = 0x40000000;

    private boolean verifyPreloadConfig(int changingConfigurations, int allowVarying,
            int resourceId, String name) {
        // We allow preloading of resources even if they vary by font scale (which
        // doesn't impact resource selection) or density (which we handle specially by
        // simply turning off all preloading), as well as any other configs specified
        // by the caller.
        if (((changingConfigurations&~(ActivityInfo.CONFIG_FONT_SCALE |
                ActivityInfo.CONFIG_DENSITY)) & ~allowVarying) != 0) {
        if (((changingConfigurations&~(CONFIG_FONT_SCALE | CONFIG_DENSITY | SPEC_PUBLIC)) & ~allowVarying) != 0) {
            String resName;
            try {
                resName = getResourceName(resourceId);