OSDN Git Service

Improved accessibility behavior of the notification shelf
authorSelim Cinek <cinek@google.com>
Wed, 5 Apr 2017 23:28:56 +0000 (16:28 -0700)
committerSelim Cinek <cinek@google.com>
Wed, 5 Apr 2017 23:28:56 +0000 (16:28 -0700)
The content description of the shelf was hiding the icons,
so we removed it again.
Also added an expand action to make it clear that you can expand it.
Also made scrolling in the normal shade better again by marking it
to hide it's children.

Test: manual, test accessibility on the lockscreen
Change-Id: If96c014609f3fa1b7eedb5e89acd8fe55d5b9c69
Fixes: 36660851

packages/SystemUI/res/layout/status_bar_notification_shelf.xml
packages/SystemUI/res/values/strings.xml
packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java

index 6db16fe..7bfbd3c 100644 (file)
@@ -19,7 +19,6 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="@dimen/notification_shelf_height"
-    android:contentDescription="@string/notification_shelf_content_description"
     android:focusable="true"
     android:clickable="true"
     >
index a8cf3da..2263f23 100644 (file)
     <string name="accessibility_notifications_button">Notifications.</string>
 
     <!-- Content description of overflow icon container of the notifications for accessibility (not shown on the screen)[CHAR LIMIT=NONE] -->
-    <string name="notification_shelf_content_description">Notification overflow container</string>
+    <string name="accessibility_overflow_action">See all notifications</string>
 
     <!-- Content description of the button for removing a notification in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
     <string name="accessibility_remove_notification">Clear notification.</string>
index a0f2891..6354255 100644 (file)
@@ -22,6 +22,7 @@ import android.os.SystemProperties;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityNodeInfo;
 
 import com.android.internal.widget.CachingIconView;
 import com.android.systemui.Interpolators;
@@ -580,7 +581,7 @@ public class NotificationShelf extends ActivatableNotificationView implements
         setClickable(mInteractive);
         setFocusable(mInteractive);
         setImportantForAccessibility(mInteractive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
-                : View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+                : View.IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS);
     }
 
     @Override
@@ -607,6 +608,19 @@ public class NotificationShelf extends ActivatableNotificationView implements
     }
 
     @Override
+    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
+        super.onInitializeAccessibilityNodeInfo(info);
+        if (mInteractive) {
+            info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_EXPAND);
+            AccessibilityNodeInfo.AccessibilityAction unlock
+                    = new AccessibilityNodeInfo.AccessibilityAction(
+                    AccessibilityNodeInfo.ACTION_CLICK,
+                    getContext().getString(R.string.accessibility_overflow_action));
+            info.addAction(unlock);
+        }
+    }
+
+    @Override
     public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
             int oldTop, int oldRight, int oldBottom) {
         updateRelativeOffset();