Fixed
Status Update
Comments
al...@google.com <al...@google.com> #2
Trying to reproduce this on my 4.2.2 (v17) Nexus 4. Added this drawable:
<transition xmlns:android="http://schemas.android.com/apk/res/android " >
<item android:drawable="@drawable/test_drawable_blue"/>
<item android:drawable="@drawable/test_drawable_green"/>
</transition>
where blue/green drawables look like this:
<shape
xmlns:android="http://schemas.android.com/apk/res/android "
android:shape="rectangle">
<size
android:width="@dimen/drawable_large_size"
android:height="@dimen/drawable_small_size" />
<solid
android:color="@color/test_blue" />
</shape>
Then added this test:
@Test
public void testMutateTransitionDrawable() {
Drawable drawable = ResourcesCompat.getDrawable(mResources,
R.drawable.test_transition_drawable, null);
assertTrue(drawable instanceof TransitionDrawable);
Drawable mutated = drawable.mutate();
assertTrue(drawable instanceof TransitionDrawable);
assertTrue(mutated instanceof TransitionDrawable);
}
It passes on the device. Going to also try on other earlier devices a bit later in the day once they are charged.
<transition xmlns:android="
<item android:drawable="@drawable/test_drawable_blue"/>
<item android:drawable="@drawable/test_drawable_green"/>
</transition>
where blue/green drawables look like this:
<shape
xmlns:android="
android:shape="rectangle">
<size
android:width="@dimen/drawable_large_size"
android:height="@dimen/drawable_small_size" />
<solid
android:color="@color/test_blue" />
</shape>
Then added this test:
@Test
public void testMutateTransitionDrawable() {
Drawable drawable = ResourcesCompat.getDrawable(mResources,
R.drawable.test_transition_drawable, null);
assertTrue(drawable instanceof TransitionDrawable);
Drawable mutated = drawable.mutate();
assertTrue(drawable instanceof TransitionDrawable);
assertTrue(mutated instanceof TransitionDrawable);
}
It passes on the device. Going to also try on other earlier devices a bit later in the day once they are charged.
bu...@google.com <bu...@google.com> #3
Also not reproducible on Galaxy Nexus running 4.0.1 (v14), 4.0.4 (v15) and 4.2.2 (v17)
Ar...@qq.com <Ar...@qq.com> #4
al...@google.com <al...@google.com> #5
Good suggestion! I think it would also be reasonable to provide a cache-clearing mechanism for a specific Theme
, since this applies to more than just CSL
s. We can do that as a stop-gap until we have APIs for comparing Theme
contents.
al...@google.com <al...@google.com>
al...@google.com <al...@google.com> #6
aosp/1927081 up for review.
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
commit 4f66c0ca1f324426a862a707597573d6bd8c0f01
Author: Alan Viverette <alanv@google.com>
Date: Thu Dec 16 15:28:48 2021
Add workaround method for addressing cache invalidation on SDK < 33
This method is not very discoverable, but it's also pretty niche. Those
who need it will probably find it via StackOverflow or Buganizer.
Relnote: """Added method for working around ColorStateList issues
resulting from Theme-keyed caching and Theme.applyStyle"""
Test: ResourcesCompatTest
Fixes: 207739887
Change-Id: I9188bbf6b182111b3d6d302b81b9a000058687bd
M core/core/api/restricted_current.txt
M core/core/src/main/java/androidx/core/content/res/ResourcesCompat.java
M core/core/api/public_plus_experimental_current.txt
M core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
M core/core/api/current.txt
https://android-review.googlesource.com/1927081
Branch: androidx-main
commit 4f66c0ca1f324426a862a707597573d6bd8c0f01
Author: Alan Viverette <alanv@google.com>
Date: Thu Dec 16 15:28:48 2021
Add workaround method for addressing cache invalidation on SDK < 33
This method is not very discoverable, but it's also pretty niche. Those
who need it will probably find it via StackOverflow or Buganizer.
Relnote: """Added method for working around ColorStateList issues
resulting from Theme-keyed caching and Theme.applyStyle"""
Test: ResourcesCompatTest
Fixes: 207739887
Change-Id: I9188bbf6b182111b3d6d302b81b9a000058687bd
M core/core/api/restricted_current.txt
M core/core/src/main/java/androidx/core/content/res/ResourcesCompat.java
M core/core/api/public_plus_experimental_current.txt
M core/core/src/androidTest/java/androidx/core/content/res/ResourcesCompatTest.java
M core/core/api/current.txt
Description