1 /*
2  * Copyright (C) 2014 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.tv;
18 
19 import android.content.AttributionSource;
20 import android.content.ComponentName;
21 import android.content.Intent;
22 import android.graphics.Rect;
23 import android.media.AudioPresentation;
24 import android.media.PlaybackParams;
25 import android.media.tv.AdBuffer;
26 import android.media.tv.AdRequest;
27 import android.media.tv.BroadcastInfoRequest;
28 import android.media.tv.DvbDeviceInfo;
29 import android.media.tv.ITvInputClient;
30 import android.media.tv.ITvInputHardware;
31 import android.media.tv.ITvInputHardwareCallback;
32 import android.media.tv.ITvInputManagerCallback;
33 import android.media.tv.TunedInfo;
34 import android.media.tv.TvContentRatingSystemInfo;
35 import android.media.tv.TvInputHardwareInfo;
36 import android.media.tv.TvInputInfo;
37 import android.media.tv.TvStreamConfig;
38 import android.media.tv.TvTrackInfo;
39 import android.net.Uri;
40 import android.os.Bundle;
41 import android.os.ParcelFileDescriptor;
42 import android.view.Surface;
43 
44 /**
45  * Interface to the TV input manager service.
46  * @hide
47  */
48 interface ITvInputManager {
getTvInputList(int userId)49     List<TvInputInfo> getTvInputList(int userId);
getTvInputInfo(in String inputId, int userId)50     TvInputInfo getTvInputInfo(in String inputId, int userId);
updateTvInputInfo(in TvInputInfo inputInfo, int userId)51     void updateTvInputInfo(in TvInputInfo inputInfo, int userId);
getTvInputState(in String inputId, int userId)52     int getTvInputState(in String inputId, int userId);
getAvailableExtensionInterfaceNames(in String inputId, int userId)53     List<String> getAvailableExtensionInterfaceNames(in String inputId, int userId);
getExtensionInterface(in String inputId, in String name, int userId)54     IBinder getExtensionInterface(in String inputId, in String name, int userId);
55 
getTvContentRatingSystemList(int userId)56     List<TvContentRatingSystemInfo> getTvContentRatingSystemList(int userId);
57 
registerCallback(in ITvInputManagerCallback callback, int userId)58     void registerCallback(in ITvInputManagerCallback callback, int userId);
unregisterCallback(in ITvInputManagerCallback callback, int userId)59     void unregisterCallback(in ITvInputManagerCallback callback, int userId);
60 
isParentalControlsEnabled(int userId)61     boolean isParentalControlsEnabled(int userId);
setParentalControlsEnabled(boolean enabled, int userId)62     void setParentalControlsEnabled(boolean enabled, int userId);
isRatingBlocked(in String rating, int userId)63     boolean isRatingBlocked(in String rating, int userId);
getBlockedRatings(int userId)64     List<String> getBlockedRatings(int userId);
addBlockedRating(in String rating, int userId)65     void addBlockedRating(in String rating, int userId);
removeBlockedRating(in String rating, int userId)66     void removeBlockedRating(in String rating, int userId);
67 
createSession(in ITvInputClient client, in String inputId, in AttributionSource tvAppAttributionSource, boolean isRecordingSession, int seq, int userId)68     void createSession(in ITvInputClient client, in String inputId, in AttributionSource tvAppAttributionSource, boolean isRecordingSession,
69             int seq, int userId);
releaseSession(in IBinder sessionToken, int userId)70     void releaseSession(in IBinder sessionToken, int userId);
getClientPid(in String sessionId)71     int getClientPid(in String sessionId);
getClientPriority(int useCase, in String sessionId)72     int getClientPriority(int useCase, in String sessionId);
73 
setMainSession(in IBinder sessionToken, int userId)74     void setMainSession(in IBinder sessionToken, int userId);
setSurface(in IBinder sessionToken, in Surface surface, int userId)75     void setSurface(in IBinder sessionToken, in Surface surface, int userId);
dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height, int userId)76     void dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height,
77             int userId);
setVolume(in IBinder sessionToken, float volume, int userId)78     void setVolume(in IBinder sessionToken, float volume, int userId);
tune(in IBinder sessionToken, in Uri channelUri, in Bundle params, int userId)79     void tune(in IBinder sessionToken, in Uri channelUri, in Bundle params, int userId);
setCaptionEnabled(in IBinder sessionToken, boolean enabled, int userId)80     void setCaptionEnabled(in IBinder sessionToken, boolean enabled, int userId);
selectTrack(in IBinder sessionToken, int type, in String trackId, int userId)81     void selectTrack(in IBinder sessionToken, int type, in String trackId, int userId);
selectAudioPresentation(in IBinder sessionToken, int presentationId, int programId, int userId)82     void selectAudioPresentation(in IBinder sessionToken, int presentationId, int programId,
83             int userId);
84 
setInteractiveAppNotificationEnabled(in IBinder sessionToken, boolean enabled, int userId)85     void setInteractiveAppNotificationEnabled(in IBinder sessionToken, boolean enabled, int userId);
86 
sendAppPrivateCommand(in IBinder sessionToken, in String action, in Bundle data, int userId)87     void sendAppPrivateCommand(in IBinder sessionToken, in String action, in Bundle data,
88             int userId);
89 
createOverlayView(in IBinder sessionToken, in IBinder windowToken, in Rect frame, int userId)90     void createOverlayView(in IBinder sessionToken, in IBinder windowToken, in Rect frame,
91             int userId);
relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId)92     void relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId);
removeOverlayView(in IBinder sessionToken, int userId)93     void removeOverlayView(in IBinder sessionToken, int userId);
94 
unblockContent(in IBinder sessionToken, in String unblockedRating, int userId)95     void unblockContent(in IBinder sessionToken, in String unblockedRating, int userId);
96 
timeShiftPlay(in IBinder sessionToken, in Uri recordedProgramUri, int userId)97     void timeShiftPlay(in IBinder sessionToken, in Uri recordedProgramUri, int userId);
timeShiftPause(in IBinder sessionToken, int userId)98     void timeShiftPause(in IBinder sessionToken, int userId);
timeShiftResume(in IBinder sessionToken, int userId)99     void timeShiftResume(in IBinder sessionToken, int userId);
timeShiftSeekTo(in IBinder sessionToken, long timeMs, int userId)100     void timeShiftSeekTo(in IBinder sessionToken, long timeMs, int userId);
timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId)101     void timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId);
timeShiftSetMode(in IBinder sessionToken, int mode, int userId)102     void timeShiftSetMode(in IBinder sessionToken, int mode, int userId);
timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId)103     void timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId);
104 
getCurrentTunedInfos(int userId)105     List<TunedInfo> getCurrentTunedInfos(int userId);
106 
107     // For the recording session
startRecording(in IBinder sessionToken, in Uri programUri, in Bundle params, int userId)108     void startRecording(in IBinder sessionToken, in Uri programUri, in Bundle params, int userId);
stopRecording(in IBinder sessionToken, int userId)109     void stopRecording(in IBinder sessionToken, int userId);
pauseRecording(in IBinder sessionToken, in Bundle params, int userId)110     void pauseRecording(in IBinder sessionToken, in Bundle params, int userId);
resumeRecording(in IBinder sessionToken, in Bundle params, int userId)111     void resumeRecording(in IBinder sessionToken, in Bundle params, int userId);
112 
113     // For broadcast info
requestBroadcastInfo(in IBinder sessionToken, in BroadcastInfoRequest request, int userId)114     void requestBroadcastInfo(in IBinder sessionToken, in BroadcastInfoRequest request, int userId);
removeBroadcastInfo(in IBinder sessionToken, int id, int userId)115     void removeBroadcastInfo(in IBinder sessionToken, int id, int userId);
116 
117     // For ad request
requestAd(in IBinder sessionToken, in AdRequest request, int userId)118     void requestAd(in IBinder sessionToken, in AdRequest request, int userId);
notifyAdBufferReady(in IBinder sessionToken, in AdBuffer buffer, int userId)119     void notifyAdBufferReady(in IBinder sessionToken, in AdBuffer buffer, int userId);
120 
121     // For TV Message
notifyTvMessage(in IBinder sessionToken, int type, in Bundle data, int userId)122     void notifyTvMessage(in IBinder sessionToken, int type, in Bundle data, int userId);
setTvMessageEnabled(in IBinder sessionToken, int type, boolean enabled, int userId)123     void setTvMessageEnabled(in IBinder sessionToken, int type, boolean enabled, int userId);
124 
125     // For TV input hardware binding
getHardwareList()126     List<TvInputHardwareInfo> getHardwareList();
acquireTvInputHardware(int deviceId, in ITvInputHardwareCallback callback, in TvInputInfo info, int userId, String tvInputSessionId, int priorityHint)127     ITvInputHardware acquireTvInputHardware(int deviceId, in ITvInputHardwareCallback callback,
128             in TvInputInfo info, int userId, String tvInputSessionId, int priorityHint);
releaseTvInputHardware(int deviceId, in ITvInputHardware hardware, int userId)129     void releaseTvInputHardware(int deviceId, in ITvInputHardware hardware, int userId);
130 
131     // For TV input capturing
getAvailableTvStreamConfigList(in String inputId, int userId)132     List<TvStreamConfig> getAvailableTvStreamConfigList(in String inputId, int userId);
captureFrame(in String inputId, in Surface surface, in TvStreamConfig config, int userId)133     boolean captureFrame(in String inputId, in Surface surface, in TvStreamConfig config,
134             int userId);
isSingleSessionActive(int userId)135     boolean isSingleSessionActive(int userId);
136 
137     // For DVB device binding
getDvbDeviceList()138     List<DvbDeviceInfo> getDvbDeviceList();
openDvbDevice(in DvbDeviceInfo info, int device)139     ParcelFileDescriptor openDvbDevice(in DvbDeviceInfo info, int device);
140 
141     // For preview channels and programs
sendTvInputNotifyIntent(in Intent intent, int userId)142     void sendTvInputNotifyIntent(in Intent intent, int userId);
requestChannelBrowsable(in Uri channelUri, int userId)143     void requestChannelBrowsable(in Uri channelUri, int userId);
144 
145     // For CTS purpose only. Add/remove a TvInputHardware device
addHardwareDevice(in int deviceId)146     void addHardwareDevice(in int deviceId);
removeHardwareDevice(in int deviceId)147     void removeHardwareDevice(in int deviceId);
148 }
149