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
This commit is contained in:
@@ -40,19 +40,20 @@ public class VolumeCtrl {
|
||||
|
||||
private final static String TAG = "VolumeCtrl";
|
||||
|
||||
// --stream affects --index, --adj or --get options.
|
||||
// --show affects --index and --adj options.
|
||||
// --stream affects --set, --adj or --get options.
|
||||
// --show affects --set and --adj options.
|
||||
public final static String USAGE = new String(
|
||||
"the options are as follows: \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--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--get outputs the current volume\n" +
|
||||
"\t\t--show shows the UI during the volume change\n" +
|
||||
"\texamples:\n" +
|
||||
"\t\tadb shell media volume --show --stream 3 --index 11\n" +
|
||||
"\t\tadb shell media volume --stream 0 --adj lower\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 3 --get\n"
|
||||
);
|
||||
|
||||
private final static int VOLUME_CONTROL_MODE_SET = 0;
|
||||
@@ -81,10 +82,6 @@ public class VolumeCtrl {
|
||||
case "--show":
|
||||
showUi = true;
|
||||
break;
|
||||
case "--set":
|
||||
mode = VOLUME_CONTROL_MODE_SET;
|
||||
log(LOG_V, "will set volume");
|
||||
break;
|
||||
case "--get":
|
||||
mode = VOLUME_CONTROL_MODE_GET;
|
||||
log(LOG_V, "will get volume");
|
||||
@@ -93,7 +90,7 @@ public class VolumeCtrl {
|
||||
stream = Integer.decode(cmd.nextArgRequired()).intValue();
|
||||
log(LOG_V, "will control stream=" + stream + " (" + streamName(stream) + ")");
|
||||
break;
|
||||
case "--index":
|
||||
case "--set":
|
||||
volIndex = Integer.decode(cmd.nextArgRequired()).intValue();
|
||||
mode = VOLUME_CONTROL_MODE_SET;
|
||||
log(LOG_V, "will set volume to index=" + volIndex);
|
||||
|
||||
Reference in New Issue
Block a user