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

Commit e9d46994 authored by Yuri Lin's avatar Yuri Lin
Browse files

Replace long click handler with long click semantic indicator.

The long click handler was not doing anything because long clicks on ExpandableNotificationRow are not handled by simply calling view.performLongClick. Adding actual long click handling to BundleHeader was therefore sometimes consuming the long click that would have triggered opening the guts, without actually doing anything. It was happening "sometimes" because the long-click timeout was probably close enough between the two handlers that it was a toss-up on which handler activated first.

This puts us back in the state where BundleHeader is handling clicks and ExpandableNotificationRow handling long clicks, but with an extra label. It is still the case that both elements are selectable accessibility nodes for things like Voice Access, which can be ambiguous.

Fixes: 430881139
Test: manual
  - repeated long press on the bundle header always opens guts
  - confirmed header is listed as long-clickable in TalkBack
  - performed long click in TalkBack, Voice Access, Switch Access
Flag: com.android.systemui.notification_bundle_ui
Change-Id: Ia2f4d43745f096d723c522f448bcc4d64ab68d14
parent 3fc01416
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import androidx.compose.ui.semantics.collapse
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.dismiss
import androidx.compose.ui.semantics.expand
import androidx.compose.ui.semantics.onLongClick
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Dp
@@ -91,7 +92,6 @@ fun BundleHeader(
    viewModel: BundleHeaderViewModel,
    modifier: Modifier = Modifier,
    onHeaderClicked: () -> Unit = {},
    onHeaderLongClicked: () -> Unit = {},
    onA11yDismissAction: () -> Unit = {}, // only for dismissing via accessibility action
) {
    val state =
@@ -152,7 +152,6 @@ fun BundleHeader(
            modifier =
                Modifier.combinedClickable(
                        onClick = { toggle() },
                        onLongClick = { onHeaderLongClicked() },
                        interactionSource = null,
                        indication = null,
                    )
@@ -173,6 +172,9 @@ fun BundleHeader(
                            onA11yDismissAction()
                            true
                        }
                        // Do nothing. This is here to indicate that the BundleHeader is long
                        // clickable; the actual long click is handled by ExpandableNotificationRow.
                        onLongClick(action = null)
                    },
        ) {
            scene(BundleHeader.Scenes.Collapsed) {
+0 −1
Original line number Diff line number Diff line
@@ -187,7 +187,6 @@ private fun HeaderComposeViewContent(
        BundleHeader(
            viewModel,
            onHeaderClicked = { row.expandNotification() },
            onHeaderLongClicked = { row.performLongClick() },
            // to be used only for dismissal coming from an accessibility action.
            onA11yDismissAction = { row.performDismiss(true) },
        )