From 717deadfdb2c6eb2a112c08573631ce49ce02f76 Mon Sep 17 00:00:00 2001 From: Beverly Date: Wed, 15 Apr 2020 13:46:14 -0400 Subject: [PATCH] Remove click listeners from app op icons Instead, the click listener is set on the app opp container since clicking on the app opp container results in the same action as clickng on the individual app icons. As per a11y guidance, only set the click listener on the container. Test: manual Fixes: 153281363 Change-Id: Ic1c2bdb2f77fc459a3a3e997ed494b4bab36a273 --- .../java/android/view/NotificationHeaderView.java | 3 +-- .../res/layout/notification_template_header.xml | 15 ++++++++------- ...otification_template_material_conversation.xml | 13 +++++++------ .../wrapper/NotificationHeaderViewWrapper.java | 10 ---------- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index a9f3e04036b57..0c50cb782c246 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -17,7 +17,6 @@ package android.view; import android.annotation.Nullable; -import android.app.AppOpsManager; import android.app.Notification; import android.compat.annotation.UnsupportedAppUsage; import android.content.Context; @@ -27,7 +26,6 @@ import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Rect; import android.graphics.drawable.Drawable; -import android.util.ArraySet; import android.util.AttributeSet; import android.widget.ImageView; import android.widget.LinearLayout; @@ -396,6 +394,7 @@ public class NotificationHeaderView extends ViewGroup { addRectAroundView(mIcon); mExpandButtonRect = addRectAroundView(mExpandButton); mAppOpsRect = addRectAroundView(mAppOps); + setTouchDelegate(new TouchDelegate(mAppOpsRect, mAppOps)); addWidthRect(); mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); } diff --git a/core/res/res/layout/notification_template_header.xml b/core/res/res/layout/notification_template_header.xml index 6f36aae8a1d4c..ece59e2abb228 100644 --- a/core/res/res/layout/notification_template_header.xml +++ b/core/res/res/layout/notification_template_header.xml @@ -143,34 +143,35 @@ android:layout_height="match_parent" android:layout_width="wrap_content" android:layout_marginStart="6dp" - android:orientation="horizontal" > - + - - diff --git a/core/res/res/layout/notification_template_material_conversation.xml b/core/res/res/layout/notification_template_material_conversation.xml index e986b1886abf8..8a57e057b084a 100644 --- a/core/res/res/layout/notification_template_material_conversation.xml +++ b/core/res/res/layout/notification_template_material_conversation.xml @@ -195,35 +195,36 @@ android:layout_width="wrap_content" android:paddingTop="3dp" android:layout_marginStart="2dp" + android:background="?android:selectableItemBackgroundBorderless" android:orientation="horizontal" > - - - diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java index 7ac066277c860..e20be2b719396 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/wrapper/NotificationHeaderViewWrapper.java @@ -18,7 +18,6 @@ package com.android.systemui.statusbar.notification.row.wrapper; import static com.android.systemui.statusbar.notification.TransformState.TRANSFORM_Y; -import android.annotation.NonNull; import android.app.AppOpsManager; import android.app.Notification; import android.content.Context; @@ -133,15 +132,6 @@ public class NotificationHeaderViewWrapper extends NotificationViewWrapper { if (mAppOps != null) { mAppOps.setOnClickListener(listener); } - if (mCameraIcon != null) { - mCameraIcon.setOnClickListener(listener); - } - if (mMicIcon != null) { - mMicIcon.setOnClickListener(listener); - } - if (mOverlayIcon != null) { - mOverlayIcon.setOnClickListener(listener); - } } /**