Properly announcing the shade state for accessibility
When we are entering / leaving quicksettings, accessible
users are now informed about the state change.
Also fixed a bug where the lockscreen was called notification
shade.
Bug: 15696654
Change-Id: I39d8ad3367c424ec5f9a3795be46d4785a19bbee
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
index 42ae0c9..d398bc1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -36,7 +36,6 @@
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
-
import com.android.systemui.R;
import com.android.systemui.qs.QSPanel;
import com.android.systemui.statusbar.ExpandableView;
@@ -160,6 +159,7 @@
private boolean mShadeEmpty;
private boolean mQsScrimEnabled = true;
+ private boolean mLastAnnouncementWasQuickSettings;
public NotificationPanelView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -425,8 +425,8 @@
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
- event.getText()
- .add(getContext().getString(R.string.accessibility_desc_notification_shade));
+ event.getText().add(getKeyguardOrLockScreenString());
+ mLastAnnouncementWasQuickSettings = false;
return true;
}
@@ -987,6 +987,10 @@
setQsExpanded(true);
} else if (height <= mQsMinExpansionHeight && mQsExpanded) {
setQsExpanded(false);
+ if (mLastAnnouncementWasQuickSettings && !mTracking) {
+ announceForAccessibility(getKeyguardOrLockScreenString());
+ mLastAnnouncementWasQuickSettings = false;
+ }
}
mQsExpansionHeight = height;
mHeader.setExpansion(getHeaderExpansionFraction());
@@ -1000,6 +1004,22 @@
&& !mStackScrollerOverscrolling && mQsScrimEnabled) {
mQsNavbarScrim.setAlpha(getQsExpansionFraction());
}
+
+ // Upon initialisation when we are not layouted yet we don't want to announce that we are
+ // fully expanded, hence the != 0.0f check.
+ if (height != 0.0f && mQsFullyExpanded && !mLastAnnouncementWasQuickSettings) {
+ announceForAccessibility(getContext().getString(
+ R.string.accessibility_desc_quick_settings));
+ mLastAnnouncementWasQuickSettings = true;
+ }
+ }
+
+ private String getKeyguardOrLockScreenString() {
+ if (mStatusBarState == StatusBarState.KEYGUARD) {
+ return getContext().getString(R.string.accessibility_desc_lock_screen);
+ } else {
+ return getContext().getString(R.string.accessibility_desc_notification_shade);
+ }
}
private void updateNotificationScrim(float height) {