Fixed
Status Update
Comments
al...@google.com <al...@google.com>
ro...@google.com <ro...@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.
va...@google.com <va...@google.com> #3
Also not reproducible on Galaxy Nexus running 4.0.1 (v14), 4.0.4 (v15) and 4.2.2 (v17)
ca...@google.com <ca...@google.com> #4
ap...@google.com <ap...@google.com> #5
Project: platform/frameworks/support
Branch: androidx-main
commit 0d8eb4081585d1be1997cb097f5fd54b41ddf8bb
Author: Alex Vanyo <vanyo@google.com>
Date: Tue Nov 23 01:06:28 2021
Convert WindowInsetsControllerCompat behavior to depend on a View to align behavior
Relnote: Converted WindowInsetsControllerCompat to depend on a View instead of a Window or the platform WindowInsetsController. This improves behavior with Dialogs, showing the IME, and ensures the non-deprecated creation methods workaroundhttps://issuetracker.google.com/issues/180881870 .
Bug: 207401542,210121779
Test: Updated and new tests
Change-Id: I292640cb4acc39e47a4d2ce0502293d42468ed67
M core/core/api/restricted_current.txt
M core/core/src/androidTest/java/androidx/core/view/WindowInsetsAnimationCompatActivityTest.kt
M core/core/src/main/java/androidx/core/view/ViewCompat.java
M core/core/api/public_plus_experimental_current.txt
M samples/Support4Demos/src/main/java/com/example/android/supportv4/view/WindowInsetsControllerPlayground.kt
M core/core/src/main/java/androidx/core/view/WindowCompat.java
M core/core/src/androidTest/java/androidx/core/view/WindowInsetsControllerCompatActivityTest.kt
M core/core/api/current.txt
M core/core/src/main/java/androidx/core/view/WindowInsetsControllerCompat.java
M core/core/src/androidTest/java/androidx/core/view/WindowInsetsCompatActivityTest.kt
M core/core/src/androidTest/java/androidx/core/view/ViewCompatTest.java
https://android-review.googlesource.com/1900054
Branch: androidx-main
commit 0d8eb4081585d1be1997cb097f5fd54b41ddf8bb
Author: Alex Vanyo <vanyo@google.com>
Date: Tue Nov 23 01:06:28 2021
Convert WindowInsetsControllerCompat behavior to depend on a View to align behavior
Relnote: Converted WindowInsetsControllerCompat to depend on a View instead of a Window or the platform WindowInsetsController. This improves behavior with Dialogs, showing the IME, and ensures the non-deprecated creation methods workaround
Bug: 207401542,210121779
Test: Updated and new tests
Change-Id: I292640cb4acc39e47a4d2ce0502293d42468ed67
M core/core/api/restricted_current.txt
M core/core/src/androidTest/java/androidx/core/view/WindowInsetsAnimationCompatActivityTest.kt
M core/core/src/main/java/androidx/core/view/ViewCompat.java
M core/core/api/public_plus_experimental_current.txt
M samples/Support4Demos/src/main/java/com/example/android/supportv4/view/WindowInsetsControllerPlayground.kt
M core/core/src/main/java/androidx/core/view/WindowCompat.java
M core/core/src/androidTest/java/androidx/core/view/WindowInsetsControllerCompatActivityTest.kt
M core/core/api/current.txt
M core/core/src/main/java/androidx/core/view/WindowInsetsControllerCompat.java
M core/core/src/androidTest/java/androidx/core/view/WindowInsetsCompatActivityTest.kt
M core/core/src/androidTest/java/androidx/core/view/ViewCompatTest.java
Description
This is effectively a follow-up to b/180881870
The fix to that bug (https://android-review.googlesource.com/1783607 ) stored the from one of the constructors to
window
parameterImpl30
.However, this was not the primary constructor, which means that only instances of b/180881870 on API 30.
WindowInsetsControllerCompat
constructed with aWindow
will be able to workaroundIn particular, the code-path that uses
WindowInsetsControllerCompat.toWindowInsetsControllerCompat(insetsController: InsetsController)
bypasses the window constructor, meaning that the bug will still occur on API 30 with any method of retrieving theWindowInsetsControllerCompat
with that code-path.Those methods include:
ViewCompat.getWindowInsetsController(view: View)
WindowCompat.getInsetsController(window: Window, view: View)
WindowInsetsControllerCompat.toWindowInsetsControllerCompat(insetsController: InsetsController)
The current workaround is to avoid all of the above methods, and instead directly use the proper constructor:
WindowInsetsControllerCompat(window: Window, view: View)
.As a proposed fix, the constructor of b/180881870 . This would necessarily bubble up to the other methods, ensuring that the bug will be fixed across all versions.
WindowInsetsControllerCompat
that doesn't take aWindow
should be deprecated for API 30, since theWindow
is required to workaround