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) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridGroupManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridGroupManager.java
index 8f2c81f..7373607 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridGroupManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/HybridGroupManager.java
@@ -112,6 +112,10 @@
if (!text.equals(reusableView.getText())) {
reusableView.setText(text);
}
+ String contentDescription = String.format(mContext.getResources().getQuantityString(
+ R.plurals.notification_group_overflow_description, number), number);
+
+ reusableView.setContentDescription(contentDescription);
return reusableView;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
index cb0b848..2cc36ee 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java
@@ -670,6 +670,11 @@
if (mNotificationHeader != null) {
mNotificationHeader.setExpanded(childrenExpanded);
}
+ final int count = mChildren.size();
+ for (int childIdx = 0; childIdx < count; childIdx++) {
+ ExpandableNotificationRow child = mChildren.get(childIdx);
+ child.setChildrenExpanded(childrenExpanded, false);
+ }
}
public void setNotificationParent(ExpandableNotificationRow parent) {