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

Commit 098d6ae5 authored by Josh's avatar Josh
Browse files

Removed unnecessary initial value when collecting StateFlow

Shortcut customization dialogs were janky and animating using an
unexpected transition when launched.

Investigation showed that this was due to a faulty state collection -
when collecting shortcutUiCustomizationState with lifecycle, we added an intial
value `Inactive`. This causes the initial root composable to first be composed
with state Inactive, showing the UI for Inactive state(empty UI but with
Scrim) and then recompose with a new correct state, discarding the empty
UI and showing the new correct UI(hence the odd animation when
launching). Basically, we were showing two different UIs(a wrong empty
UI, followed by the correct UI) and this caused unexpected behaviors in
window enter animations.

Flag: com.android.systemui.keyboard_shortcut_helper_shortcut_customizer
Test: Manual - ensure enter animation for customization dialog is
consistent with systemUIDialog animations across the board.
Fix: 381060204

Change-Id: Ief4a2a30d6bd346f0ba5ff7ab96be204e11f2ae9
parent 40aa32b3
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -88,10 +88,7 @@ constructor(
    private fun createDialog(): Dialog {
        return dialogFactory.create(dialogDelegate = ShortcutCustomizationDialogDelegate()) { dialog
            ->
            val uiState by
                viewModel.shortcutCustomizationUiState.collectAsStateWithLifecycle(
                    initialValue = ShortcutCustomizationUiState.Inactive
                )
            val uiState by viewModel.shortcutCustomizationUiState.collectAsStateWithLifecycle()
            val coroutineScope = rememberCoroutineScope()
            ShortcutCustomizationDialog(
                uiState = uiState,