diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java index 6e6baeadd45da..3069e5ade5825 100644 --- a/core/java/android/view/NotificationHeaderView.java +++ b/core/java/android/view/NotificationHeaderView.java @@ -21,9 +21,9 @@ import android.content.Context; import android.graphics.Canvas; import android.graphics.Outline; import android.graphics.Rect; -import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.util.AttributeSet; +import android.view.accessibility.AccessibilityNodeInfo; import android.widget.ImageView; import android.widget.RemoteViews; @@ -230,6 +230,7 @@ public class NotificationHeaderView extends ViewGroup { public void setOnClickListener(@Nullable OnClickListener l) { mExpandClickListener = l; setOnTouchListener(mExpandClickListener != null ? mTouchListener : null); + setFocusable(l != null); updateTouchListener(); } @@ -379,6 +380,19 @@ public class NotificationHeaderView extends ViewGroup { return this; } + @Override + public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) { + super.onInitializeAccessibilityNodeInfo(info); + if (mExpandClickListener != null) { + AccessibilityNodeInfo.AccessibilityAction expand + = new AccessibilityNodeInfo.AccessibilityAction( + AccessibilityNodeInfo.ACTION_CLICK, + getContext().getString( + com.android.internal.R.string.expand_action_accessibility)); + info.addAction(expand); + } + } + public ImageView getExpandButton() { return mExpandButton; } diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index eef8fcf6e3e6f..3b3fc43d637d2 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -4263,7 +4263,7 @@ Expand button - Click to expand + toggle expansion Android USB Peripheral Port diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index bd51258b4dbc2..2de50068cb8d8 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2569,6 +2569,7 @@ + diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 27585513bf712..f7a169cb4d5b6 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -594,6 +594,12 @@ + %s + + + %s more notification inside. + %s more notifications inside. + + Notification settings diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 6e9e8303f9056..b855b7cf955d0 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 @@ package com.android.systemui.statusbar; 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; @@ -181,6 +180,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { return object.getTranslation(); } }; + private OnClickListener mOnClickListener; public boolean isGroupExpansionChanging() { if (isChildInGroup()) { @@ -382,6 +382,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mNotificationParent = childInGroup ? parent : null; mPrivateLayout.setIsChildInGroup(childInGroup); updateBackgroundForGroupState(); + updateClickAndFocus(); if (mNotificationParent != null) { mNotificationParent.updateBackgroundForGroupState(); } @@ -593,6 +594,24 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { 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; } @@ -1315,6 +1334,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { 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 8f2c81f0726b1..7373607501823 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 @@ public class HybridGroupManager { 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 a0f1bc2ceaf03..ba191cd1d31ef 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 @@ public class NotificationChildrenContainer extends ViewGroup { 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) {