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

Commit f19e811c authored by Kyunglyul Hyun's avatar Kyunglyul Hyun
Browse files

Don't check selectedRoutes of created sesions

There are cases that a newly create session does not contain
the requested route. (e.g. static group)
This CL removes check that disallowed those cases.

Bug: 159881597
Test: Run CTS, atest mediaroutertest and manually
using support v7 demos, which is edited to call
notifySessionCreated with member routes selected

Change-Id: I30741d2f3587d0fa9ee5a10fdb8fab9e0d82c721
parent 10f788d8
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -663,13 +663,6 @@ public final class MediaRouter2 {
        if (sessionInfo == null) {
            notifyTransferFailure(requestedRoute);
            return;
        } else if (!sessionInfo.getSelectedRoutes().contains(requestedRoute.getId())) {
            Log.w(TAG, "The session does not contain the requested route. "
                    + "(requestedRouteId=" + requestedRoute.getId()
                    + ", actualRoutes=" + sessionInfo.getSelectedRoutes()
                    + ")");
            notifyTransferFailure(requestedRoute);
            return;
        } else if (!TextUtils.equals(requestedRoute.getProviderId(),
                sessionInfo.getProviderId())) {
            Log.w(TAG, "The session's provider ID does not match the requested route's. "
+1 −14
Original line number Diff line number Diff line
@@ -1555,7 +1555,6 @@ class MediaRouter2ServiceImpl {
            long managerRequestId = (matchingRequest == null)
                    ? MediaRoute2ProviderService.REQUEST_ID_NONE
                    : matchingRequest.mManagerRequestId;
            // Managers should know created session even if it's not requested.
            notifySessionCreatedToManagers(managerRequestId, sessionInfo);

            if (matchingRequest == null) {
@@ -1575,18 +1574,6 @@ class MediaRouter2ServiceImpl {
                        + "session=" + matchingRequest.mOldSession);
            }

            String originalRouteId = matchingRequest.mRoute.getId();
            RouterRecord routerRecord = matchingRequest.mRouterRecord;

            if (!sessionInfo.getSelectedRoutes().contains(originalRouteId)) {
                Slog.w(TAG, "Created session doesn't match the original request."
                        + " originalRouteId=" + originalRouteId
                        + ", uniqueRequestId=" + uniqueRequestId + ", sessionInfo=" + sessionInfo);
                notifySessionCreationFailedToRouter(matchingRequest.mRouterRecord,
                        toOriginalRequestId(uniqueRequestId));
                return;
            }

            // Succeeded
            if (sessionInfo.isSystemSession()
                    && !matchingRequest.mRouterRecord.mHasModifyAudioRoutingPermission) {
@@ -1597,7 +1584,7 @@ class MediaRouter2ServiceImpl {
                notifySessionCreatedToRouter(matchingRequest.mRouterRecord,
                        toOriginalRequestId(uniqueRequestId), sessionInfo);
            }
            mSessionToRouterMap.put(sessionInfo.getId(), routerRecord);
            mSessionToRouterMap.put(sessionInfo.getId(), matchingRequest.mRouterRecord);
        }

        private void onSessionInfoChangedOnHandler(@NonNull MediaRoute2Provider provider,