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

Commit 6a1e0b72 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MediaRouter: clear session info when disconnected"

parents 0f6accf9 47d289e2
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -247,11 +247,21 @@ public class MediaRouter2Manager {
        Objects.requireNonNull(packageName, "packageName must not be null");
        Objects.requireNonNull(route, "route must not be null");

        boolean transferred = false;
        //TODO: instead of release all controllers, add an API to specify controllers that
        // should be released (or is the system controller).
        for (RoutingController controller : getRoutingControllers(packageName)) {
            if (controller.getSessionInfo().getTransferrableRoutes().contains(route.getId())) {
            if (!transferred && controller.getSessionInfo().getTransferrableRoutes()
                    .contains(route.getId())) {
                controller.transferToRoute(route);
                return;
                transferred = true;
            } else if (!controller.getSessionInfo().isSystemSession()) {
                controller.release();
            }
        }

        if (transferred) {
            return;
        }

        Client client;
+6 −0
Original line number Diff line number Diff line
@@ -411,6 +411,12 @@ final class MediaRoute2ProviderProxy extends MediaRoute2Provider implements Serv
            mActiveConnection.dispose();
            mActiveConnection = null;
            setAndNotifyProviderState(null);
            synchronized (mLock) {
                for (RoutingSessionInfo sessionInfo : mSessionInfos) {
                    mCallback.onSessionReleased(this, sessionInfo);
                }
                mSessionInfos.clear();
            }
        }
    }