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

Commit c547e9fb authored by Chris Göllner's avatar Chris Göllner
Browse files

Fix: Invalidate Icon's Resources cache on configuration change

When an Icon is loaded, it caches the Resources object used to
retrieve the Drawable. This cache was not invalidated if the
Context's Configuration changed on subsequent loads. This could lead
to incorrect Resources being used, such as a Drawable with the
wrong density.

This change introduces a cache invalidation mechanism. Before
loading a Drawable, `loadDrawable` and `loadDrawableAsUser` now
check if the Context's Configuration differs from the cached
Resources. If so, the cache is cleared, forcing the resources to
be reloaded with the new configuration.

This behavior is gated by the
USE_RESOURCES_FROM_CONTEXT_TO_CREATE_DRAWABLE_ICONS feature flag
to ensure backward compatibility.

Flag: com.android.graphics.flags.use_resources_from_context_to_create_drawable_icons
Test: atest FrameworkCoreTests:IconTest
Bug: 420905041
Change-Id: Ib1303387e7e984b8053aee07e331e4aeecccbbdb
parent fd201a12
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment