Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90c94658 authored by Selim Cinek's avatar Selim Cinek
Browse files

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
parent 29e3080a
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -397,6 +397,8 @@
    <string name="accessibility_desc_notification_shade">Notification shade.</string>
    <!-- Content description for the quick settings panel (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_desc_quick_settings">Quick settings.</string>
    <!-- Content description for the lock screen (not shown on the screen). [CHAR LIMIT=NONE] -->
    <string name="accessibility_desc_lock_screen">Lock screen.</string>
    <!-- Content description for the settings button in the status bar header. [CHAR LIMIT=NONE] -->
    <string name="accessibility_desc_settings">Settings</string>
    <!-- Content description for the recent apps panel (not shown on the screen). [CHAR LIMIT=NONE] -->
+23 −3
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.view.animation.Interpolator;
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 @@ public class NotificationPanelView extends PanelView implements
    private boolean mShadeEmpty;

    private boolean mQsScrimEnabled = true;
    private boolean mLastAnnouncementWasQuickSettings;

    public NotificationPanelView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -425,8 +425,8 @@ public class NotificationPanelView extends PanelView implements
    @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 @@ public class NotificationPanelView extends PanelView implements
            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 @@ public class NotificationPanelView extends PanelView implements
                && !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) {