1 /**
2  * Copyright (C) 2017 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.hardware.radio;
18 
19 import android.graphics.Bitmap;
20 import android.hardware.radio.ProgramList;
21 import android.hardware.radio.ProgramSelector;
22 import android.hardware.radio.RadioManager;
23 
24 /** {@hide} */
25 interface ITuner {
close()26     void close();
27 
isClosed()28     boolean isClosed();
29 
30     /**
31      * @throws IllegalArgumentException if config is not valid or null
32      */
setConfiguration(in RadioManager.BandConfig config)33     void setConfiguration(in RadioManager.BandConfig config);
34 
getConfiguration()35     RadioManager.BandConfig getConfiguration();
36 
37     /**
38      * @throws IllegalStateException if tuner was opened without audio
39      */
setMuted(boolean mute)40     void setMuted(boolean mute);
41 
isMuted()42     boolean isMuted();
43 
44     /**
45      * @throws IllegalStateException if called out of sequence
46      */
step(boolean directionDown, boolean skipSubChannel)47     void step(boolean directionDown, boolean skipSubChannel);
48 
49     /**
50      * @throws IllegalStateException if called out of sequence
51      */
scan(boolean directionDown, boolean skipSubChannel)52     void scan(boolean directionDown, boolean skipSubChannel);
53 
54     /**
55      * @throws IllegalArgumentException if invalid arguments are passed
56      * @throws IllegalStateException if called out of sequence
57      */
tune(in ProgramSelector selector)58     void tune(in ProgramSelector selector);
59 
60     /**
61      * @throws IllegalStateException if called out of sequence
62      */
cancel()63     void cancel();
64 
cancelAnnouncement()65     void cancelAnnouncement();
66 
getImage(int id)67     Bitmap getImage(int id);
68 
69     /**
70      * @return {@code true} if the scan was properly scheduled,
71      *          {@code false} if the scan feature is unavailable
72      */
startBackgroundScan()73     boolean startBackgroundScan();
74 
startProgramListUpdates(in ProgramList.Filter filter)75     void startProgramListUpdates(in ProgramList.Filter filter);
stopProgramListUpdates()76     void stopProgramListUpdates();
77 
isConfigFlagSupported(int flag)78     boolean isConfigFlagSupported(int flag);
isConfigFlagSet(int flag)79     boolean isConfigFlagSet(int flag);
setConfigFlag(int flag, boolean value)80     void setConfigFlag(int flag, boolean value);
81 
82     /**
83      * @param parameters Vendor-specific key-value pairs, must be Map<String, String>
84      * @return Vendor-specific key-value pairs, must be Map<String, String>
85      */
setParameters(in Map parameters)86     Map setParameters(in Map parameters);
87 
88     /**
89      * @param keys Parameter keys to fetch
90      * @return Vendor-specific key-value pairs, must be Map<String, String>
91      */
getParameters(in List<String> keys)92     Map getParameters(in List<String> keys);
93 }
94