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

Commit 6b72d01f authored by Jaewan Kim's avatar Jaewan Kim
Browse files

MediaSessionService: Improve volume key handling log

Bug: 138752765
Test: Build
Change-Id: I3857a70d4a69adfa05d8a8904265f658153050b9
parent f80171ef
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -1912,16 +1912,17 @@ public class MediaSessionService extends SystemService implements Monitor {
                    && AudioSystem.isStreamActive(suggestedStream, 0)) {
                preferSuggestedStream = true;
            }
            if (session == null || preferSuggestedStream) {
                if (DEBUG_KEY_EVENT) {
                Log.d(TAG, "Adjusting " + session + " by " + direction + ". flags="
                        + flags + ", suggestedStream=" + suggestedStream
                        + ", preferSuggestedStream=" + preferSuggestedStream);
                    Log.d(TAG, "Adjusting suggestedStream=" + suggestedStream + " by " + direction
                            + ". flags=" + flags + ", preferSuggestedStream="
                            + preferSuggestedStream + ", session=" + session);
                }
            if (session == null || preferSuggestedStream) {
                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 @@ public class MediaSessionService extends SystemService implements Monitor {
                    }
                });
            } 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);
            }