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

Commit 40805b9f authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "A11y updates for new a11y stream."

parents 6e2026c3 7c502e0c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1164,6 +1164,8 @@
    <string name="volume_stream_content_description_unmute">%1$s. Tap to unmute.</string>
    <string name="volume_stream_content_description_vibrate">%1$s. Tap to set to vibrate. Accessibility services may be muted.</string>
    <string name="volume_stream_content_description_mute">%1$s. Tap to mute. Accessibility services may be muted.</string>
    <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>
+38 −26
Original line number Diff line number Diff line
@@ -426,6 +426,7 @@ public class VolumeDialog implements TunerService.Tunable {
        });
        row.icon = (ImageButton) row.view.findViewById(R.id.volume_row_icon);
        row.icon.setImageResource(iconRes);
        if (row.stream != AudioSystem.STREAM_ACCESSIBILITY) {
            row.icon.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
@@ -438,7 +439,8 @@ public class VolumeDialog implements TunerService.Tunable {
                                mController.setRingerMode(AudioManager.RINGER_MODE_VIBRATE, false);
                            } else {
                                final boolean wasZero = row.ss.level == 0;
                            mController.setStreamVolume(stream, wasZero ? row.lastAudibleLevel : 0);
                                mController.setStreamVolume(stream,
                                        wasZero ? row.lastAudibleLevel : 0);
                            }
                        } else {
                            mController.setRingerMode(AudioManager.RINGER_MODE_NORMAL, false);
@@ -451,10 +453,11 @@ public class VolumeDialog implements TunerService.Tunable {
                        mController.setStreamVolume(stream,
                                vmute ? row.lastAudibleLevel : row.ss.levelMin);
                    }
                row.userAttempt = 0;  // reset the grace period, slider should update immediately
                    row.userAttempt = 0;  // reset the grace period, slider updates immediately
                }
            });
        }
    }

    public void destroy() {
        mController.removeCallback(mControllerCallbackH);
@@ -722,6 +725,7 @@ public class VolumeDialog implements TunerService.Tunable {
        if (ss.level == row.requestedLevel) {
            row.requestedLevel = -1;
        }
        final boolean isA11yStream = row.stream == AudioManager.STREAM_ACCESSIBILITY;
        final boolean isRingStream = row.stream == AudioManager.STREAM_RING;
        final boolean isSystemStream = row.stream == AudioManager.STREAM_SYSTEM;
        final boolean isAlarmStream = row.stream == AudioManager.STREAM_ALARM;
@@ -781,14 +785,20 @@ public class VolumeDialog implements TunerService.Tunable {
                } else {
                    if (mController.hasVibrator()) {
                        row.icon.setContentDescription(mContext.getString(
                                R.string.volume_stream_content_description_vibrate,
                                mShowA11yStream
                                        ? R.string.volume_stream_content_description_vibrate_a11y
                                        : R.string.volume_stream_content_description_vibrate,
                                getStreamLabelH(ss)));
                    } else {
                        row.icon.setContentDescription(mContext.getString(
                                R.string.volume_stream_content_description_mute,
                                mShowA11yStream
                                        ? R.string.volume_stream_content_description_mute_a11y
                                        : R.string.volume_stream_content_description_mute,
                                getStreamLabelH(ss)));
                    }
                }
            } else if (isA11yStream) {
                row.icon.setContentDescription(getStreamLabelH(ss));
            } else {
                if (ss.muted || mAutomute && ss.level == 0) {
                   row.icon.setContentDescription(mContext.getString(
@@ -796,7 +806,9 @@ public class VolumeDialog implements TunerService.Tunable {
                           getStreamLabelH(ss)));
                } else {
                    row.icon.setContentDescription(mContext.getString(
                            R.string.volume_stream_content_description_mute,
                            mShowA11yStream
                                    ? R.string.volume_stream_content_description_mute_a11y
                                    : R.string.volume_stream_content_description_mute,
                            getStreamLabelH(ss)));
                }
            }