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

Commit 801dcba7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Switching talkback focus when bouncer is on screen" into main

parents 52fef1b2 df36718c
Loading
Loading
Loading
Loading
+33 −2
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.focusable
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.Box
@@ -25,6 +26,9 @@ import androidx.compose.ui.graphics.BlendMode
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.compose.animation.scene.Back
@@ -41,6 +45,7 @@ import com.android.compose.animation.scene.SwipeDirection
import com.android.compose.animation.scene.observableTransitionState
import com.android.compose.animation.scene.transitions
import com.android.compose.theme.LocalAndroidColorScheme
import com.android.internal.R.attr.focusable
import com.android.systemui.Flags.glanceableHubBackGesture
import com.android.systemui.communal.shared.model.CommunalBackgroundType
import com.android.systemui.communal.shared.model.CommunalScenes
@@ -207,6 +212,8 @@ fun CommunalContainer(
                backgroundType = backgroundType,
                colors = colors,
                content = content,
                viewModel = viewModel,
                modifier = Modifier.horizontalNestedScrollToScene(),
            )
        }
    }
@@ -222,17 +229,41 @@ private fun SceneScope.CommunalScene(
    backgroundType: CommunalBackgroundType,
    colors: CommunalColors,
    content: CommunalContent,
    viewModel: CommunalViewModel,
    modifier: Modifier = Modifier,
) {
    Box(modifier = Modifier.element(Communal.Elements.Scrim).fillMaxSize()) {
    val isFocusable by viewModel.isFocusable.collectAsStateWithLifecycle(initialValue = false)

    Box(
        modifier =
            Modifier.element(Communal.Elements.Scrim)
                .fillMaxSize()
                .then(
                    if (isFocusable) {
                        Modifier.focusable()
                    } else {
                        Modifier.semantics { contentDescription = "" }.clearAndSetSemantics {}
                    }
                )
    ) {
        when (backgroundType) {
            CommunalBackgroundType.STATIC -> DefaultBackground(colors = colors)
            CommunalBackgroundType.STATIC_GRADIENT -> StaticLinearGradient()
            CommunalBackgroundType.ANIMATED -> AnimatedLinearGradient()
            CommunalBackgroundType.NONE -> BackgroundTopScrim()
        }

        with(content) {
            Content(
                modifier =
                    modifier.focusable(isFocusable).semantics {
                        if (!isFocusable) {
                            contentDescription = ""
                        }
                    }
            )
        }
    }
    with(content) { Content(modifier = modifier) }
}

/** Default background of the hub, a single color */
+3 −0
Original line number Diff line number Diff line
@@ -724,7 +724,10 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard
    @Override
    public void onResume(int reason) {
        if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
        mView.clearFocus();
        mView.clearAccessibilityFocus();
        mView.requestFocus();
        mView.requestAccessibilityFocus();
        if (mCurrentSecurityMode != SecurityMode.None) {
            int state = SysUiStatsLog.KEYGUARD_BOUNCER_STATE_CHANGED__STATE__SHOWN;
            if (mView.isSidedSecurityMode()) {
+19 −4
Original line number Diff line number Diff line
@@ -74,15 +74,26 @@ object DeviceEntryIconViewBinder {
        val bgView = view.bgView
        longPressHandlingView.listener =
            object : LongPressHandlingView.Listener {
                override fun onLongPressDetected(view: View, x: Int, y: Int, isA11yAction: Boolean) {
                    if (!isA11yAction && falsingManager.isFalseLongTap(FalsingManager.LOW_PENALTY)) {
                override fun onLongPressDetected(
                    view: View,
                    x: Int,
                    y: Int,
                    isA11yAction: Boolean
                ) {
                    if (
                        !isA11yAction && falsingManager.isFalseLongTap(FalsingManager.LOW_PENALTY)
                    ) {
                        return
                    }
                    vibratorHelper.performHapticFeedback(
                        view,
                        HapticFeedbackConstants.CONFIRM,
                    )
                    applicationScope.launch { viewModel.onUserInteraction() }
                    applicationScope.launch {
                        view.clearFocus()
                        view.clearAccessibilityFocus()
                        viewModel.onUserInteraction()
                    }
                }
            }

@@ -131,7 +142,11 @@ object DeviceEntryIconViewBinder {
                                        view,
                                        HapticFeedbackConstants.CONFIRM,
                                    )
                                    applicationScope.launch { viewModel.onUserInteraction() }
                                    applicationScope.launch {
                                        view.clearFocus()
                                        view.clearAccessibilityFocus()
                                        viewModel.onUserInteraction()
                                    }
                                }
                            } else {
                                view.setOnClickListener(null)