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

Commit 1c94fdc4 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge changes from topic 'a11yModal'

* changes:
  Javadoc and AudioManager update for A11Y stream
  Conditional behavior for a11y stream volume
parents d24ea455 8e0bc783
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -801,8 +801,8 @@ public class AudioManager {
     * management of audio settings or the main telephony application.
     *
     * @param streamType The stream type to adjust. One of {@link #STREAM_VOICE_CALL},
     * {@link #STREAM_SYSTEM}, {@link #STREAM_RING}, {@link #STREAM_MUSIC} or
     * {@link #STREAM_ALARM}
     * {@link #STREAM_SYSTEM}, {@link #STREAM_RING}, {@link #STREAM_MUSIC},
     * {@link #STREAM_ALARM} or {@link #STREAM_ACCESSIBILITY}.
     * @param direction The direction to adjust the volume. One of
     *            {@link #ADJUST_LOWER}, {@link #ADJUST_RAISE}, or
     *            {@link #ADJUST_SAME}.
@@ -3195,7 +3195,8 @@ public class AudioManager {
     *            {@link #STREAM_MUSIC},
     *            {@link #STREAM_ALARM},
     *            {@link #STREAM_NOTIFICATION},
     *            {@link #STREAM_DTMF}.
     *            {@link #STREAM_DTMF},
     *            {@link #STREAM_ACCESSIBILITY}.
     *
     * @return The bit-mask "or" of audio output device codes for all enabled devices on this
     *         stream. Zero or more of
@@ -3238,6 +3239,7 @@ public class AudioManager {
        case STREAM_ALARM:
        case STREAM_NOTIFICATION:
        case STREAM_DTMF:
        case STREAM_ACCESSIBILITY:
            return AudioSystem.getDevicesForStream(streamType);
        default:
            return 0;
+7 −0
Original line number Diff line number Diff line
@@ -32,4 +32,11 @@ oneway interface IVolumeController {
    void setLayoutDirection(int layoutDirection);

    void dismiss();

    /**
     * Change the a11y mode.
     * @param a11yMode one of {@link VolumePolicy#A11Y_MODE_MEDIA_A11Y_VOLUME},
     *     {@link VolumePolicy#A11Y_MODE_INDEPENDENT_A11Y_VOLUME}
     */
    void setA11yMode(int mode);
}
+11 −0
Original line number Diff line number Diff line
@@ -25,6 +25,17 @@ import java.util.Objects;
public final class VolumePolicy implements Parcelable {
    public static final VolumePolicy DEFAULT = new VolumePolicy(false, false, true, 400);

    /**
     * Accessibility volume policy where the STREAM_MUSIC volume (i.e. media volume) affects
     * the STREAM_ACCESSIBILITY volume, and vice-versa.
     */
    public static final int A11Y_MODE_MEDIA_A11Y_VOLUME = 0;
    /**
     * Accessibility volume policy where the STREAM_ACCESSIBILITY volume is independent from
     * any other volume.
     */
    public static final int A11Y_MODE_INDEPENDENT_A11Y_VOLUME = 1;

    /** Allow volume adjustments lower from vibrate to enter ringer mode = silent */
    public final boolean volumeDownToEnterSilent;

+1 −0
Original line number Diff line number Diff line
@@ -1120,6 +1120,7 @@
        <item></item> <!-- STREAM_SYSTEM_ENFORCED -->
        <item></item> <!-- STREAM_DTMF -->
        <item></item> <!-- STREAM_TTS -->
        <item>Accessibility</item> <!-- STREAM_ACCESSIBILITY -->
    </string-array>

    <string name="volume_stream_muted" translatable="false">%s silent</string>
+17 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ public class VolumeDialogController {
        AudioSystem.STREAM_SYSTEM_ENFORCED,
        AudioSystem.STREAM_TTS,
        AudioSystem.STREAM_VOICE_CALL,
        AudioSystem.STREAM_ACCESSIBILITY,
    };

    private final HandlerThread mWorkerThread;
@@ -562,6 +563,22 @@ public class VolumeDialogController {
                    .sendToTarget();
            mWorker.sendEmptyMessage(W.DISMISS_REQUESTED);
        }

        @Override
        public void setA11yMode(int mode) {
            if (D.BUG) Log.d(TAG, "setA11yMode to " + mode);
            if (mDestroyed) return;
            switch (mode) {
                case VolumePolicy.A11Y_MODE_MEDIA_A11Y_VOLUME:
                    // "legacy" mode
                    break;
                case VolumePolicy.A11Y_MODE_INDEPENDENT_A11Y_VOLUME:
                    break;
                default:
                    Log.e(TAG, "Invalid accessibility mode " + mode);
                    break;
            }
        }
    }

    private final class W extends Handler {
Loading