1 /* 2 * Copyright (C) 2013 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.media; 18 19 import android.content.Intent; 20 import android.media.IMediaRouter2; 21 import android.media.IMediaRouter2Manager; 22 import android.media.IMediaRouterClient; 23 import android.media.MediaRoute2Info; 24 import android.media.MediaRouterClientState; 25 import android.media.RouteDiscoveryPreference; 26 import android.media.RouteListingPreference; 27 import android.media.RoutingSessionInfo; 28 import android.os.Bundle; 29 import android.os.UserHandle; 30 /** 31 * {@hide} 32 */ 33 interface IMediaRouterService { 34 //TODO: Merge or remove methods when media router 2 is done. registerClientAsUser(IMediaRouterClient client, String packageName, int userId)35 void registerClientAsUser(IMediaRouterClient client, String packageName, int userId); unregisterClient(IMediaRouterClient client)36 void unregisterClient(IMediaRouterClient client); 37 registerClientGroupId(IMediaRouterClient client, String groupId)38 void registerClientGroupId(IMediaRouterClient client, String groupId); 39 getState(IMediaRouterClient client)40 MediaRouterClientState getState(IMediaRouterClient client); isPlaybackActive(IMediaRouterClient client)41 boolean isPlaybackActive(IMediaRouterClient client); 42 setBluetoothA2dpOn(IMediaRouterClient client, boolean on)43 void setBluetoothA2dpOn(IMediaRouterClient client, boolean on); setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan)44 void setDiscoveryRequest(IMediaRouterClient client, int routeTypes, boolean activeScan); setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit)45 void setSelectedRoute(IMediaRouterClient client, String routeId, boolean explicit); requestSetVolume(IMediaRouterClient client, String routeId, int volume)46 void requestSetVolume(IMediaRouterClient client, String routeId, int volume); requestUpdateVolume(IMediaRouterClient client, String routeId, int direction)47 void requestUpdateVolume(IMediaRouterClient client, String routeId, int direction); 48 49 // Note: When changing this file, match the order of methods below with 50 // MediaRouterService.java for readability. 51 52 // Methods for MediaRouter2 getSystemRoutes(String callerPackageName, boolean isProxyRouter)53 List<MediaRoute2Info> getSystemRoutes(String callerPackageName, boolean isProxyRouter); getSystemSessionInfo()54 RoutingSessionInfo getSystemSessionInfo(); showMediaOutputSwitcherWithRouter2(String packageName)55 boolean showMediaOutputSwitcherWithRouter2(String packageName); 56 registerRouter2(IMediaRouter2 router, String packageName)57 void registerRouter2(IMediaRouter2 router, String packageName); unregisterRouter2(IMediaRouter2 router)58 void unregisterRouter2(IMediaRouter2 router); updateScanningStateWithRouter2(IMediaRouter2 router, @JavaPassthrough(annotation="@android.media.MediaRouter2.ScanningState") int scanningState)59 void updateScanningStateWithRouter2(IMediaRouter2 router, @JavaPassthrough(annotation="@android.media.MediaRouter2.ScanningState") int scanningState); setDiscoveryRequestWithRouter2(IMediaRouter2 router, in RouteDiscoveryPreference preference)60 void setDiscoveryRequestWithRouter2(IMediaRouter2 router, 61 in RouteDiscoveryPreference preference); setRouteListingPreference(IMediaRouter2 router, in @nullable RouteListingPreference routeListingPreference)62 void setRouteListingPreference(IMediaRouter2 router, 63 in @nullable RouteListingPreference routeListingPreference); setRouteVolumeWithRouter2(IMediaRouter2 router, in MediaRoute2Info route, int volume)64 void setRouteVolumeWithRouter2(IMediaRouter2 router, in MediaRoute2Info route, int volume); 65 requestCreateSessionWithRouter2(IMediaRouter2 router, int requestId, long managerRequestId, in RoutingSessionInfo oldSession, in MediaRoute2Info route, in @nullable Bundle sessionHints)66 void requestCreateSessionWithRouter2(IMediaRouter2 router, int requestId, long managerRequestId, 67 in RoutingSessionInfo oldSession, in MediaRoute2Info route, 68 in @nullable Bundle sessionHints); selectRouteWithRouter2(IMediaRouter2 router, String sessionId, in MediaRoute2Info route)69 void selectRouteWithRouter2(IMediaRouter2 router, String sessionId, in MediaRoute2Info route); deselectRouteWithRouter2(IMediaRouter2 router, String sessionId, in MediaRoute2Info route)70 void deselectRouteWithRouter2(IMediaRouter2 router, String sessionId, in MediaRoute2Info route); transferToRouteWithRouter2(IMediaRouter2 router, String sessionId, in MediaRoute2Info route)71 void transferToRouteWithRouter2(IMediaRouter2 router, String sessionId, 72 in MediaRoute2Info route); setSessionVolumeWithRouter2(IMediaRouter2 router, String sessionId, int volume)73 void setSessionVolumeWithRouter2(IMediaRouter2 router, String sessionId, int volume); releaseSessionWithRouter2(IMediaRouter2 router, String sessionId)74 void releaseSessionWithRouter2(IMediaRouter2 router, String sessionId); 75 76 // Methods for MediaRouter2Manager getRemoteSessions(IMediaRouter2Manager manager)77 List<RoutingSessionInfo> getRemoteSessions(IMediaRouter2Manager manager); getSystemSessionInfoForPackage(String callerPackageName, String targetPackageName)78 RoutingSessionInfo getSystemSessionInfoForPackage(String callerPackageName, 79 String targetPackageName); registerManager(IMediaRouter2Manager manager, String packageName)80 void registerManager(IMediaRouter2Manager manager, String packageName); registerProxyRouter(IMediaRouter2Manager manager, String callingPackageName, String targetPackageName, in UserHandle targetUser)81 void registerProxyRouter(IMediaRouter2Manager manager, String callingPackageName, String targetPackageName, in UserHandle targetUser); unregisterManager(IMediaRouter2Manager manager)82 void unregisterManager(IMediaRouter2Manager manager); setRouteVolumeWithManager(IMediaRouter2Manager manager, int requestId, in MediaRoute2Info route, int volume)83 void setRouteVolumeWithManager(IMediaRouter2Manager manager, int requestId, 84 in MediaRoute2Info route, int volume); updateScanningState(IMediaRouter2Manager manager, @JavaPassthrough(annotation="@android.media.MediaRouter2.ScanningState") int scanningState)85 void updateScanningState(IMediaRouter2Manager manager, @JavaPassthrough(annotation="@android.media.MediaRouter2.ScanningState") int scanningState); 86 requestCreateSessionWithManager(IMediaRouter2Manager manager, int requestId, in RoutingSessionInfo oldSession, in @nullable MediaRoute2Info route, in UserHandle transferInitiatorUserHandle, in String transferInitiatorPackageName)87 void requestCreateSessionWithManager(IMediaRouter2Manager manager, int requestId, 88 in RoutingSessionInfo oldSession, in @nullable MediaRoute2Info route, 89 in UserHandle transferInitiatorUserHandle, in String transferInitiatorPackageName); selectRouteWithManager(IMediaRouter2Manager manager, int requestId, String sessionId, in MediaRoute2Info route)90 void selectRouteWithManager(IMediaRouter2Manager manager, int requestId, 91 String sessionId, in MediaRoute2Info route); deselectRouteWithManager(IMediaRouter2Manager manager, int requestId, String sessionId, in MediaRoute2Info route)92 void deselectRouteWithManager(IMediaRouter2Manager manager, int requestId, 93 String sessionId, in MediaRoute2Info route); 94 @JavaPassthrough(annotation="@android.annotation.RequiresPermission(android.Manifest.permission.MEDIA_CONTENT_CONTROL)") transferToRouteWithManager(IMediaRouter2Manager manager, int requestId, String sessionId, in MediaRoute2Info route, in UserHandle transferInitiatorUserHandle, String transferInitiatorPackageName)95 void transferToRouteWithManager(IMediaRouter2Manager manager, int requestId, 96 String sessionId, in MediaRoute2Info route, 97 in UserHandle transferInitiatorUserHandle, String transferInitiatorPackageName); setSessionVolumeWithManager(IMediaRouter2Manager manager, int requestId, String sessionId, int volume)98 void setSessionVolumeWithManager(IMediaRouter2Manager manager, int requestId, 99 String sessionId, int volume); releaseSessionWithManager(IMediaRouter2Manager manager, int requestId, String sessionId)100 void releaseSessionWithManager(IMediaRouter2Manager manager, int requestId, String sessionId); showMediaOutputSwitcherWithProxyRouter(IMediaRouter2Manager manager)101 boolean showMediaOutputSwitcherWithProxyRouter(IMediaRouter2Manager manager); 102 } 103