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

Commit 4ed5e98f authored by Phil Weaver's avatar Phil Weaver
Browse files

Simplify volume dialog title for a11y

The dialog was asked to essentially self-voice its
transitions a couple of years back. This isn't consistent
with our general guidelines for a11y, and isn't easy to
support. Rather than updating the messages, which will
still leave this dialog inconsistent with others, I'm
just deleting the extra code.

Just setting the dialog's title to the correct string is
enough for GAR, so I've added that back in.

Bug: 73170352
Test: Confirming with TestBack that the correct title is
sent to accessibility services when the window appears.

Change-Id: If219f86e43fa262604a09226a02bdd4c08ae4c1a
parent cbc4d36d
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1340,8 +1340,7 @@
    <string name="volume_stream_content_description_vibrate_a11y">%1$s. Tap to set to vibrate.</string>
    <string name="volume_stream_content_description_mute_a11y">%1$s. Tap to mute.</string>

    <string name="volume_dialog_accessibility_shown_message">%s volume controls shown. Swipe up to dismiss.</string>
    <string name="volume_dialog_accessibility_dismissed_message">Volume controls hidden</string>
    <string name="volume_dialog_title">%s volume controls</string>

    <string name="output_title">Media output</string>
    <string name="output_calls_title">Phone call output</string>
+2 −26
Original line number Diff line number Diff line
@@ -178,7 +178,6 @@ public class VolumeDialogImpl implements VolumeDialog {
                | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
                | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
                | WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        mWindow.setTitle(VolumeDialogImpl.class.getSimpleName());
        mWindow.setType(WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY);
        mWindow.setWindowAnimations(com.android.internal.R.style.Animation_Toast);
        final WindowManager.LayoutParams lp = mWindow.getAttributes();
@@ -491,15 +490,6 @@ public class VolumeDialogImpl implements VolumeDialog {
                }, 50))
                .start();

        if (mAccessibilityMgr.isEnabled()) {
            AccessibilityEvent event =
                    AccessibilityEvent.obtain(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
            event.setPackageName(mContext.getPackageName());
            event.setClassName(CustomDialog.class.getSuperclass().getName());
            event.getText().add(mContext.getString(
                    R.string.volume_dialog_accessibility_dismissed_message));
            mAccessibilityMgr.sendAccessibilityEvent(event);
        }
        Events.writeEvent(mContext, Events.EVENT_DISMISS_DIALOG, reason);
        mController.notifyVisible(false);
        synchronized (mSafetyWarningLock) {
@@ -670,6 +660,8 @@ public class VolumeDialogImpl implements VolumeDialog {
            updateVolumeRowH(row);
        }
        updateRingerH();
        mWindow.setTitle(mContext.getString(R.string.volume_dialog_title,
                getStreamLabelH(getActiveRow().ss)));
    }

    private void updateVolumeRowH(VolumeRow row) {
@@ -1065,22 +1057,6 @@ public class VolumeDialogImpl implements VolumeDialog {
            }
            return false;
        }

        @Override
        public boolean dispatchPopulateAccessibilityEvent(@NonNull AccessibilityEvent event) {
            event.setClassName(getClass().getSuperclass().getName());
            event.setPackageName(mContext.getPackageName());

            if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
                if (mShowing) {
                    event.getText().add(mContext.getString(
                            R.string.volume_dialog_accessibility_shown_message,
                            getStreamLabelH(getActiveRow().ss)));
                    return true;
                }
            }
            return false;
        }
    }

    private final class VolumeSeekBarChangeListener implements OnSeekBarChangeListener {