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

Commit 1f066685 authored by Hyundo Moon's avatar Hyundo Moon
Browse files

Allow MediaRouter2Manager releasing the session created w/o request

When a RoutingSessionInfo is created without MediaRouter2(Manager)'s
request (i.e. created with REQUEST_ID_NONE by provider),
the MediaRouter2Manager cannot release the session.
This CL makes the manager be able to release those sessions.

Bug: 153832566
Test: Using platform-dev Support7Demos,
      1) Select any sample route (Variable volume~)
      2) Using SampleOutputSwitcher, select phone
      3) The sample route's screen disappears
      => Without this CL, the screen doesn't go away.
Change-Id: Ibf61ba52012c2785d2807288dcb338266156efd9
parent fa3d0eff
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -925,9 +925,6 @@ class MediaRouter2ServiceImpl {

        RouterRecord routerRecord = managerRecord.mUserRecord.mHandler
                .findRouterforSessionLocked(uniqueSessionId);
        if (routerRecord == null) {
            return;
        }

        long uniqueRequestId = toUniqueRequestId(managerRecord.mManagerId, requestId);
        managerRecord.mUserRecord.mHandler.sendMessage(
@@ -1405,11 +1402,11 @@ class MediaRouter2ServiceImpl {
        }

        private void releaseSessionOnHandler(long uniqueRequestId,
                @NonNull RouterRecord routerRecord, @NonNull String uniqueSessionId) {
                @Nullable RouterRecord routerRecord, @NonNull String uniqueSessionId) {
            final RouterRecord matchingRecord = mSessionToRouterMap.get(uniqueSessionId);
            if (matchingRecord != routerRecord) {
                Slog.w(TAG, "Ignoring releasing session from non-matching router."
                        + " packageName=" + routerRecord.mPackageName
                Slog.w(TAG, "Ignoring releasing session from non-matching router. packageName="
                        + (routerRecord == null ? null : routerRecord.mPackageName)
                        + " uniqueSessionId=" + uniqueSessionId);
                return;
            }