Fixed a few accessibility issues with notifications and groups
Change-Id: I78fa62884eaa0efe825b5eb1e6cac7d88fc05a7f
Fixes: 28069681
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index c53ab59..e55b0f4 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -18,10 +18,9 @@
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
-import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
-import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
+import android.annotation.Nullable;
import android.content.Context;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.AnimationDrawable;
@@ -173,6 +172,7 @@
return object.getTranslation();
}
};
+ private OnClickListener mOnClickListener;
public boolean isGroupExpansionChanging() {
if (isChildInGroup()) {
@@ -374,6 +374,7 @@
mNotificationParent = childInGroup ? parent : null;
mPrivateLayout.setIsChildInGroup(childInGroup);
updateBackgroundForGroupState();
+ updateClickAndFocus();
if (mNotificationParent != null) {
mNotificationParent.updateBackgroundForGroupState();
}
@@ -585,6 +586,24 @@
mOnExpandClickListener = onExpandClickListener;
}
+ @Override
+ public void setOnClickListener(@Nullable OnClickListener l) {
+ super.setOnClickListener(l);
+ mOnClickListener = l;
+ updateClickAndFocus();
+ }
+
+ private void updateClickAndFocus() {
+ boolean normalChild = !isChildInGroup() || isGroupExpanded();
+ boolean clickable = mOnClickListener != null && normalChild;
+ if (isFocusable() != normalChild) {
+ setFocusable(normalChild);
+ }
+ if (isClickable() != clickable) {
+ setClickable(clickable);
+ }
+ }
+
public void setHeadsUpManager(HeadsUpManager headsUpManager) {
mHeadsUpManager = headsUpManager;
}
@@ -1305,6 +1324,7 @@
if (mChildrenContainer != null) {
mChildrenContainer.setChildrenExpanded(expanded);
}
+ updateClickAndFocus();
}
public static void applyTint(View v, int color) {