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

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

Merge "Throw for showSystemOutputSwitcher() call from privileged router" into main

parents ea4b9664 7ffeed97
Loading
Loading
Loading
Loading
+21 −8
Original line number Diff line number Diff line
@@ -439,14 +439,7 @@ public final class MediaRouter2 {
     * call is ignored because the app is in the background.
     */
    public boolean showSystemOutputSwitcher() {
        synchronized (mLock) {
            try {
                return mMediaRouterService.showMediaOutputSwitcher(mImpl.getPackageName());
            } catch (RemoteException ex) {
                ex.rethrowFromSystemServer();
            }
        }
        return false;
        return mImpl.showSystemOutputSwitcher();
    }

    /**
@@ -1950,6 +1943,8 @@ public final class MediaRouter2 {

        void setRouteListingPreference(@Nullable RouteListingPreference preference);

        boolean showSystemOutputSwitcher();

        List<MediaRoute2Info> getAllRoutes();

        void setOnGetControllerHintsListener(OnGetControllerHintsListener listener);
@@ -2096,6 +2091,12 @@ public final class MediaRouter2 {
                    "RouteListingPreference cannot be set by a privileged MediaRouter2 instance.");
        }

        @Override
        public boolean showSystemOutputSwitcher() {
            throw new UnsupportedOperationException(
                    "Cannot show system output switcher from a privileged router.");
        }

        /** Gets the list of all discovered routes. */
        @Override
        public List<MediaRoute2Info> getAllRoutes() {
@@ -2908,6 +2909,18 @@ public final class MediaRouter2 {
            }
        }

        @Override
        public boolean showSystemOutputSwitcher() {
            synchronized (mLock) {
                try {
                    return mMediaRouterService.showMediaOutputSwitcher(mImpl.getPackageName());
                } catch (RemoteException ex) {
                    ex.rethrowFromSystemServer();
                }
            }
            return false;
        }

        /**
         * Returns {@link Collections#emptyList()}. Local routes can only access routes related to
         * their {@link RouteDiscoveryPreference} through {@link #getRoutes()}.