Status Update
Comments
cl...@google.com <cl...@google.com>
ap...@google.com <ap...@google.com> #2
I'm marking this as "won't fix" as there's nothing Compose here can do, as this is a platform quirk that has been adjusted to be more predictable in recent API versions.
The crux of the issue here is the fitSystemWindows
in the extra View
, like you mentioned, and a platform change in API 30.
Prior to API 30, window insets were dispatched through the view hierarchy in a non-intuitive way: Rather than being a full breadth-first traversal, they would be dispatched in preorder. If the insets were consumed at any point (like if you use fitSystemWindows
), then the preorder would prevent insets from being dispatched to the rest of the view hierarchy. This is very unintuitive: It meant that sibling views (or views deeper in the tree) could stop later views from receiving the dispatch of insets.
In API 30, this behavior was changed to be more intuitive: Now, insets are dispatched in a top-down manner, so they can't be consumed in this weird, cross-tree way.
There's a couple solutions here:
- Avoid
fitSystemWindows
from views if you're handling insets manually - Override
dispatchApplyWindowInsets
in the view groups above where you havefitSystemWindows
defined, and manually perform the new, non-broken dispatching behavior. You can see a comparison of the two methods here:https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/view/ViewGroup.java;l=7341-7371;drc=6411c81462e3594c38a1be5d7c27d67294139ab8
ap...@google.com <ap...@google.com> #3
Using composable version 1.2.1, I could fix it using:
override fun onCreate(bundle: Bundle?) {
WindowCompat.setDecorFitsSystemWindows(window, false)
super.onCreate(bundle)
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q){
window.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
}
}
Then statusBarsPadding works as expected on Api 29
ap...@google.com <ap...@google.com> #4
ap...@google.com <ap...@google.com> #5
Branch: androidx-main
commit 804b350afa3b6de30a6e5563143a48bc268d5158
Author: Ian Lake <ilake@google.com>
Date: Fri Feb 03 21:28:30 2023
Convert SpecialEffectsController to Kotlin
Test: ./gradlew bOS
BUG: 257291822
Change-Id: Ie5e1e7ea023c389fd4f14be5ad0daf413b51feb4
M fragment/fragment/src/androidTest/java/androidx/fragment/app/SpecialEffectsControllerTest.kt
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.java
M fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit 9f6ec3a035550e045e799af754947fa5cbe9329e
Author: Ian Lake <ilake@google.com>
Date: Fri Feb 03 18:05:59 2023
Rename SpecialEffectsController.java to .kt
Part of the Kotlin conversion.
Test: n/a
BUG: 257291822
Change-Id: I0ec7b98d0c503729fcd428329c2f1d3dc053360f
M fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
ap...@google.com <ap...@google.com> #7
Branch: androidx-main
commit 38763c12bad336738e542ff55b868d5688664184
Author: Ian Lake <ilake@google.com>
Date: Fri Feb 03 23:20:21 2023
Convert DefaultSpecialEffectsController to Kotlin
Corrected the nullability of FragmentTransitionImpl
methods that should have always accepted a null value.
And improved the usability of Operation.State.from(View)
for Kotlin users.
Test: Ran Fragment tests
BUG: 257291822
Change-Id: I239e826a3ac08cdad94cc75019cabf9bc88f36f4
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionCompat21.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentTransitionImpl.java
M fragment/fragment/src/main/java/androidx/fragment/app/SpecialEffectsController.kt
M transition/transition/api/restricted_current.txt
M transition/transition/src/main/java/androidx/transition/FragmentTransitionSupport.java
ap...@google.com <ap...@google.com> #8
Branch: androidx-main
commit 1a010ec82874b7230c41c3022c5093b44dc387a1
Author: Ian Lake <ilake@google.com>
Date: Fri Feb 03 22:18:34 2023
Rename DefaultSpecialEffectsController.java to .kt
Part of the Kotlin conversion.
Test: n/a
BUG: 257291822
Change-Id: I852306e6fcecf782d9c57f032c95ad44b0d2c21e
M fragment/fragment/src/main/java/androidx/fragment/app/DefaultSpecialEffectsController.kt
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit f77a30012b576d8b244d4f26b77e89b1c9197245
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Jan 10 22:41:08 2024
Rename FragmentLifecycleCallbacksDispatcher.java to .kt
Part of the Kotlin conversion.
Test: n/a
Bug: 257291822
Change-Id: I809d0a45c2d84e09d850e9b36e7e920bd6fd7947
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLifecycleCallbacksDispatcher.kt
ap...@google.com <ap...@google.com> #10
Branch: androidx-main
commit 77d43f328432324ee68463ff23c99f166020a73c
Author: Jeremy Woods <jbwoods@google.com>
Date: Wed Jan 10 22:54:46 2024
Convert FragmentLifecycleCallbacksDispatcher to Kotlin
Part of Kotlin conversion
Test: ran fragment tests
Bug: 257291822
Change-Id: Iaba072860afffde5adcaa96cf497bd6eb146ef32
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentLifecycleCallbacksDispatcher.kt
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit 7f467ed20685efbb428e663a7d0da94dcced403a
Author: Ian Lake <ilake@google.com>
Date: Tue Feb 06 23:48:21 2024
Convert FragmentHostCallback to Kotlin
Ensure that the nullability of the generic type
for the Host matches the nullability of the return
type of onGetHost().
Test: ./gradlew fragment:fragment:checkApi
BUG: 257291822
Relnote: "`FragmentHostCallback` is now written in Kotlin
so that the nullability of the generic type of the Host
matches the nullability of the return type of
`onGetHost()`."
Change-Id: I40af54eac4bb30c0b5e16d55626ef8ce9b033ebb
M fragment/fragment/api/current.txt
M fragment/fragment/api/restricted_current.txt
M fragment/fragment/src/androidTest/java/androidx/fragment/app/ControllerHostCallbacks.kt
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentController.java
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentHostCallback.kt
ap...@google.com <ap...@google.com> #12
Branch: androidx-main
commit 65836e24e0fac285f5a114f8126efcd47593e4fd
Author: Ian Lake <ilake@google.com>
Date: Tue Feb 06 23:21:57 2024
Rename FragmentHostCallback.java to .kt
As part of the Kotlin conversion process.
Test: n/a
BUG: 257291822
Change-Id: If410b855a877d69fd93385fed58c0097d18f4330
M fragment/fragment/src/main/java/androidx/fragment/app/FragmentHostCallback.kt
Description
Component used: Fragment
It would be beneficial to have all of the AndroidX Fragment classes rewritten in Kotlin. Besides providing better nullability guarantees, this would also help remove some of the friction in maintaining this library and evolving it over time.