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

Commit 8dffd57f authored by Iván Budnik's avatar Iván Budnik Committed by Android (Google) Code Review
Browse files

Merge "Do not filter routes on privileged RoutingControllers" into main

parents 52b3af4e 2bfe8e32
Loading
Loading
Loading
Loading
+13 −20
Original line number Diff line number Diff line
@@ -1084,6 +1084,16 @@ public final class MediaRouter2 {
        return filteredRoutes;
    }

    @NonNull
    private List<MediaRoute2Info> getRoutesWithIds(@NonNull List<String> routeIds) {
        synchronized (mLock) {
            return routeIds.stream()
                    .map(mRoutes::get)
                    .filter(Objects::nonNull)
                    .collect(Collectors.toList());
        }
    }

    private void notifyRoutesAdded(List<MediaRoute2Info> routes) {
        for (RouteCallbackRecord record : mRouteCallbackRecords) {
            List<MediaRoute2Info> filteredRoutes =
@@ -1388,7 +1398,7 @@ public final class MediaRouter2 {
            synchronized (mControllerLock) {
                selectedRouteIds = mSessionInfo.getSelectedRoutes();
            }
            return mImpl.getRoutesWithIds(selectedRouteIds);
            return getRoutesWithIds(selectedRouteIds);
        }

        /**
@@ -1400,7 +1410,7 @@ public final class MediaRouter2 {
            synchronized (mControllerLock) {
                selectableRouteIds = mSessionInfo.getSelectableRoutes();
            }
            return mImpl.getRoutesWithIds(selectableRouteIds);
            return getRoutesWithIds(selectableRouteIds);
        }

        /**
@@ -1412,7 +1422,7 @@ public final class MediaRouter2 {
            synchronized (mControllerLock) {
                deselectableRouteIds = mSessionInfo.getDeselectableRoutes();
            }
            return mImpl.getRoutesWithIds(deselectableRouteIds);
            return getRoutesWithIds(deselectableRouteIds);
        }

        /**
@@ -1981,7 +1991,6 @@ public final class MediaRouter2 {
                boolean shouldNotifyStop,
                RoutingController controller);

        List<MediaRoute2Info> getRoutesWithIds(List<String> routeIds);
    }

    /**
@@ -2412,13 +2421,6 @@ public final class MediaRouter2 {
            releaseSession(controller.getRoutingSessionInfo());
        }

        @Override
        public List<MediaRoute2Info> getRoutesWithIds(List<String> routeIds) {
            return getRoutes().stream()
                    .filter(r -> routeIds.contains(r.getId()))
                    .collect(Collectors.toList());
        }

        /**
         * Sets the routing session's {@linkplain RoutingSessionInfo#getClientPackageName() client
         * package name} to {@link #mClientPackageName} if empty and returns the session.
@@ -3065,14 +3067,5 @@ public final class MediaRouter2 {
            }
        }

        @Override
        public List<MediaRoute2Info> getRoutesWithIds(List<String> routeIds) {
            synchronized (mLock) {
                return routeIds.stream()
                        .map(mRoutes::get)
                        .filter(Objects::nonNull)
                        .collect(Collectors.toList());
            }
        }
    }
}