From 2a0ce1192463eed12640c19915f7702763f81932 Mon Sep 17 00:00:00 2001 From: Mikhail Naganov Date: Wed, 26 Jun 2019 16:56:03 -0700 Subject: 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 Merged-In: I02009720668af218edb38d5a5948a5964b72c685 --- services/core/java/com/android/server/audio/AudioService.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/core/java/com/android/server/audio/AudioService.java b/services/core/java/com/android/server/audio/AudioService.java index cbe825f26de6..df8c480d3b30 100644 --- a/services/core/java/com/android/server/audio/AudioService.java +++ b/services/core/java/com/android/server/audio/AudioService.java @@ -127,6 +127,7 @@ import android.util.AndroidRuntimeException; import android.util.IntArray; import android.util.Log; import android.util.MathUtils; +import android.util.PrintWriterPrinter; import android.util.Slog; import android.util.SparseIntArray; import android.view.KeyEvent; @@ -6375,6 +6376,12 @@ public class AudioService extends IAudioService.Stub protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) { 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); dumpStreamStates(pw); dumpRingerMode(pw); -- cgit v1.2.3-59-g8ed1b