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

Commit 6dd198b5 authored by Santiago Seifert's avatar Santiago Seifert
Browse files

Remove unnecessary notifyRoutesUpdatedToManagers

It's mostly a duplicate of RouterRecord#notifyRoutesUpdated.

Bug: 360129098
Test: atest CtsMediaBetterTogetherTestCases MediaRouter2HostSideTest
Flag: EXEMPT refactor
Change-Id: I6923845677176f3f3bd86905778834d565d25f55
parent 7423573c
Loading
Loading
Loading
Loading
+7 −17
Original line number Diff line number Diff line
@@ -2776,18 +2776,20 @@ class MediaRouter2ServiceImpl {
                    getRouterRecords(/* hasSystemRoutingPermission= */ true);
            List<RouterRecord> routerRecordsWithoutSystemRoutingPermission =
                    getRouterRecords(/* hasSystemRoutingPermission= */ false);
            List<IMediaRouter2Manager> managers = getManagers();
            List<ManagerRecord> managers = getManagerRecords();

            // Managers receive all provider updates with all routes.
            notifyRoutesUpdatedToManagers(
                    managers, new ArrayList<>(mLastNotifiedRoutesToPrivilegedRouters.values()));
            List<MediaRoute2Info> routesForPrivilegedRouters =
                    mLastNotifiedRoutesToPrivilegedRouters.values().stream().toList();
            for (ManagerRecord manager : managers) {
                manager.notifyRoutesUpdated(routesForPrivilegedRouters);
            }

            // Routers with system routing access (either via {@link MODIFY_AUDIO_ROUTING} or
            // {@link BLUETOOTH_CONNECT} + {@link BLUETOOTH_SCAN}) receive all provider updates
            // with all routes.
            notifyRoutesUpdatedToRouterRecords(
                    routerRecordsWithSystemRoutingPermission,
                    new ArrayList<>(mLastNotifiedRoutesToPrivilegedRouters.values()));
                    routerRecordsWithSystemRoutingPermission, routesForPrivilegedRouters);

            if (!isSystemProvider) {
                // Regular routers receive updates from all non-system providers with all non-system
@@ -3284,18 +3286,6 @@ class MediaRouter2ServiceImpl {
            }
        }

        private void notifyRoutesUpdatedToManagers(
                @NonNull List<IMediaRouter2Manager> managers,
                @NonNull List<MediaRoute2Info> routes) {
            for (IMediaRouter2Manager manager : managers) {
                try {
                    manager.notifyRoutesUpdated(routes);
                } catch (RemoteException ex) {
                    Slog.w(TAG, "Failed to notify routes changed. Manager probably died.", ex);
                }
            }
        }

        private void notifySessionCreatedToManagers(long managerRequestId,
                @NonNull RoutingSessionInfo session) {
            int requesterId = toRequesterId(managerRequestId);