Fix notification snooze a11y issues
- Set minimum height and width on the snooze "undo" button - Update logic in performAccessibilityActionInternal in ExpandableNotificationRow so that snoozing a notification from Talkback/switch access/voice access actually performs the snooze action - After a user selects a new snooze time option for a notification, the snooze options close. Focus should remain on the snooze time, since that element was just changed. - Once a user snoozes a notification, it should focus on the child SnoozeView instead of the greater NotificationSnooze view because only the SnoozeView is actionable. So if focus is requested on the NotificationSnooze view and the options aren't expanded, then focus just on the SnoozeView. Test: manual, use a11y scanner Fixes: 152730944 Fixes: 152820361 Fixes: 152720315 Fixes: 152718852 Change-Id: I7e43bddfdaa3b5a1741645f7bb54af42bc953fc3 Change-Id: I4672654d4ca2eb2cf68539efb7cfb0c8f5dfb00b
This commit is contained in:
@@ -20,7 +20,6 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:clickable="true"
|
||||
android:background="@color/notification_material_background_color"
|
||||
android:theme="@style/Theme.SystemUI">
|
||||
|
||||
@@ -55,6 +54,8 @@
|
||||
android:layout_marginEnd="@dimen/notification_guts_button_side_margin"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:minWidth="@dimen/min_clickable_item_size"
|
||||
android:minHeight="@dimen/min_clickable_item_size"
|
||||
android:text="@string/snooze_undo"
|
||||
style="@style/TextAppearance.NotificationInfo.Button" />
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Recommended minimum clickable element dimension -->
|
||||
<dimen name="min_clickable_item_size">48dp</dimen>
|
||||
|
||||
<!-- Amount to offset bottom of notification peek window from top of status bar. -->
|
||||
<dimen name="peek_window_y_offset">-12dp</dimen>
|
||||
|
||||
|
||||
@@ -3001,9 +3001,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
||||
default:
|
||||
if (action == R.id.action_snooze) {
|
||||
NotificationMenuRowPlugin provider = getProvider();
|
||||
if (provider == null && mMenuRow != null) {
|
||||
provider = createMenu();
|
||||
} else {
|
||||
if (provider == null) {
|
||||
return false;
|
||||
}
|
||||
MenuItem snoozeMenu = provider.getSnoozeMenuItem(getContext());
|
||||
|
||||
@@ -79,6 +79,7 @@ public class NotificationSnooze extends LinearLayout
|
||||
private NotificationSwipeActionHelper mSnoozeListener;
|
||||
private StatusBarNotification mSbn;
|
||||
|
||||
private View mSnoozeView;
|
||||
private TextView mSelectedOptionText;
|
||||
private TextView mUndoButton;
|
||||
private ImageView mExpandButton;
|
||||
@@ -122,7 +123,8 @@ public class NotificationSnooze extends LinearLayout
|
||||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mCollapsedHeight = getResources().getDimensionPixelSize(R.dimen.snooze_snackbar_min_height);
|
||||
findViewById(R.id.notification_snooze).setOnClickListener(this);
|
||||
mSnoozeView = findViewById(R.id.notification_snooze);
|
||||
mSnoozeView.setOnClickListener(this);
|
||||
mSelectedOptionText = (TextView) findViewById(R.id.snooze_option_default);
|
||||
mUndoButton = (TextView) findViewById(R.id.undo);
|
||||
mUndoButton.setOnClickListener(this);
|
||||
@@ -146,16 +148,6 @@ public class NotificationSnooze extends LinearLayout
|
||||
logOptionSelection(MetricsEvent.NOTIFICATION_SNOOZE_CLICKED, mDefaultOption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
|
||||
super.onInitializeAccessibilityEvent(event);
|
||||
if (mGutsContainer != null && mGutsContainer.isExposed()) {
|
||||
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
|
||||
event.getText().add(mSelectedOptionText.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||
super.onInitializeAccessibilityNodeInfo(info);
|
||||
@@ -341,12 +333,22 @@ public class NotificationSnooze extends LinearLayout
|
||||
mSelectedOptionText.setText(option.getConfirmation());
|
||||
showSnoozeOptions(false);
|
||||
hideSelectedOption();
|
||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
||||
if (userAction) {
|
||||
mSnoozeView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||
logOptionSelection(MetricsEvent.NOTIFICATION_SELECT_SNOOZE, option);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean requestAccessibilityFocus() {
|
||||
if (mExpanded) {
|
||||
return super.requestAccessibilityFocus();
|
||||
} else {
|
||||
mSnoozeView.requestAccessibilityFocus();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void logOptionSelection(int category, SnoozeOption option) {
|
||||
int index = mSnoozeOptions.indexOf(option);
|
||||
long duration = TimeUnit.MINUTES.toMillis(option.getMinutesToSnoozeFor());
|
||||
|
||||
Reference in New Issue
Block a user