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

Commit fba3904d authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10322758 from 781cf4ec to udc-release

Change-Id: Ie78e03ff2843ba862fc82f21598bd41b11e40c64
parents 43e83c81 781cf4ec
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -111,20 +111,20 @@ public class AnimatorInflater {
            float pathErrorScale) throws NotFoundException {
        final ConfigurationBoundResourceCache<Animator> animatorCache = resources
                .getAnimatorCache();
        ConfigurationBoundResourceCache.Entry<Animator> animatorEntry =
                animatorCache.getInstance(id, resources, theme);
        if (animatorEntry.hasValue()) {
        Animator animator = animatorCache.getInstance(id, resources, theme);
        if (animator != null) {
            if (DBG_ANIMATOR_INFLATER) {
                Log.d(TAG, "loaded animator from cache, " + resources.getResourceName(id));
            }
            return animatorEntry.getValue();
            return animator;
        } else if (DBG_ANIMATOR_INFLATER) {
            Log.d(TAG, "cache miss for animator " + resources.getResourceName(id));
        }
        int cacheGeneration = animatorCache.getGeneration();
        XmlResourceParser parser = null;
        try {
            parser = resources.getAnimation(id);
            Animator animator = createAnimatorFromXml(resources, theme, parser, pathErrorScale);
            animator = createAnimatorFromXml(resources, theme, parser, pathErrorScale);
            if (animator != null) {
                animator.appendChangingConfigurations(getChangingConfigs(resources, id));
                final ConstantState<Animator> constantState = animator.createConstantState();
@@ -132,7 +132,7 @@ public class AnimatorInflater {
                    if (DBG_ANIMATOR_INFLATER) {
                        Log.d(TAG, "caching animator for res " + resources.getResourceName(id));
                    }
                    animatorCache.put(id, theme, constantState, animatorEntry.getGeneration());
                    animatorCache.put(id, theme, constantState, cacheGeneration);
                    // create a new animator so that cached version is never used by the user
                    animator = constantState.newInstance(resources, theme);
                }
@@ -161,22 +161,22 @@ public class AnimatorInflater {
        final ConfigurationBoundResourceCache<StateListAnimator> cache = resources
                .getStateListAnimatorCache();
        final Theme theme = context.getTheme();
        ConfigurationBoundResourceCache.Entry<StateListAnimator> animatorEntry =
                cache.getInstance(id, resources, theme);
        if (animatorEntry.hasValue()) {
            return animatorEntry.getValue();
        StateListAnimator animator = cache.getInstance(id, resources, theme);
        if (animator != null) {
            return animator;
        }
        int cacheGeneration = cache.getGeneration();
        XmlResourceParser parser = null;
        try {
            parser = resources.getAnimation(id);
            StateListAnimator animator =
            animator =
                    createStateListAnimatorFromXml(context, parser, Xml.asAttributeSet(parser));
            if (animator != null) {
                animator.appendChangingConfigurations(getChangingConfigs(resources, id));
                final ConstantState<StateListAnimator> constantState = animator
                        .createConstantState();
                if (constantState != null) {
                    cache.put(id, theme, constantState, animatorEntry.getGeneration());
                    cache.put(id, theme, constantState, cacheGeneration);
                    // return a clone so that the animator in constant state is never used.
                    animator = constantState.newInstance(resources, theme);
                }
+1 −1
Original line number Diff line number Diff line
@@ -136,7 +136,7 @@ public final class WifiSsidPolicy implements Parcelable {
    }

    /**
     * Two instances of WifiSsidPolicy is considered equal if they have
     * Two instances of WifiSsidPolicy are considered equal if they have
     * the same WifiSsidPolicyType and the same set of WifiSsids
     */
    @Override
+6 −6
Original line number Diff line number Diff line
@@ -37,16 +37,16 @@ public class ConfigurationBoundResourceCache<T> extends ThemedResourceCache<Cons
     * @param key a key that uniquely identifies the drawable resource
     * @param resources a Resources object from which to create new instances.
     * @param theme the theme where the resource will be used
     * @return an Entry wrapping a new instance of the resource, or {@code null} if not in
     * @return a new instance of the resource, or {@code null} if not in
     *         the cache
     */
    public Entry<T> getInstance(long key, Resources resources, Resources.Theme theme) {
        final Entry<ConstantState<T>> e = get(key, theme);
        if (e.hasValue()) {
            return new Entry<>(e.getValue().newInstance(resources, theme), e.getGeneration());
    public T getInstance(long key, Resources resources, Resources.Theme theme) {
        final ConstantState<T> entry = get(key, theme);
        if (entry != null) {
            return entry.newInstance(resources, theme);
        }

        return new Entry<>(null, e.getGeneration());
        return null;
    }

    @Override
+3 −21
Original line number Diff line number Diff line
@@ -40,32 +40,14 @@ class DrawableCache extends ThemedResourceCache<Drawable.ConstantState> {
     */
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    public Drawable getInstance(long key, Resources resources, Resources.Theme theme) {
        final Entry<Drawable.ConstantState> entry = get(key, theme);
        if (entry.getValue() != null) {
            return entry.getValue().newDrawable(resources, theme);
        final Drawable.ConstantState entry = get(key, theme);
        if (entry != null) {
            return entry.newDrawable(resources, theme);
        }

        return null;
    }

    /**
     * If the resource is cached, creates and returns a new instance of it.
     *
     * @param key a key that uniquely identifies the drawable resource
     * @param resources a Resources object from which to create new instances.
     * @param theme the theme where the resource will be used
     * @return an Entry wrapping a a new instance of the resource, or {@code null} if not in
     *         the cache
     */
    public Entry<Drawable> getDrawable(long key, Resources resources, Resources.Theme theme) {
        final Entry<Drawable.ConstantState> e = get(key, theme);
        if (e.hasValue()) {
            return new Entry<>(e.getValue().newDrawable(resources, theme), e.getGeneration());
        }

        return new Entry<>(null, e.getGeneration());
    }

    @Override
    public boolean shouldInvalidateEntry(Drawable.ConstantState entry, int configChanges) {
        return Configuration.needNewResources(configChanges, entry.getChangingConfigurations());
+10 −17
Original line number Diff line number Diff line
@@ -650,21 +650,16 @@ public class ResourcesImpl {
                key = (((long) value.assetCookie) << 32) | value.data;
            }

            int cacheGeneration;
            int cacheGeneration = caches.getGeneration();
            // First, check whether we have a cached version of this drawable
            // that was inflated against the specified theme. Skip the cache if
            // we're currently preloading or we're not using the cache.
            if (!mPreloading && useCache) {
                final ThemedResourceCache.Entry<Drawable> cachedDrawable =
                        caches.getDrawable(key, wrapper, theme);
                if (cachedDrawable.hasValue()) {
                    cachedDrawable.getValue().setChangingConfigurations(
                            value.changingConfigurations);
                    return cachedDrawable.getValue();
                }
                cacheGeneration = cachedDrawable.getGeneration();
            } else {
                cacheGeneration = ThemedResourceCache.UNDEFINED_GENERATION;
                Drawable cachedDrawable = caches.getInstance(key, wrapper, theme);
                if (cachedDrawable != null) {
                    cachedDrawable.setChangingConfigurations(value.changingConfigurations);
                    return cachedDrawable;
                }
            }

            // Next, check preloaded drawables. Preloaded drawables may contain
@@ -1009,16 +1004,15 @@ public class ResourcesImpl {
            TypedValue value, int id) {
        final long key = (((long) value.assetCookie) << 32) | value.data;
        final ConfigurationBoundResourceCache<ComplexColor> cache = mComplexColorCache;
        ThemedResourceCache.Entry<ComplexColor> complexColorEntry =
                cache.getInstance(key, wrapper, theme);
        if (complexColorEntry.hasValue()) {
            return complexColorEntry.getValue();
        ComplexColor complexColor = cache.getInstance(key, wrapper, theme);
        if (complexColor != null) {
            return complexColor;
        }
        int cacheGeneration = cache.getGeneration();

        final android.content.res.ConstantState<ComplexColor> factory =
                sPreloadedComplexColors.get(key);

        ComplexColor complexColor = null;
        if (factory != null) {
            complexColor = factory.newInstance(wrapper, theme);
        }
@@ -1035,8 +1029,7 @@ public class ResourcesImpl {
                    sPreloadedComplexColors.put(key, complexColor.getConstantState());
                }
            } else {
                cache.put(key, theme, complexColor.getConstantState(),
                        complexColorEntry.getGeneration());
                cache.put(key, theme, complexColor.getConstantState(), cacheGeneration);
            }
        }
        return complexColor;
Loading