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

Commit 9c168a56 authored by Hyundo Moon's avatar Hyundo Moon Committed by Android (Google) Code Review
Browse files

Merge "Send features first and then routes when registering MR2Manager" into sc-dev

parents cfde5c2b 9659c230
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -903,9 +903,9 @@ class MediaRouter2ServiceImpl {
        userRecord.mManagerRecords.add(managerRecord);
        mAllManagerRecords.put(binder, managerRecord);

        userRecord.mHandler.sendMessage(obtainMessage(UserHandler::notifyRoutesToManager,
                userRecord.mHandler, manager));

        // Note: Features should be sent first before the routes. If not, the
        // RouteCallback#onRoutesAdded() for system MR2 will never be called with initial routes
        // due to the lack of features.
        for (RouterRecord routerRecord : userRecord.mRouterRecords) {
            // TODO: UserRecord <-> routerRecord, why do they reference each other?
            // How about removing mUserRecord from routerRecord?
@@ -913,6 +913,9 @@ class MediaRouter2ServiceImpl {
                    obtainMessage(UserHandler::notifyPreferredFeaturesChangedToManager,
                        routerRecord.mUserRecord.mHandler, routerRecord, manager));
        }

        userRecord.mHandler.sendMessage(obtainMessage(UserHandler::notifyRoutesToManager,
                userRecord.mHandler, manager));
    }

    private void unregisterManagerLocked(@NonNull IMediaRouter2Manager manager, boolean died) {