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

Commit ee995362 authored by Santiago Seifert's avatar Santiago Seifert
Browse files

Make the default system session non-releasable

The default session is what we show to unprivileged apps as the current
"system output". For example, the built-in speaker, BT, HDMI, etc. By
definition, it's what we show to apps with no privilege, and hence the
release type is always going to be "non-releasable".

Also use RELEASE_UNSUPPORTED if the personal audio sharing flag is
disabled.

Test: Manually using the AndroidX sample routing app.
Bug: 385672684
Flag: com.android.media.flags.enable_output_switcher_personal_audio_sharing
Change-Id: I454082dd44a78d38f2836e97861a13174b5a3fbe
parent 795d133e
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -408,6 +408,10 @@ class SystemMediaRoute2Provider extends MediaRoute2Provider {

            if (Flags.enableOutputSwitcherPersonalAudioSharing()) {
                builder.setReleaseType(mDeviceRouteController.getSessionReleaseType());
            } else {
                // Releasing the system routing session only makes sense in the context of
                // Flags.enableOutputSwitcherPersonalAudioSharing.
                builder.setReleaseType(RoutingSessionInfo.RELEASE_UNSUPPORTED);
            }

            return builder.setProviderId(mUniqueId).build();
@@ -580,7 +584,7 @@ class SystemMediaRoute2Provider extends MediaRoute2Provider {
                                .setTransferInitiator(
                                        newSessionInfo.getTransferInitiatorUserHandle(),
                                        newSessionInfo.getTransferInitiatorPackageName())
                                .setReleaseType(newSessionInfo.getReleaseType())
                                .setReleaseType(RoutingSessionInfo.RELEASE_UNSUPPORTED)
                                .build();
                return true;
            }