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

Commit 2b29bc4c authored by John Spurlock's avatar John Spurlock
Browse files

Enhance audio service dumpsys.

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

Bug:16964015
Change-Id: I92facbd8ae49ba299c27bcb10bcf6668fed0d302
parent 1a08a8f5
Loading
Loading
Loading
Loading
+17 −2
Original line number Diff line number Diff line
@@ -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(", ");
                }
            }
        }
    }
+3 −0
Original line number Diff line number Diff line
@@ -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 "";