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

Commit ff0aeed2 authored by Franciszek Juras's avatar Franciszek Juras
Browse files

Conditionally disable Compose Bouncer column swapping

Disable switching of columns in Compose Bouncer on double click
(originally enabled with one-handed input in mind) when improved
large-screen interaction is enabled.

Test: manual with flag enabled locally
Flag: com.android.systemui.disable_double_click_swap_on_bouncer
Bug:  416223998
Change-Id: Ib87c69f3b4474ff1ae05de06dc82ccedece5c151
parent ffda8be6
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -10,6 +10,13 @@ flag {
    bug: "392597328"
}

flag {
    name: "disable_double_click_swap_on_bouncer"
    namespace: "desktop_users_and_accounts"
    description: "Disable swapping bouncer sides with double click in two-column layout"
    bug: "416223998"
}

flag {
    name: "user_switcher_add_sign_out_option"
    namespace: "desktop_users_and_accounts"
+37 −23
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import androidx.compose.ui.input.key.type
import androidx.core.graphics.drawable.toBitmap
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.app.tracing.coroutines.traceCoroutine
import com.android.systemui.Flags
import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.authentication.shared.model.AuthenticationWipeModel
@@ -132,6 +133,14 @@ constructor(
     */
    val isOneHandedModeSupported: StateFlow<Boolean> = _isOneHandedModeSupported.asStateFlow()

    /**
     * Whether swap of layout columns on double click should be disabled to improve interaction on
     * large-screen form factor, e.g. desktop, kiosk
     */
    private val disableDoubleClickSwap =
        Flags.disableDoubleClickSwapOnBouncer() &&
            bouncerInteractor.isImproveLargeScreenInteractionEnabled

    private val _isInputPreferredOnLeftSide = MutableStateFlow(false)
    val isInputPreferredOnLeftSide = _isInputPreferredOnLeftSide.asStateFlow()

@@ -208,13 +217,15 @@ constructor(

            launch { actionButtonInteractor.actionButton.collect { _actionButton.value = it } }

            if (!disableDoubleClickSwap) {
                launch {
                    combine(
                            bouncerInteractor.isOneHandedModeSupported,
                            bouncerInteractor.lastRecordedLockscreenTouchPosition,
                            ::Pair,
                        )
                    .collect { (isOneHandedModeSupported, lastRecordedNotificationTouchPosition) ->
                        .collect { (isOneHandedModeSupported, lastRecordedNotificationTouchPosition)
                            ->
                            _isOneHandedModeSupported.value = isOneHandedModeSupported
                            if (
                                isOneHandedModeSupported &&
@@ -223,7 +234,8 @@ constructor(
                                bouncerInteractor.setPreferredBouncerInputSide(
                                    if (
                                        lastRecordedNotificationTouchPosition <
                                        applicationContext.resources.displayMetrics.widthPixels / 2
                                            applicationContext.resources.displayMetrics
                                                .widthPixels / 2
                                    ) {
                                        BouncerInputSide.LEFT
                                    } else {
@@ -233,6 +245,7 @@ constructor(
                            }
                        }
                }
            }

            launch {
                bouncerInteractor.isUserSwitcherVisible.collect {
@@ -377,6 +390,7 @@ constructor(
     * input UI is not present.
     */
    fun onDoubleTap(wasEventOnNonInputHalfOfScreen: Boolean) {
        if (disableDoubleClickSwap) return
        if (!wasEventOnNonInputHalfOfScreen) return
        if (_isInputPreferredOnLeftSide.value) {
            bouncerInteractor.setPreferredBouncerInputSide(BouncerInputSide.RIGHT)