MediaSessionService: Improve volume key handling log
Bug: 138752765
Test: Build
Change-Id: I3857a70d4a69adfa05d8a8904265f658153050b9
diff --git a/services/core/java/com/android/server/media/MediaSessionService.java b/services/core/java/com/android/server/media/MediaSessionService.java
index c05655a..193e0af 100644
--- a/services/core/java/com/android/server/media/MediaSessionService.java
+++ b/services/core/java/com/android/server/media/MediaSessionService.java
@@ -1912,16 +1912,17 @@
&& AudioSystem.isStreamActive(suggestedStream, 0)) {
preferSuggestedStream = true;
}
- if (DEBUG_KEY_EVENT) {
- Log.d(TAG, "Adjusting " + session + " by " + direction + ". flags="
- + flags + ", suggestedStream=" + suggestedStream
- + ", preferSuggestedStream=" + preferSuggestedStream);
- }
if (session == null || preferSuggestedStream) {
+ if (DEBUG_KEY_EVENT) {
+ Log.d(TAG, "Adjusting suggestedStream=" + suggestedStream + " by " + direction
+ + ". flags=" + flags + ", preferSuggestedStream="
+ + preferSuggestedStream + ", session=" + session);
+ }
if ((flags & AudioManager.FLAG_ACTIVE_MEDIA_ONLY) != 0
&& !AudioSystem.isStreamActive(AudioManager.STREAM_MUSIC, 0)) {
- if (DEBUG) {
- Log.d(TAG, "No active session to adjust, skipping media only volume event");
+ if (DEBUG_KEY_EVENT) {
+ Log.d(TAG, "Nothing is playing on the music stream. Skipping volume event,"
+ + " flags=" + flags);
}
return;
}
@@ -1955,6 +1956,11 @@
}
});
} else {
+ if (DEBUG_KEY_EVENT) {
+ Log.d(TAG, "Adjusting " + session + " by " + direction + ". flags="
+ + flags + ", suggestedStream=" + suggestedStream
+ + ", preferSuggestedStream=" + preferSuggestedStream);
+ }
session.adjustVolume(packageName, opPackageName, pid, uid, null, asSystemService,
direction, flags, true);
}