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

Commit 563dfe05 authored by Franciszek Juras's avatar Franciszek Juras Committed by Android (Google) Code Review
Browse files

Merge changes Ib87c69f3,Ie2ffb09c into main

* changes:
  Conditionally disable Compose Bouncer column swapping
  Add improveLargeScreenInteractionOnLockscreen config parameter
parents b60c4cf8 ff0aeed2
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"
+3 −0
Original line number Diff line number Diff line
@@ -1134,4 +1134,7 @@

    <!-- If AOD can show an ambient version of the wallpaper (-1 means ignore) -->
    <integer name="config_dozeSupportsAodWallpaperOverride">-1</integer>

    <!-- Whether to enable features improving large screen interaction -->
    <bool name="config_improveLargeScreenInteractionOnLockscreen">false</bool>
</resources>
+7 −0
Original line number Diff line number Diff line
@@ -50,6 +50,13 @@ constructor(
    val isOneHandedBouncerSupportedInConfig: Boolean
        get() = applicationContext.resources.getBoolean(R.bool.can_use_one_handed_bouncer)

    /** Whether improved large screen interaction is enabled for this device */
    val isImproveLargeScreenInteractionEnabledInConfig: Boolean
        get() =
            applicationContext.resources.getBoolean(
                R.bool.config_improveLargeScreenInteractionOnLockscreen
            )

    /**
     * Preferred side of the screen where the input area on the bouncer should be. This is
     * applicable for large screen devices (foldables and tablets).
+4 −0
Original line number Diff line number Diff line
@@ -117,6 +117,10 @@ constructor(
                (repository.isOneHandedBouncerSupportedInConfig && (authMethod !is Password))
        }

    /** Whether interactions should be improved for large-screen (non-handheld) form factor. */
    val isImproveLargeScreenInteractionEnabled: Boolean =
        repository.isImproveLargeScreenInteractionEnabledInConfig

    /**
     * Preferred side of the screen where the input area on the bouncer should be. This is
     * applicable for large screen devices (foldables and tablets).
+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)