1 /** 2 * Copyright (c) 2016, 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 package com.android.car.radio.service; 17 18 import com.android.car.radio.service.IRadioCallback; 19 import com.android.car.radio.service.RadioStation; 20 21 /** 22 * Interface for apps to communicate with the radio. 23 */ 24 interface IRadioManager { 25 /** 26 * Tunes the radio to the given frequency. 27 */ tune(in RadioStation station)28 void tune(in RadioStation station); 29 30 /** 31 * Seeks the radio forward. 32 */ seekForward()33 void seekForward(); 34 35 /** 36 * Seeks the radio backwards. 37 */ seekBackward()38 void seekBackward(); 39 40 /** 41 * Mutes the radioN 42 * 43 * @return {@code true} if the mute was successful. 44 */ mute()45 boolean mute(); 46 47 /** 48 * Un-mutes the radio and causes audio to play. 49 * 50 * @return {@code true} if the un-mute was successful. 51 */ unMute()52 boolean unMute(); 53 54 /** 55 * Returns {@code true} if the radio is currently muted. 56 */ isMuted()57 boolean isMuted(); 58 59 /** 60 * Opens the radio for the given band. 61 * 62 * @param radioBand One of {@link RadioManager#BAND_FM}, {@link RadioManager#BAND_AM}, 63 * {@link RadioManager#BAND_FM_HD} or {@link RadioManager#BAND_AM_HD}. 64 * @return {@link RadioManager#STATUS_OK} if successful; otherwise, 65 * {@link RadioManager#STATUS_ERROR}. 66 */ openRadioBand(int radioBand)67 int openRadioBand(int radioBand); 68 69 /** 70 * Adds the given {@link IRadioCallback} to be notified of any radio metadata changes. 71 */ addRadioTunerCallback(in IRadioCallback callback)72 void addRadioTunerCallback(in IRadioCallback callback); 73 74 /** 75 * Removes the given {@link IRadioCallback} from receiving any radio metadata chagnes. 76 */ removeRadioTunerCallback(in IRadioCallback callback)77 void removeRadioTunerCallback(in IRadioCallback callback); 78 79 /** 80 * Returns a {@link RadioStation} that encapsulates the information about the current 81 * station the radio is tuned to. 82 */ getCurrentRadioStation()83 RadioStation getCurrentRadioStation(); 84 85 /** 86 * Returns {@code true} if the radio was able to successfully initialize. A value of 87 * {@code false} here could mean that the {@code RadioService} was not able to connect to 88 * the {@link RadioManager} or there were no radio modules on the current device. 89 */ isInitialized()90 boolean isInitialized(); 91 92 /** 93 * Returns {@code true} if the radio currently has focus and is therefore the application that 94 * is supplying music. 95 */ hasFocus()96 boolean hasFocus(); 97 98 /** 99 * Returns {@code true} if the current radio module has dual tuners, meaning that a tuner 100 * is available to scan for stations in the background. 101 */ hasDualTuners()102 boolean hasDualTuners(); 103 } 104