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

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

Merge BundleHeader guts accessibility node & add a long click handler

This makes the guts selectable, with a long-click action both announced and available to be performed via accessibility action if needed. This essentially reproduces the AccessibilityDelegate added to other non-Compose notification guts views.

Fixes: 432285241
Test: manual by interacting with guts via both TalkBack and Voice Access
Flag: com.android.systemui.notification_bundle_ui
Change-Id: Ib5e54ba5e081f027737baa7c794d909908f537d1
parent c5f93c94
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -18,7 +18,10 @@ package com.android.systemui.statusbar.notification.row

import android.content.Context
import android.view.View
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.semantics.onLongClick
import androidx.compose.ui.semantics.semantics
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.repeatOnLifecycle
import com.android.compose.theme.PlatformTheme
@@ -62,7 +65,20 @@ class BundleHeaderGutsContent(context: Context) : GutsContent {
                composeView.setContent {
                    // TODO(b/399588047): Check if we can init PlatformTheme once instead of once
                    //  per ComposeView
                    PlatformTheme { BundleHeaderGuts(viewModel) }
                    PlatformTheme {
                        BundleHeaderGuts(
                            viewModel,
                            modifier =
                                Modifier.semantics(mergeDescendants = true) {
                                    onLongClick(
                                        action = {
                                            viewModel.onAllyLongClicked()
                                            true
                                        }
                                    )
                                },
                        )
                    }
                }
            }
        }
+5 −1
Original line number Diff line number Diff line
@@ -171,7 +171,11 @@ public class NotificationGuts extends FrameLayout {

    public void setGutsContent(GutsContent content) {
        content.setGutsParent(this);
        if (!(content instanceof BundleHeaderGutsContent)) {
            // Skip accessibility delegate for bundle header guts, as the info there is handled
            // on the Compose side.
            content.getContentView().setAccessibilityDelegate(mGutsContentAccessibilityDelegate);
        }
        mGutsContent = content;
        removeAllViews();
        addView(mGutsContent.getContentView());
+6 −0
Original line number Diff line number Diff line
@@ -59,4 +59,10 @@ class BundleHeaderGutsViewModel(
            disableBundle.invoke()
        }
    }

    // Long click action for accessibility action on BundleHeaderGuts only. Touch-based long click
    // handling is done through NotificationStackScrollLayoutController.
    fun onAllyLongClicked() {
        closeGuts.invoke()
    }
}