12035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent/*
22035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * Copyright (C) 2015 The Android Open Source Project
32035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent *
42035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * Licensed under the Apache License, Version 2.0 (the "License");
52035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * you may not use this file except in compliance with the License.
62035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * You may obtain a copy of the License at
72035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent *
82035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent *      http://www.apache.org/licenses/LICENSE-2.0
92035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent *
102035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * Unless required by applicable law or agreed to in writing, software
112035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * distributed under the License is distributed on an "AS IS" BASIS,
122035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * See the License for the specific language governing permissions and
142035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * limitations under the License.
152035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent */
162035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
172035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurentpackage android.hardware.radio;
182035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
19d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczykimport android.annotation.NonNull;
20d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczykimport android.annotation.Nullable;
212035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurentimport android.annotation.SystemApi;
224482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczykimport android.graphics.Bitmap;
232035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurentimport android.os.Handler;
24c9a1ac78192e773d32462a3de899c7522c55ededTomasz Wasilczyk
25d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczykimport java.util.List;
260f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczykimport java.util.Map;
272035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
282035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent/**
292035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * RadioTuner interface provides methods to control a radio tuner on the device: selecting and
302035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * configuring the active band, muting/unmuting, scanning and tuning, etc...
312035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent *
322035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * Obtain a RadioTuner interface by calling {@link RadioManager#openTuner(int,
332035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * RadioManager.BandConfig, boolean, RadioTuner.Callback, Handler)}.
342035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent * @hide
352035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent */
362035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent@SystemApi
372035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurentpublic abstract class RadioTuner {
382035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
392035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /** Scanning direction UP for {@link #step(int, boolean)}, {@link #scan(int, boolean)} */
402035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static final int DIRECTION_UP      = 0;
412035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
422035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /** Scanning directions DOWN for {@link #step(int, boolean)}, {@link #scan(int, boolean)} */
432035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static final int DIRECTION_DOWN    = 1;
442035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
452035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
462035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Close the tuner interface. The {@link Callback} callback will not be called
472035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * anymore and associated resources will be released.
482035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Must be called when the tuner is not needed to make hardware resources available to others.
492035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * */
502035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract void close();
512035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
522035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
532035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Set the active band configuration for this module.
542035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Must be a valid configuration obtained via buildConfig() from a valid BandDescriptor listed
552035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * in the ModuleProperties of the module with the specified ID.
562035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param config The desired band configuration (FmBandConfig or AmBandConfig).
572035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
582035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
592035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
602035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
612035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
622035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li>
632035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
642035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
652035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
662035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
672035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
682035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int setConfiguration(RadioManager.BandConfig config);
692035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
702035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
712035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Get current configuration.
722035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param config a BandConfig array of lengh 1 where the configuration is returned.
732035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
742035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
752035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
762035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
772035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
782035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li>
792035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
802035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
812035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
822035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
832035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
842035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int getConfiguration(RadioManager.BandConfig[] config);
852035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
862035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
872035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
882035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Set mute state. When muted, the radio tuner audio source is not available for playback on
892035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * any audio device. when unmuted, the radio tuner audio source is output as a media source
902035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * and renderd over the audio device selected for media use case.
912035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * The radio tuner audio source is muted by default when the tuner is first attached.
922035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Only effective if the tuner is attached with audio enabled.
932035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *
942035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param mute the requested mute state.
952035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
962035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
972035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
982035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
992035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
1002035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
1012035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
1022035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
1032035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
1042035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
1052035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int setMute(boolean mute);
1062035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
1072035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
1082035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Get mute state.
1092035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *
1102035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return {@code true} if the radio tuner audio source is muted or a problem occured
1112035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * retrieving the mute state, {@code false} otherwise.
1122035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
1132035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract boolean getMute();
1142035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
1152035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
1162035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Step up or down by one channel spacing.
1172035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * The operation is asynchronous and {@link Callback}
1182035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * onProgramInfoChanged() will be called when step completes or
1192035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * onError() when cancelled or timeout.
1202035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param direction {@link #DIRECTION_UP} or {@link #DIRECTION_DOWN}.
1212035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param skipSubChannel indicates to skip sub channels when the configuration currently
1222035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * selected supports sub channel (e.g HD Radio). N/A otherwise.
1232035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
1242035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
1252035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
1262035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
1272035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
1282035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li>
1292035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
1302035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
1312035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
1322035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
1332035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
1342035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int step(int direction, boolean skipSubChannel);
1352035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
1362035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
1372035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Scan up or down to next valid station.
1382035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * The operation is asynchronous and {@link Callback}
1392035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * onProgramInfoChanged() will be called when scan completes or
1402035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * onError() when cancelled or timeout.
1412035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param direction {@link #DIRECTION_UP} or {@link #DIRECTION_DOWN}.
1422035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param skipSubChannel indicates to skip sub channels when the configuration currently
1432035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * selected supports sub channel (e.g HD Radio). N/A otherwise.
1442035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
1452035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
1462035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
1472035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
1482035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
1492035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li>
1502035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
1512035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
1522035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
1532035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
1542035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
1552035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int scan(int direction, boolean skipSubChannel);
1562035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
1572035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
1582035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Tune to a specific frequency.
1592035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * The operation is asynchronous and {@link Callback}
1602035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * onProgramInfoChanged() will be called when tune completes or
1612035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * onError() when cancelled or timeout.
1622035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param channel the specific channel or frequency to tune to.
1632035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param subChannel the specific sub-channel to tune to. N/A if the selected configuration
1642035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * does not support cub channels.
1652035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
1662035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
1672035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
1682035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
1692035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
1702035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li>
1712035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
1722035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
1732035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
1742035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
1758cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk     * @deprecated Use {@link tune(ProgramSelector)} instead.
1762035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
1778cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk    @Deprecated
1782035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int tune(int channel, int subChannel);
1792035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
1802035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
1818cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk     * Tune to a program.
1828cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk     *
1838cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk     * The operation is asynchronous and {@link Callback} onProgramInfoChanged() will be called
1848cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk     * when tune completes or onError() when cancelled or on timeout.
1858cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk     *
18667f9d5070a74a0bf34f0335899a96dedcac26c96Jeff Sharkey     * @throws IllegalArgumentException if the provided selector is invalid
1878cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk     */
1888cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk    public abstract void tune(@NonNull ProgramSelector selector);
1898cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk
1908cfb0e81fdd91b7fe1c02287394ac068287281d5Tomasz Wasilczyk    /**
1912035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Cancel a pending scan or tune operation.
1922035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * If an operation is pending, {@link Callback} onError() will be called with
1932035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * {@link #ERROR_CANCELLED}.
1942035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
1952035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
1962035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
1972035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
1982035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
1992035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li>
2002035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
2012035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
2022035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
2032035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
2042035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
2052035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int cancel();
2062035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
2072035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
208c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     * Cancels traffic or emergency announcement.
209c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     *
210c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     * If there was no announcement to cancel, no action is taken.
211c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     *
212c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     * There is a race condition between calling cancelAnnouncement and the actual announcement
213c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     * being finished, so onTrafficAnnouncement / onEmergencyAnnouncement callback should be
214c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     * tracked with proper locking.
215c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk     */
216c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk    public abstract void cancelAnnouncement();
217c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk
218c4cd823a2e4ce62d3a1c6ee6c71bb406c564608cTomasz Wasilczyk    /**
2192035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Get current station information.
2202035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @param info a ProgramInfo array of lengh 1 where the information is returned.
2212035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return
2222035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * <ul>
2232035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_OK} in case of success, </li>
2242035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li>
2252035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li>
2262035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li>
2272035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li>
2282035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native
2292035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     *  service fails, </li>
2302035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * </ul>
2312035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
2322035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract int getProgramInformation(RadioManager.ProgramInfo[] info);
2332035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
2342035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
2354482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * Retrieves a {@link Bitmap} for the given image ID or null,
2364482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * if the image was missing from the tuner.
2374482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     *
2384482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * This involves doing a call to the tuner, so the bitmap should be cached
2394482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * on the application side.
2404482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     *
2414482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * If the method returns null for non-zero ID, it means the image was
2424482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * updated on the tuner side. There is a race conditon between fetching
2434482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * image for an old ID and tuner updating the image (and cleaning up the
2444482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * old image). In such case, a new ProgramInfo with updated image id will
2454482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * be sent with a {@link onProgramInfoChanged} callback.
2464482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     *
2474482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * @param id The image identifier, retrieved with
2484482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     *           {@link RadioMetadata#getBitmapId(String)}.
2494482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * @return A {@link Bitmap} or null.
2504482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * @throws IllegalArgumentException if id==0
2514482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     * @hide This API is not thoroughly elaborated yet
2524482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk     */
2534482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk    public abstract @Nullable Bitmap getMetadataImage(int id);
2544482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk
2554482b1413656b9c0c5937b4d7a73235f872a6678Tomasz Wasilczyk    /**
256e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * Initiates a background scan to update internally cached program list.
257e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     *
258e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * It may not be necessary to initiate the scan explicitly - the scan MAY be performed on boot.
259e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     *
260e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * The operation is asynchronous and {@link Callback} backgroundScanComplete or onError will
261e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * be called if the return value of this call was {@code true}. As result of this call
262e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * programListChanged may be triggered (if the scanned list differs).
263e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     *
264e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * @return {@code true} if the scan was properly scheduled, {@code false} if the scan feature
265e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * is unavailable; ie. temporarily due to ongoing foreground playback in single-tuner device
266e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * or permanently if the feature is not supported
267e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * (see ModuleProperties#isBackgroundScanningSupported()).
268e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     */
269e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk    public abstract boolean startBackgroundScan();
270e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk
271e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk    /**
272d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczyk     * Get the list of discovered radio stations.
273d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczyk     *
2740f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczyk     * To get the full list, set filter to null or empty map.
2750f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczyk     * Keys must be prefixed with unique vendor Java-style namespace,
2760f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczyk     * eg. 'com.somecompany.parameter1'.
277d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczyk     *
2780f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczyk     * @param vendorFilter vendor-specific selector for radio stations.
279d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczyk     * @return a list of radio stations.
280e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     * @throws IllegalStateException if the scan is in progress or has not been started,
281e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk     *         startBackgroundScan() call may fix it.
2820f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczyk     * @throws IllegalArgumentException if the vendorFilter argument is not valid.
283d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczyk     */
2840f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczyk    public abstract @NonNull List<RadioManager.ProgramInfo>
2850f1776d08b43f5f71a9f89b6a4f1838df4d3d744Tomasz Wasilczyk            getProgramList(@Nullable Map<String, String> vendorFilter);
286d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczyk
287d44b2ea109d3039f2aeba237f86d0db51c3ba648Tomasz Wasilczyk    /**
2885f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * Checks, if the analog playback is forced, see setAnalogForced.
2895f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     *
2905f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * @throws IllegalStateException if the switch is not supported at current
2915f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     *         configuration.
2925f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * @return {@code true} if analog is forced, {@code false} otherwise.
2935f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     */
2945f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk    public abstract boolean isAnalogForced();
2955f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk
2965f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk    /**
2975f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * Forces the analog playback for the supporting radio technology.
2985f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     *
2995f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * User may disable digital playback for FM HD Radio or hybrid FM/DAB with
3005f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * this option. This is purely user choice, ie. does not reflect digital-
3015f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * analog handover managed from the HAL implementation side.
3025f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     *
3035f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * Some radio technologies may not support this, ie. DAB.
3045f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     *
3055f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * @param isForced {@code true} to force analog, {@code false} for a default behaviour.
3065f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     * @throws IllegalStateException if the switch is not supported at current
3075f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     *         configuration.
3085f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk     */
3095f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk    public abstract void setAnalogForced(boolean isForced);
3105f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk
3115f0fbaef380b6d462429c57f85a0e624c62aefbfTomasz Wasilczyk    /**
3122035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Get current antenna connection state for current configuration.
3132035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Only valid if a configuration has been applied.
3142035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return {@code true} if the antenna is connected, {@code false} otherwise.
3152035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
3162035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract boolean isAntennaConnected();
3172035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
3182035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
3192035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Indicates if this client actually controls the tuner.
3202035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Control is always granted after
3212035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * {@link RadioManager#openTuner(int,
3222035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * RadioManager.BandConfig, boolean, Callback, Handler)}
3232035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * returns a non null tuner interface.
3242035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Control is lost when another client opens an interface on the same tuner.
3252035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * When this happens, {@link Callback#onControlChanged(boolean)} is received.
3262035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * The client can either wait for control to be returned (which is indicated by the same
3272035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * callback) or close and reopen the tuner interface.
3282035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * @return {@code true} if this interface controls the tuner,
3292035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * {@code false} otherwise or if a problem occured retrieving the state.
3302035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
3312035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public abstract boolean hasControl();
3322035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
3332035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /** Indicates a failure of radio IC or driver.
3342035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * The application must close and re open the tuner */
3352035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static final int ERROR_HARDWARE_FAILURE = 0;
3362035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /** Indicates a failure of the radio service.
3372035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * The application must close and re open the tuner */
3382035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static final  int ERROR_SERVER_DIED = 1;
3392035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /** A pending seek or tune operation was cancelled */
3402035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static final  int ERROR_CANCELLED = 2;
3412035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /** A pending seek or tune operation timed out */
3422035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static final  int ERROR_SCAN_TIMEOUT = 3;
3432035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /** The requested configuration could not be applied */
3442035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static final  int ERROR_CONFIG = 4;
34505392d6360b89538aa8fcbb1afd50775adfadcf4Tomasz Wasilczyk    /** Background scan was interrupted due to hardware becoming temporarily unavailable. */
346c9a1ac78192e773d32462a3de899c7522c55ededTomasz Wasilczyk    public static final int ERROR_BACKGROUND_SCAN_UNAVAILABLE = 5;
34705392d6360b89538aa8fcbb1afd50775adfadcf4Tomasz Wasilczyk    /** Background scan failed due to other error, ie. HW failure. */
348c9a1ac78192e773d32462a3de899c7522c55ededTomasz Wasilczyk    public static final int ERROR_BACKGROUND_SCAN_FAILED = 6;
3492035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
3502035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    /**
3512035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * Callback provided by the client application when opening a {@link RadioTuner}
3522035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     * to receive asynchronous operation results, updates and error notifications.
3532035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent     */
3542035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    public static abstract class Callback {
3552035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        /**
3562035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * onError() is called when an error occured while performing an asynchronous
3572035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * operation of when the hardware or system service experiences a problem.
3582035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * status is one of {@link #ERROR_HARDWARE_FAILURE}, {@link #ERROR_SERVER_DIED},
3592035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * {@link #ERROR_CANCELLED}, {@link #ERROR_SCAN_TIMEOUT},
3602035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * {@link #ERROR_CONFIG}
3612035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         */
3622035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        public void onError(int status) {}
3632035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        /**
3642035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * onConfigurationChanged() is called upon successful completion of
3652035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * {@link RadioManager#openTuner(int, RadioManager.BandConfig, boolean, Callback, Handler)}
3662035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * or {@link RadioTuner#setConfiguration(RadioManager.BandConfig)}
3672035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         */
3682035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        public void onConfigurationChanged(RadioManager.BandConfig config) {}
36924250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk
3702035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        /**
37124250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         * Called when program info (including metadata) for the current program has changed.
37224250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         *
37324250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         * It happens either upon successful completion of {@link RadioTuner#step(int, boolean)},
37424250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         * {@link RadioTuner#scan(int, boolean)}, {@link RadioTuner#tune(int, int)}; when
37524250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         * a switching to alternate frequency occurs; or when metadata is updated.
3762035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         */
3772035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        public void onProgramInfoChanged(RadioManager.ProgramInfo info) {}
37824250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk
3792035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        /**
38024250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         * Called when metadata is updated for the current program.
38124250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         *
38224250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         * @deprecated Use {@link #onProgramInfoChanged(RadioManager.ProgramInfo)} instead.
3832035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         */
38424250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk        @Deprecated
3852035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        public void onMetadataChanged(RadioMetadata metadata) {}
38624250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk
3872035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        /**
3882035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * onTrafficAnnouncement() is called when a traffic announcement starts and stops.
3892035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         */
3902035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        public void onTrafficAnnouncement(boolean active) {}
3912035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        /**
3927058e4ca585a06462a495d021d61e1fd27f85cd2Sanket Agarwal         * onEmergencyAnnouncement() is called when an emergency annoucement starts and stops.
3937058e4ca585a06462a495d021d61e1fd27f85cd2Sanket Agarwal         */
3947058e4ca585a06462a495d021d61e1fd27f85cd2Sanket Agarwal        public void onEmergencyAnnouncement(boolean active) {}
3957058e4ca585a06462a495d021d61e1fd27f85cd2Sanket Agarwal        /**
3962035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * onAntennaState() is called when the antenna is connected or disconnected.
3972035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         */
3982035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        public void onAntennaState(boolean connected) {}
3992035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        /**
4002035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * onControlChanged() is called when the client loses or gains control of the radio tuner.
4012035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * The control is always granted after a successful call to
4022035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * {@link RadioManager#openTuner(int, RadioManager.BandConfig, boolean, Callback, Handler)}.
4032035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * If another client opens the same tuner, onControlChanged() will be called with
4042035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * control set to {@code false} to indicate loss of control.
4052035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * At this point, RadioTuner APIs other than getters will return
4062035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * {@link RadioManager#STATUS_INVALID_OPERATION}.
4072035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * When the other client releases the tuner, onControlChanged() will be called
4082035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         * with control set to {@code true}.
4092035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent         */
4102035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent        public void onControlChanged(boolean control) {}
411e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk
412e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk        /**
413e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         * onBackgroundScanAvailabilityChange() is called when background scan
414e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         * feature becomes available or not.
415e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         *
416e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         * @param isAvailable true, if the tuner turned temporarily background-
417e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         *                    capable, false in the other case.
418e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         */
419e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk        public void onBackgroundScanAvailabilityChange(boolean isAvailable) {}
420e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk
421e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk        /**
422e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         * Called when a background scan completes successfully.
423e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         */
424e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk        public void onBackgroundScanComplete() {}
425e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk
426e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk        /**
427e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         * Called when available program list changed.
428e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         *
42924250ef9481da08f26cdeb2ef7075783662f05eeTomasz Wasilczyk         * Use {@link RadioTuner#getProgramList(String)} to get an actual list.
430e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk         */
431e597ce15b3c110036fcaff4fee8cfc94fd97b3ceTomasz Wasilczyk        public void onProgramListChanged() {}
4322035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent    }
4332035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
4342035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent}
4352035ac85f61b0e7fa384d52fcfa99766424c122cEric Laurent
436