1 /** 2 * Copyright (C) 2018 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 com.android.car.radio.service; 18 19 import android.hardware.radio.ProgramSelector; 20 import android.hardware.radio.RadioManager; 21 22 import com.android.car.broadcastradio.support.Program; 23 import com.android.car.radio.bands.ProgramType; 24 import com.android.car.radio.bands.RegionConfig; 25 import com.android.car.radio.service.IRadioAppCallback; 26 import com.android.car.radio.service.ITuneCallback; 27 28 /** 29 * An interface to the backend Radio app's service. 30 */ 31 interface IRadioAppService { 32 /** 33 * Adds {@link RadioAppService} callback. 34 * 35 * Triggers state updates on newly added callback. 36 */ addCallback(in IRadioAppCallback callback)37 void addCallback(in IRadioAppCallback callback); 38 39 /** 40 * Removes {@link RadioAppService} callback. 41 */ removeCallback(in IRadioAppCallback callback)42 void removeCallback(in IRadioAppCallback callback); 43 44 /** 45 * Tunes to a given program. 46 */ tune(in ProgramSelector sel, in ITuneCallback callback)47 void tune(in ProgramSelector sel, in ITuneCallback callback); 48 49 /** 50 * Seeks forward or backwards. 51 */ seek(boolean forward, in ITuneCallback callback)52 void seek(boolean forward, in ITuneCallback callback); 53 54 /** 55 * Steps forward or backwards. 56 */ step(boolean forward, in ITuneCallback callback)57 void step(boolean forward, in ITuneCallback callback); 58 59 /** 60 * Skips forward or backwards; the meaning of "skip" is defined by setSkipMode(). 61 */ skip(boolean forward, in ITuneCallback callback)62 void skip(boolean forward, in ITuneCallback callback); 63 64 /** 65 * Sets the behavior of skip() 66 * 67 * @param mode must be a valid SkipMode enum value. 68 */ setSkipMode(int mode)69 void setSkipMode(int mode); 70 71 /** 72 * Mutes or resumes audio. 73 * 74 * @param muted {@code true} to mute, {@code false} to resume audio. 75 */ setMuted(boolean muted)76 void setMuted(boolean muted); 77 78 /** 79 * Tune to a default channel of a given program type (band). 80 * 81 * Usually, this means tuning to the recently listened program of a given band. 82 * 83 * @param band Program type to switch to 84 */ switchBand(in ProgramType band)85 void switchBand(in ProgramType band); 86 87 /** 88 * States whether program list is supported on current device or not. 89 * 90 * @return {@code true} if the program list is supported, {@code false} otherwise. 91 */ isProgramListSupported()92 boolean isProgramListSupported(); 93 94 /** 95 * Returns current region config (like frequency ranges for AM/FM). 96 */ getRegionConfig()97 RegionConfig getRegionConfig(); 98 } 99