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.ComponentName;
20 import android.content.Intent;
21 import android.graphics.Rect;
22 import android.media.PlaybackParams;
23 import android.media.tv.DvbDeviceInfo;
24 import android.media.tv.ITvInputClient;
25 import android.media.tv.ITvInputHardware;
26 import android.media.tv.ITvInputHardwareCallback;
27 import android.media.tv.ITvInputManagerCallback;
28 import android.media.tv.TvContentRatingSystemInfo;
29 import android.media.tv.TvInputHardwareInfo;
30 import android.media.tv.TvInputInfo;
31 import android.media.tv.TvStreamConfig;
32 import android.media.tv.TvTrackInfo;
33 import android.net.Uri;
34 import android.os.Bundle;
35 import android.os.ParcelFileDescriptor;
36 import android.view.Surface;
37 
38 /**
39  * Interface to the TV input manager service.
40  * @hide
41  */
42 interface ITvInputManager {
getTvInputList(int userId)43     List<TvInputInfo> getTvInputList(int userId);
getTvInputInfo(in String inputId, int userId)44     TvInputInfo getTvInputInfo(in String inputId, int userId);
updateTvInputInfo(in TvInputInfo inputInfo, int userId)45     void updateTvInputInfo(in TvInputInfo inputInfo, int userId);
getTvInputState(in String inputId, int userId)46     int getTvInputState(in String inputId, int userId);
47 
getTvContentRatingSystemList(int userId)48     List<TvContentRatingSystemInfo> getTvContentRatingSystemList(int userId);
49 
registerCallback(in ITvInputManagerCallback callback, int userId)50     void registerCallback(in ITvInputManagerCallback callback, int userId);
unregisterCallback(in ITvInputManagerCallback callback, int userId)51     void unregisterCallback(in ITvInputManagerCallback callback, int userId);
52 
isParentalControlsEnabled(int userId)53     boolean isParentalControlsEnabled(int userId);
setParentalControlsEnabled(boolean enabled, int userId)54     void setParentalControlsEnabled(boolean enabled, int userId);
isRatingBlocked(in String rating, int userId)55     boolean isRatingBlocked(in String rating, int userId);
getBlockedRatings(int userId)56     List<String> getBlockedRatings(int userId);
addBlockedRating(in String rating, int userId)57     void addBlockedRating(in String rating, int userId);
removeBlockedRating(in String rating, int userId)58     void removeBlockedRating(in String rating, int userId);
59 
createSession(in ITvInputClient client, in String inputId, boolean isRecordingSession, int seq, int userId)60     void createSession(in ITvInputClient client, in String inputId, boolean isRecordingSession,
61             int seq, int userId);
releaseSession(in IBinder sessionToken, int userId)62     void releaseSession(in IBinder sessionToken, int userId);
63 
setMainSession(in IBinder sessionToken, int userId)64     void setMainSession(in IBinder sessionToken, int userId);
setSurface(in IBinder sessionToken, in Surface surface, int userId)65     void setSurface(in IBinder sessionToken, in Surface surface, int userId);
dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height, int userId)66     void dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height,
67             int userId);
setVolume(in IBinder sessionToken, float volume, int userId)68     void setVolume(in IBinder sessionToken, float volume, int userId);
tune(in IBinder sessionToken, in Uri channelUri, in Bundle params, int userId)69     void tune(in IBinder sessionToken, in Uri channelUri, in Bundle params, int userId);
setCaptionEnabled(in IBinder sessionToken, boolean enabled, int userId)70     void setCaptionEnabled(in IBinder sessionToken, boolean enabled, int userId);
selectTrack(in IBinder sessionToken, int type, in String trackId, int userId)71     void selectTrack(in IBinder sessionToken, int type, in String trackId, int userId);
72 
sendAppPrivateCommand(in IBinder sessionToken, in String action, in Bundle data, int userId)73     void sendAppPrivateCommand(in IBinder sessionToken, in String action, in Bundle data,
74             int userId);
75 
createOverlayView(in IBinder sessionToken, in IBinder windowToken, in Rect frame, int userId)76     void createOverlayView(in IBinder sessionToken, in IBinder windowToken, in Rect frame,
77             int userId);
relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId)78     void relayoutOverlayView(in IBinder sessionToken, in Rect frame, int userId);
removeOverlayView(in IBinder sessionToken, int userId)79     void removeOverlayView(in IBinder sessionToken, int userId);
80 
unblockContent(in IBinder sessionToken, in String unblockedRating, int userId)81     void unblockContent(in IBinder sessionToken, in String unblockedRating, int userId);
82 
timeShiftPlay(in IBinder sessionToken, in Uri recordedProgramUri, int userId)83     void timeShiftPlay(in IBinder sessionToken, in Uri recordedProgramUri, int userId);
timeShiftPause(in IBinder sessionToken, int userId)84     void timeShiftPause(in IBinder sessionToken, int userId);
timeShiftResume(in IBinder sessionToken, int userId)85     void timeShiftResume(in IBinder sessionToken, int userId);
timeShiftSeekTo(in IBinder sessionToken, long timeMs, int userId)86     void timeShiftSeekTo(in IBinder sessionToken, long timeMs, int userId);
timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId)87     void timeShiftSetPlaybackParams(in IBinder sessionToken, in PlaybackParams params, int userId);
timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId)88     void timeShiftEnablePositionTracking(in IBinder sessionToken, boolean enable, int userId);
89 
90     // For the recording session
startRecording(in IBinder sessionToken, in Uri programUri, int userId)91     void startRecording(in IBinder sessionToken, in Uri programUri, int userId);
stopRecording(in IBinder sessionToken, int userId)92     void stopRecording(in IBinder sessionToken, int userId);
93 
94     // For TV input hardware binding
getHardwareList()95     List<TvInputHardwareInfo> getHardwareList();
acquireTvInputHardware(int deviceId, in ITvInputHardwareCallback callback, in TvInputInfo info, int userId)96     ITvInputHardware acquireTvInputHardware(int deviceId, in ITvInputHardwareCallback callback,
97             in TvInputInfo info, int userId);
releaseTvInputHardware(int deviceId, in ITvInputHardware hardware, int userId)98     void releaseTvInputHardware(int deviceId, in ITvInputHardware hardware, int userId);
99 
100     // For TV input capturing
getAvailableTvStreamConfigList(in String inputId, int userId)101     List<TvStreamConfig> getAvailableTvStreamConfigList(in String inputId, int userId);
captureFrame(in String inputId, in Surface surface, in TvStreamConfig config, int userId)102     boolean captureFrame(in String inputId, in Surface surface, in TvStreamConfig config,
103             int userId);
isSingleSessionActive(int userId)104     boolean isSingleSessionActive(int userId);
105 
106     // For DVB device binding
getDvbDeviceList()107     List<DvbDeviceInfo> getDvbDeviceList();
openDvbDevice(in DvbDeviceInfo info, int device)108     ParcelFileDescriptor openDvbDevice(in DvbDeviceInfo info, int device);
109 
110     // For preview channels and programs
sendTvInputNotifyIntent(in Intent intent, int userId)111     void sendTvInputNotifyIntent(in Intent intent, int userId);
requestChannelBrowsable(in Uri channelUri, int userId)112     void requestChannelBrowsable(in Uri channelUri, int userId);
113 }
114