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

Commit 026f2362 authored by Bishoy Gendy's avatar Bishoy Gendy Committed by Android (Google) Code Review
Browse files

Merge "Fallback to default handling when session volume handling is fixed" into main

parents 221c32cd 5caa7d62
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -27,3 +27,10 @@ flag {
    description: "Disables the broadcast receiver that prevents scanning when the screen is off."
    bug: "304234628"
}

flag {
    namespace: "media_solutions"
    name: "fallback_to_default_handling_when_media_session_has_fixed_volume_handling"
    description: "Fallbacks to the default handling for volume adjustment when media session has fixed volume handling and its app is in the foreground and setting a media controller."
    bug: "293743975"
}
+10 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.server.media;
import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
import static android.os.UserHandle.ALL;
import static android.os.UserHandle.CURRENT;

import static com.android.server.media.MediaKeyDispatcher.KEY_EVENT_LONG_PRESS;
import static com.android.server.media.MediaKeyDispatcher.isDoubleTapOverridden;
import static com.android.server.media.MediaKeyDispatcher.isLongPressOverridden;
@@ -1904,6 +1905,15 @@ public class MediaSessionService extends SystemService implements Monitor {
                                keyEvent, AudioManager.USE_DEFAULT_STREAM_TYPE, false);
                        return;
                    }
                    if (Flags.fallbackToDefaultHandlingWhenMediaSessionHasFixedVolumeHandling()
                            && !record.canHandleVolumeKey()) {
                        Log.d(TAG, "Session with packageName=" + record.getPackageName()
                                + " doesn't support volume adjustment."
                                + " Fallbacks to the default handling.");
                        dispatchVolumeKeyEventLocked(packageName, opPackageName, pid, uid, true,
                                keyEvent, AudioManager.USE_DEFAULT_STREAM_TYPE, false);
                        return;
                    }
                    switch (keyEvent.getAction()) {
                        case KeyEvent.ACTION_DOWN: {
                            int direction = 0;