diff options
| author | 2020-04-15 13:46:14 -0400 | |
|---|---|---|
| committer | 2020-04-16 09:34:29 -0400 | |
| commit | 717deadfdb2c6eb2a112c08573631ce49ce02f76 (patch) | |
| tree | 51f9e24959e42b2d4bbb242d86bc5cb06f75c053 | |
| parent | a018ca00cfaa872716e59d17c5b7ccaa7347ef68 (diff) | |
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
4 files changed, 16 insertions, 25 deletions
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index a9f3e04036b5..0c50cb782c24 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 6f36aae8a1d4..ece59e2abb22 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" > - <ImageButton + android:background="?android:selectableItemBackgroundBorderless" + android:orientation="horizontal"> + <ImageView android:id="@+id/camera" android:layout_width="?attr/notificationHeaderIconSize" android:layout_height="?attr/notificationHeaderIconSize" android:src="@drawable/ic_camera" - android:background="?android:selectableItemBackgroundBorderless" android:visibility="gone" + android:focusable="false" android:contentDescription="@string/notification_appops_camera_active" /> - <ImageButton + <ImageView android:id="@+id/mic" android:layout_width="?attr/notificationHeaderIconSize" android:layout_height="?attr/notificationHeaderIconSize" android:src="@drawable/ic_mic" - android:background="?android:selectableItemBackgroundBorderless" android:layout_marginStart="4dp" android:visibility="gone" + android:focusable="false" android:contentDescription="@string/notification_appops_microphone_active" /> - <ImageButton + <ImageView android:id="@+id/overlay" android:layout_width="?attr/notificationHeaderIconSize" android:layout_height="?attr/notificationHeaderIconSize" android:src="@drawable/ic_alert_window_layer" - android:background="?android:selectableItemBackgroundBorderless" android:layout_marginStart="4dp" android:visibility="gone" + android:focusable="false" android:contentDescription="@string/notification_appops_overlay_active" /> </LinearLayout> diff --git a/core/res/res/layout/notification_template_material_conversation.xml b/core/res/res/layout/notification_template_material_conversation.xml index e986b1886abf..8a57e057b084 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" > - <ImageButton + <ImageView android:layout_marginStart="4dp" android:id="@+id/camera" android:layout_width="?attr/notificationHeaderIconSize" android:layout_height="?attr/notificationHeaderIconSize" android:src="@drawable/ic_camera" - android:background="?android:selectableItemBackgroundBorderless" android:visibility="gone" + android:focusable="false" android:contentDescription="@string/notification_appops_camera_active" /> - <ImageButton + <ImageView android:id="@+id/mic" android:layout_width="?attr/notificationHeaderIconSize" android:layout_height="?attr/notificationHeaderIconSize" android:src="@drawable/ic_mic" - android:background="?android:selectableItemBackgroundBorderless" android:layout_marginStart="4dp" android:visibility="gone" + android:focusable="false" android:contentDescription="@string/notification_appops_microphone_active" /> - <ImageButton + <ImageView android:id="@+id/overlay" android:layout_width="?attr/notificationHeaderIconSize" android:layout_height="?attr/notificationHeaderIconSize" android:src="@drawable/ic_alert_window_layer" - android:background="?android:selectableItemBackgroundBorderless" android:layout_marginStart="4dp" android:visibility="gone" + android:focusable="false" android:contentDescription="@string/notification_appops_overlay_active" /> </LinearLayout> 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 7ac066277c86..e20be2b71939 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); - } } /** |