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

Commit c463be41 authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

AudioService: Add the service's message queue to the dump

Clogged queue means UI and other commands can not reach
the service and will cause volume controls to malfunction.

Example dump snippet:

Message handler (watch for unhandled messages):
  Handler (com.android.server.audio.AudioService$AudioHandler) {a904698} @ 61825
    Looper (AudioService, tid 118) {6808ef1}
      Message 0: { when=-52s689ms what=25 ... }
      Message 1: { when=-52s8ms what=8 ... }
      Message 2: { when=-52s4ms what=8 ... }
      ...
      Message 35: { when=-2s436ms what=0 ... }
      (Total messages: 36, polling=false, quitting=false)

This indicates that the command queue is not being processed
because the handler got stuck. Checking stacks of the system_server
can help in figuring out the reason.

Bug: 135763139
Test: adb shell dumpsys audio
Change-Id: I02009720668af218edb38d5a5948a5964b72c685
parent e1c38e1a
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -127,6 +127,7 @@ import android.util.AndroidRuntimeException;
import android.util.IntArray;
import android.util.IntArray;
import android.util.Log;
import android.util.Log;
import android.util.MathUtils;
import android.util.MathUtils;
import android.util.PrintWriterPrinter;
import android.util.Slog;
import android.util.Slog;
import android.util.SparseIntArray;
import android.util.SparseIntArray;
import android.view.KeyEvent;
import android.view.KeyEvent;
@@ -6379,6 +6380,12 @@ public class AudioService extends IAudioService.Stub
    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
        if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;
        if (!DumpUtils.checkDumpPermission(mContext, TAG, pw)) return;


        if (mAudioHandler != null) {
            pw.println("\nMessage handler (watch for unhandled messages):");
            mAudioHandler.dump(new PrintWriterPrinter(pw), "  ");
        } else {
            pw.println("\nMessage handler is null");
        }
        mMediaFocusControl.dump(pw);
        mMediaFocusControl.dump(pw);
        dumpStreamStates(pw);
        dumpStreamStates(pw);
        dumpRingerMode(pw);
        dumpRingerMode(pw);