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.media.tv.TvStreamConfig;
20 import android.view.KeyEvent;
21 import android.view.Surface;
22 
23 /**
24  * TvInputService representing a physical port should connect to HAL through this interface.
25  * Framework will take care of communication among system services including TvInputManagerService,
26  * HdmiControlService, AudioService, etc.
27  *
28  * @hide
29  */
30 interface ITvInputHardware {
31     /**
32      * Make the input render on the surface according to the config. In case of HDMI, this will
33      * trigger CEC commands for adjusting active HDMI source. Returns true on success.
34      */
setSurface(in Surface surface, in TvStreamConfig config)35     boolean setSurface(in Surface surface, in TvStreamConfig config);
36 
37     /**
38      * Set volume for this stream via AudioGain.
39      */
setStreamVolume(float volume)40     void setStreamVolume(float volume);
41 
42     /**
43      * Dispatch key event to HDMI service. The events would be automatically converted to
44      * HDMI CEC commands. If the hardware is not representing an HDMI port, this method will fail.
45      */
dispatchKeyEventToHdmi(in KeyEvent event)46     boolean dispatchKeyEventToHdmi(in KeyEvent event);
47 
48     /**
49      * Override default audio sink from audio policy. When override is on, it is
50      * TvInputService's responsibility to adjust to audio configuration change
51      * (for example, when the audio sink becomes unavailable or more desirable
52      * audio sink is detected).
53      *
54      * @param audioType one of AudioManager.DEVICE_* values. When it's * DEVICE_NONE, override
55      *        becomes off.
56      * @param audioAddress audio address of the overriding device.
57      * @param samplingRate desired sampling rate. Use default when it's 0.
58      * @param channelMask desired channel mask. Use default when it's
59      *        AudioFormat.CHANNEL_OUT_DEFAULT.
60      * @param format desired format. Use default when it's AudioFormat.ENCODING_DEFAULT.
61      */
overrideAudioSink(int audioType, String audioAddress, int samplingRate, int channelMask, int format)62     void overrideAudioSink(int audioType, String audioAddress, int samplingRate, int channelMask,
63             int format);
64 }
65