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); getClientUserId(in String sessionId)73 int getClientUserId(in String sessionId); 74 setMainSession(in IBinder sessionToken, int userId)75 void setMainSession(in IBinder sessionToken, int userId); setSurface(in IBinder sessionToken, in Surface surface, int userId)76 void setSurface(in IBinder sessionToken, in Surface surface, int userId); dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height, int userId)77 void dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height, 78 int userId); setVolume(in IBinder sessionToken, float volume, int userId)79 void setVolume(in IBinder sessionToken, float volume, int userId); tune(in IBinder sessionToken, in Uri channelUri, in Bundle params, int userId)80 void tune(in IBinder sessionToken, in Uri channelUri, in Bundle params, int userId); setCaptionEnabled(in IBinder sessionToken, boolean enabled, int userId)81 void setCaptionEnabled(in IBinder sessionToken, boolean enabled, int userId); selectTrack(in IBinder sessionToken, int type, in String trackId, int userId)82 void selectTrack(in IBinder sessionToken, int type, in String trackId, int userId); selectAudioPresentation(in IBinder sessionToken, int presentationId, int programId, int userId)83 void selectAudioPresentation(in IBinder sessionToken, int presentationId, int programId, 84 int userId); 85 setInteractiveAppNotificationEnabled(in IBinder sessionToken, boolean enabled, int userId)86 void setInteractiveAppNotificationEnabled(in IBinder sessionToken, boolean enabled, int userId); 87 sendAppPrivateCommand(in IBinder sessionToken, in String action, in Bundle data, int userId)88 void sendAppPrivateCommand(in IBinder sessionToken, in String action, in Bundle data, 89 int userId); 90 createOverlayView(in IBinder sessionToken, in IBinder windowToken, in Rect frame, int userId)91 void createOverlayView(in IBinder sessionToken, in IBinder windowToken, in Rect frame, 92 int userId); relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId)93 void relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId); removeOverlayView(in IBinder sessionToken, int userId)94 void removeOverlayView(in IBinder sessionToken, int userId); 95 unblockContent(in IBinder sessionToken, in String unblockedRating, int userId)96 void unblockContent(in IBinder sessionToken, in String unblockedRating, int userId); 97 timeShiftPlay(in IBinder sessionToken, in Uri recordedProgramUri, int userId)98 void timeShiftPlay(in IBinder sessionToken, in Uri recordedProgramUri, int userId); timeShiftPause(in IBinder sessionToken, int userId)99 void timeShiftPause(in IBinder sessionToken, int userId); timeShiftResume(in IBinder sessionToken, int userId)100 void timeShiftResume(in IBinder sessionToken, int userId); timeShiftSeekTo(in IBinder sessionToken, long timeMs, int userId)101 void timeShiftSeekTo(in IBinder sessionToken, long timeMs, int userId); timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId)102 void timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId); timeShiftSetMode(in IBinder sessionToken, int mode, int userId)103 void timeShiftSetMode(in IBinder sessionToken, int mode, int userId); timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId)104 void timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId); 105 getCurrentTunedInfos(int userId)106 List<TunedInfo> getCurrentTunedInfos(int userId); 107 108 // For the recording session startRecording(in IBinder sessionToken, in Uri programUri, in Bundle params, int userId)109 void startRecording(in IBinder sessionToken, in Uri programUri, in Bundle params, int userId); stopRecording(in IBinder sessionToken, int userId)110 void stopRecording(in IBinder sessionToken, int userId); pauseRecording(in IBinder sessionToken, in Bundle params, int userId)111 void pauseRecording(in IBinder sessionToken, in Bundle params, int userId); resumeRecording(in IBinder sessionToken, in Bundle params, int userId)112 void resumeRecording(in IBinder sessionToken, in Bundle params, int userId); 113 114 // For playback control resumePlayback(in IBinder sessionToken, int userId)115 void resumePlayback(in IBinder sessionToken, int userId); stopPlayback(in IBinder sessionToken, int mode, int userId)116 void stopPlayback(in IBinder sessionToken, int mode, int userId); 117 118 // For broadcast info requestBroadcastInfo(in IBinder sessionToken, in BroadcastInfoRequest request, int userId)119 void requestBroadcastInfo(in IBinder sessionToken, in BroadcastInfoRequest request, int userId); removeBroadcastInfo(in IBinder sessionToken, int id, int userId)120 void removeBroadcastInfo(in IBinder sessionToken, int id, int userId); 121 122 // For ad request requestAd(in IBinder sessionToken, in AdRequest request, int userId)123 void requestAd(in IBinder sessionToken, in AdRequest request, int userId); notifyAdBufferReady(in IBinder sessionToken, in AdBuffer buffer, int userId)124 void notifyAdBufferReady(in IBinder sessionToken, in AdBuffer buffer, int userId); 125 126 // For TV Message notifyTvMessage(in IBinder sessionToken, int type, in Bundle data, int userId)127 void notifyTvMessage(in IBinder sessionToken, int type, in Bundle data, int userId); setTvMessageEnabled(in IBinder sessionToken, int type, boolean enabled, int userId)128 void setTvMessageEnabled(in IBinder sessionToken, int type, boolean enabled, int userId); 129 130 // For TV input hardware binding getHardwareList()131 List<TvInputHardwareInfo> getHardwareList(); acquireTvInputHardware(int deviceId, in ITvInputHardwareCallback callback, in TvInputInfo info, int userId, String tvInputSessionId, int priorityHint)132 ITvInputHardware acquireTvInputHardware(int deviceId, in ITvInputHardwareCallback callback, 133 in TvInputInfo info, int userId, String tvInputSessionId, int priorityHint); releaseTvInputHardware(int deviceId, in ITvInputHardware hardware, int userId)134 void releaseTvInputHardware(int deviceId, in ITvInputHardware hardware, int userId); 135 136 // For TV input capturing getAvailableTvStreamConfigList(in String inputId, int userId)137 List<TvStreamConfig> getAvailableTvStreamConfigList(in String inputId, int userId); captureFrame(in String inputId, in Surface surface, in TvStreamConfig config, int userId)138 boolean captureFrame(in String inputId, in Surface surface, in TvStreamConfig config, 139 int userId); isSingleSessionActive(int userId)140 boolean isSingleSessionActive(int userId); 141 142 // For DVB device binding getDvbDeviceList()143 List<DvbDeviceInfo> getDvbDeviceList(); openDvbDevice(in DvbDeviceInfo info, int device)144 ParcelFileDescriptor openDvbDevice(in DvbDeviceInfo info, int device); 145 146 // For preview channels and programs sendTvInputNotifyIntent(in Intent intent, int userId)147 void sendTvInputNotifyIntent(in Intent intent, int userId); requestChannelBrowsable(in Uri channelUri, int userId)148 void requestChannelBrowsable(in Uri channelUri, int userId); 149 150 // For CTS purpose only. Add/remove a TvInputHardware device addHardwareDevice(in int deviceId)151 void addHardwareDevice(in int deviceId); removeHardwareDevice(in int deviceId)152 void removeHardwareDevice(in int deviceId); 153 154 // For freezing video playback setVideoFrozen(in IBinder sessionToken, boolean isFrozen, int userId)155 void setVideoFrozen(in IBinder sessionToken, boolean isFrozen, int userId); 156 notifyTvAdSessionData(in IBinder sessionToken, in String type, in Bundle data, int userId)157 void notifyTvAdSessionData(in IBinder sessionToken, in String type, in Bundle data, int userId); 158 } 159