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

Commit b6b30305 authored by Frank Barchard's avatar Frank Barchard
Browse files

media volume: remove old --set and rename --index to --set

The old --set did not take a parameter for volume and was
defaulting to volume index of 5.
The old --index option allowed the user to set the volume to
a specified value.
This CL removes the old --set that had limited usefulness, and
renames --index to --set, so --set now takes a parameter for
volume.
For backward compatibility the --index option is kept around
to allow scripts time to switch to --set

Bug: 33791633
Test: adb shell media volume --set 4
Change-Id: I43a87a878439b3416efa746708b62a869023acdc
parent a663b4bb
Loading
Loading
Loading
Loading
+7 −10
Original line number Original line Diff line number Diff line
@@ -40,19 +40,20 @@ public class VolumeCtrl {


    private final static String TAG = "VolumeCtrl";
    private final static String TAG = "VolumeCtrl";


    // --stream affects --index, --adj or --get options.
    // --stream affects --set, --adj or --get options.
    // --show affects --index and --adj options.
    // --show affects --set and --adj options.
    public final static String USAGE = new String(
    public final static String USAGE = new String(
            "the options are as follows: \n" +
            "the options are as follows: \n" +
            "\t\t--stream STREAM selects the stream to control, see AudioManager.STREAM_*\n" +
            "\t\t--stream STREAM selects the stream to control, see AudioManager.STREAM_*\n" +
            "\t\t                controls AudioManager.STREAM_MUSIC if no stream is specified\n"+
            "\t\t                controls AudioManager.STREAM_MUSIC if no stream is specified\n"+
            "\t\t--index INDEX   sets the volume index value\n" +
            "\t\t--set INDEX     sets the volume index value\n" +
            "\t\t--adj DIRECTION adjusts the volume, use raise|same|lower for the direction\n" +
            "\t\t--adj DIRECTION adjusts the volume, use raise|same|lower for the direction\n" +
            "\t\t--get           outputs the current volume\n" +
            "\t\t--get           outputs the current volume\n" +
            "\t\t--show          shows the UI during the volume change\n" +
            "\t\t--show          shows the UI during the volume change\n" +
            "\texamples:\n" +
            "\texamples:\n" +
            "\t\tadb shell media volume --show --stream 3 --index 11\n" +
            "\t\tadb shell media volume --show --stream 3 --set 11\n" +
            "\t\tadb shell media volume --stream 0 --adj lower\n"
            "\t\tadb shell media volume --stream 0 --adj lower\n" +
            "\t\tadb shell media volume --stream 3 --get\n"
            );
            );


    private final static int VOLUME_CONTROL_MODE_SET = 0;
    private final static int VOLUME_CONTROL_MODE_SET = 0;
@@ -81,10 +82,6 @@ public class VolumeCtrl {
                case "--show":
                case "--show":
                    showUi = true;
                    showUi = true;
                    break;
                    break;
                case "--set":
                    mode = VOLUME_CONTROL_MODE_SET;
                    log(LOG_V, "will set volume");
                    break;
                case "--get":
                case "--get":
                    mode = VOLUME_CONTROL_MODE_GET;
                    mode = VOLUME_CONTROL_MODE_GET;
                    log(LOG_V, "will get volume");
                    log(LOG_V, "will get volume");
@@ -93,7 +90,7 @@ public class VolumeCtrl {
                    stream = Integer.decode(cmd.nextArgRequired()).intValue();
                    stream = Integer.decode(cmd.nextArgRequired()).intValue();
                    log(LOG_V, "will control stream=" + stream + " (" + streamName(stream) + ")");
                    log(LOG_V, "will control stream=" + stream + " (" + streamName(stream) + ")");
                    break;
                    break;
                case "--index":
                case "--set":
                    volIndex = Integer.decode(cmd.nextArgRequired()).intValue();
                    volIndex = Integer.decode(cmd.nextArgRequired()).intValue();
                    mode = VOLUME_CONTROL_MODE_SET;
                    mode = VOLUME_CONTROL_MODE_SET;
                    log(LOG_V, "will set volume to index=" + volIndex);
                    log(LOG_V, "will set volume to index=" + volIndex);