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

Commit 8afec3fa authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Shortens password textfield focus routing to view-model.

As per the linked comment in the attached bug, we don't need to trigger
an unnecessary additional recomposition when the textfield focus
changes.

Fix: 313940629
Test: manually verified that (a) the IME still comes up when entering
the bouncer scene, (b) dismissing the IME still exits the bouncer scene,
and (c) entering the correct password still correctly unlocks the device
Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT

Change-Id: If0fb3d5dac3041570406baeb6167d84023a2b87a
parent d01a63cb
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.State
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.produceState
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
@@ -62,10 +61,6 @@ internal fun PasswordBouncer(
            focusRequester.requestFocus()
        }
    }
    val (isTextFieldFocused, onTextFieldFocusChanged) = remember { mutableStateOf(false) }
    LaunchedEffect(isTextFieldFocused) {
        viewModel.onTextFieldFocusChanged(isFocused = isTextFieldFocused)
    }

    val password: String by viewModel.password.collectAsState()
    val isInputEnabled: Boolean by viewModel.isInputEnabled.collectAsState()
@@ -111,7 +106,7 @@ internal fun PasswordBouncer(
                ),
            modifier =
                Modifier.focusRequester(focusRequester)
                    .onFocusChanged { onTextFieldFocusChanged(it.isFocused) }
                    .onFocusChanged { viewModel.onTextFieldFocusChanged(it.isFocused) }
                    .drawBehind {
                        drawLine(
                            color = color,