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

Commit 36f99d0a authored by Iván Budnik's avatar Iván Budnik
Browse files

Rename and make MediaRouter2 method private

checkRouteListContainsRouteId() is only used from RoutingController, so
it does not need to be package-private, nor @hide.

This is a non-functional change.

Bug: 192657812
Test: atest MediaRouter2Test SystemMediaRouter2Test
Change-Id: I734b3996be2b37e39f14df9aa6f2c31e61d168ce
parent af228ddc
Loading
Loading
Loading
Loading
+14 −19
Original line number Diff line number Diff line
@@ -313,21 +313,6 @@ public final class MediaRouter2 {
        mSystemController = new SystemRoutingController(mImpl.getSystemSessionInfo());
    }

    /**
     * Returns whether any route in {@code routeList} has a same unique ID with given route.
     *
     * @hide
     */
    static boolean checkRouteListContainsRouteId(
            @NonNull List<MediaRoute2Info> routeList, @NonNull String routeId) {
        for (MediaRoute2Info info : routeList) {
            if (TextUtils.equals(routeId, info.getId())) {
                return true;
            }
        }
        return false;
    }

    /**
     * Gets the client package name of the app which this media router controls.
     *
@@ -1499,13 +1484,13 @@ public final class MediaRouter2 {
            }

            List<MediaRoute2Info> selectedRoutes = getSelectedRoutes();
            if (checkRouteListContainsRouteId(selectedRoutes, route.getId())) {
            if (containsRouteInfoWithId(selectedRoutes, route.getId())) {
                Log.w(TAG, "Ignoring selecting a route that is already selected. route=" + route);
                return;
            }

            List<MediaRoute2Info> selectableRoutes = getSelectableRoutes();
            if (!checkRouteListContainsRouteId(selectableRoutes, route.getId())) {
            if (!containsRouteInfoWithId(selectableRoutes, route.getId())) {
                Log.w(TAG, "Ignoring selecting a non-selectable route=" + route);
                return;
            }
@@ -1538,13 +1523,13 @@ public final class MediaRouter2 {
            }

            List<MediaRoute2Info> selectedRoutes = getSelectedRoutes();
            if (!checkRouteListContainsRouteId(selectedRoutes, route.getId())) {
            if (!containsRouteInfoWithId(selectedRoutes, route.getId())) {
                Log.w(TAG, "Ignoring deselecting a route that is not selected. route=" + route);
                return;
            }

            List<MediaRoute2Info> deselectableRoutes = getDeselectableRoutes();
            if (!checkRouteListContainsRouteId(deselectableRoutes, route.getId())) {
            if (!containsRouteInfoWithId(deselectableRoutes, route.getId())) {
                Log.w(TAG, "Ignoring deselecting a non-deselectable route=" + route);
                return;
            }
@@ -1707,6 +1692,16 @@ public final class MediaRouter2 {
            }
        }

        /** Returns whether any route in {@code routeList} has a same unique ID with given route. */
        private static boolean containsRouteInfoWithId(
                @NonNull List<MediaRoute2Info> routeList, @NonNull String routeId) {
            for (MediaRoute2Info info : routeList) {
                if (TextUtils.equals(routeId, info.getId())) {
                    return true;
                }
            }
            return false;
        }
    }

    class SystemRoutingController extends RoutingController {