[AND-6] Add edge-to-edge support for apps targeting Android 15 #5469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Goal
Any apps targeting Android 15 (
targetSdk=35
) have edge-to-edge enabled by default. This means that some screens/components could be obstructed by the system bars / keyboard, making it impossible to interact with. Therefore, we must ensure that the screens we provide from the SDK are supporting edge-to-edge, otherwise integrator apps targeting Android 15 could have issues.Note 1: This PR DOESN'T change the SDK / sample apps
targetSdk
value, as that might require other updates. It just makes sure that the affected screens are properly shown in apps targeting Android 15.Note 2: This PR DOESN'T explicitly introduce edge-to-edge for all screens (for Android version < 15). The only screens where edge-to-edge is explicitly requested are screens which are already simulating such experience by colouring the system/navigation bars (which is now deprecated). In all other cases we try to preserve the current behaviour for Android < 15, and ensure the screens are still shown properly for Android >= 15.
Linear: https://linear.app/stream/issue/AND-6/implement-edge-to-edge-support-for-android-15
GitHub issue: #5458
🛠 Implementation details
ui-common
:AttachmentDocumentActivity
- apply content padding based onWindowInsetsCompat.Type.systemBars()
to ensure the content is not obstructed by status bar / navigation bar.compose
SDK:MediaGalleryPreviewActivity
- apply content padding based onWindowInsets.systemBars
to ensure the content is not obstructed by status bar / navigation bar + explicitly requestenableEdgeToEdge(statusBarStyle, navigationBarStyle)
to ensure the system bars are coloured properly (previously we usedSystemUiController
for that purpose)MediaPreviewActivity
- apply content padding based onWindowInsets.systemBars
to ensure the content is not obstructed by status bar / navigation bar + explicitly requestenableEdgeToEdge(statusBarStyle, navigationBarStyle)
to ensure the system bars are coloured properly (previously we usedSystemUiController
for that purpose). Here, both the background and the system bars are always shown asColor.Black
, disregarding light/night mode.xml
SDK:ChannelListActivity
- apply content padding based onWindowInsetsCompat.Type.systemBars()
to ensure the content is not obstructed by status bar / navigation bar.AttachmentActivity
- apply content padding based onWindowInsetsCompat.Type.systemBars()
to ensure the content is not obstructed by status bar / navigation bar.AttachmentGalleryActivity
- apply content padding based onWindowInsetsCompat.Type.systemBars()
to ensure the content is not obstructed by status bar / navigation bar.AttachmentMediaActivity
- apply content padding based onWindowInsetsCompat.Type.systemBars()
to ensure the content is not obstructed by status bar / navigation bar + explicitly requestenableEdgeToEdge(statusBarStyle, navigationBarStyle)
to ensure the system bars are coloured properly (previously we usedwindow.navigationBarColor/window.statusBarColor
which are now deprecated).MessageListActivity
- apply content padding based onWindowInsetsCompat.Type.systemBars()
+WindowInsetsCompat.Type.ime()
. Ensures that the content is not obstructed by status bar / navigation bar, and ensures that the content is not obstructed by the soft keyboard.🎨 UI Changes
TargetSdk = 34 (Should look the same before and after the changes)
TargetSdk = 35 (The components should not be cut-off by the system bars)
🧪 Testing
Configuration.sampleTargetSdk = 35
ui-components-sample
orcompose-sample
☑️Contributor Checklist
General
develop
branchCode & documentation
☑️Reviewer Checklist
🎉 GIF
Please provide a suitable gif that describes your work on this pull request