Enhance audio service dumpsys.

- Add device name for keys
 - Add max volume for streams
 - Add missing stream name constant

Bug:16964015
Change-Id: I92facbd8ae49ba299c27bcb10bcf6668fed0d302
This commit is contained in:
John Spurlock
2014-08-26 16:40:35 -04:00
parent 1a08a8f52f
commit 2b29bc4c1c
2 changed files with 20 additions and 2 deletions

View File

@@ -3486,13 +3486,28 @@ public class AudioService extends IAudioService.Stub {
private void dump(PrintWriter pw) {
pw.print(" Mute count: ");
pw.println(muteCount());
pw.print(" Max: ");
pw.println((mIndexMax + 5) / 10);
pw.print(" Current: ");
Set set = mIndex.entrySet();
Iterator i = set.iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry)i.next();
pw.print(Integer.toHexString(((Integer)entry.getKey()).intValue())
+ ": " + ((((Integer)entry.getValue()).intValue() + 5) / 10)+", ");
final int device = (Integer) entry.getKey();
pw.print(Integer.toHexString(device));
final String deviceName = device == AudioSystem.DEVICE_OUT_DEFAULT ? "default"
: AudioSystem.getOutputDeviceName(device);
if (!deviceName.isEmpty()) {
pw.print(" (");
pw.print(deviceName);
pw.print(")");
}
pw.print(": ");
final int index = (((Integer) entry.getValue()) + 5) / 10;
pw.print(index);
if (i.hasNext()) {
pw.print(", ");
}
}
}
}

View File

@@ -371,6 +371,7 @@ public class AudioSystem
public static final String DEVICE_OUT_HDMI_ARC_NAME = "hmdi_arc";
public static final String DEVICE_OUT_SPDIF_NAME = "spdif";
public static final String DEVICE_OUT_FM_NAME = "fm_transmitter";
public static final String DEVICE_OUT_AUX_LINE_NAME = "aux_line";
public static String getOutputDeviceName(int device)
{
@@ -417,6 +418,8 @@ public class AudioSystem
return DEVICE_OUT_SPDIF_NAME;
case DEVICE_OUT_FM:
return DEVICE_OUT_FM_NAME;
case DEVICE_OUT_AUX_LINE:
return DEVICE_OUT_AUX_LINE_NAME;
case DEVICE_OUT_DEFAULT:
default:
return "";