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

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

Avoid binding to providers if no apps are scanning

Regardless of manager scans (example: scans coming from sys ui or
settings). Concretely, this change will prevent apps that don't
integrate with MediaRouter2 from having remote volume control in
Settings (this is described in detail in linked bugs).

Bug: b/319604673
Test: Manually by casting using popular app that doesn't integrate MR2.
Test: atest CtsMediaHostTestCases CtsMediaBetterTogetherTestCases
Change-Id: I61f8a2de2fa617517527e775eccf38506a1b9a18
parent 60b866ea
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -120,3 +120,13 @@ flag {
    description: "Enables apps owning a MediaBrowserService to disconnect all connected browsers."
    bug: "185136506"
}

flag {
    name: "enable_prevention_of_manager_scans_when_no_apps_scan"
    namespace: "media_solutions"
    description: "Prevents waking up route providers when no apps are scanning, even if SysUI or Settings are scanning."
    bug: "319604673"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -232,7 +232,9 @@ final class MediaRoute2ProviderServiceProxy extends MediaRoute2Provider
        if (!mRunning) {
            return false;
        }
        if (!getSessionInfos().isEmpty() || mIsManagerScanning) {
        boolean bindDueToManagerScan =
                mIsManagerScanning && Flags.enablePreventionOfManagerScansWhenNoAppsScan();
        if (!getSessionInfos().isEmpty() || bindDueToManagerScan) {
            // We bind if any manager is scanning (regardless of whether an app is scanning) to give
            // the opportunity for providers to publish routing sessions that were established
            // directly between the app and the provider (typically via AndroidX MediaRouter). See