1 /* 2 * Copyright (C) 2015 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.annotation.NonNull; 20 import android.annotation.Nullable; 21 import android.annotation.SystemApi; 22 import android.graphics.Bitmap; 23 import android.os.Handler; 24 25 import java.util.List; 26 import java.util.Map; 27 28 /** 29 * RadioTuner interface provides methods to control a radio tuner on the device: selecting and 30 * configuring the active band, muting/unmuting, scanning and tuning, etc... 31 * 32 * Obtain a RadioTuner interface by calling {@link RadioManager#openTuner(int, 33 * RadioManager.BandConfig, boolean, RadioTuner.Callback, Handler)}. 34 * @hide 35 */ 36 @SystemApi 37 public abstract class RadioTuner { 38 39 /** Scanning direction UP for {@link #step(int, boolean)}, {@link #scan(int, boolean)} */ 40 public static final int DIRECTION_UP = 0; 41 42 /** Scanning directions DOWN for {@link #step(int, boolean)}, {@link #scan(int, boolean)} */ 43 public static final int DIRECTION_DOWN = 1; 44 45 /** 46 * Close the tuner interface. The {@link Callback} callback will not be called 47 * anymore and associated resources will be released. 48 * Must be called when the tuner is not needed to make hardware resources available to others. 49 * */ close()50 public abstract void close(); 51 52 /** 53 * Set the active band configuration for this module. 54 * Must be a valid configuration obtained via buildConfig() from a valid BandDescriptor listed 55 * in the ModuleProperties of the module with the specified ID. 56 * @param config The desired band configuration (FmBandConfig or AmBandConfig). 57 * @return 58 * <ul> 59 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 60 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 61 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 62 * <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li> 63 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 64 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 65 * service fails, </li> 66 * </ul> 67 * @deprecated Only applicable for HAL 1.x. 68 */ 69 @Deprecated setConfiguration(RadioManager.BandConfig config)70 public abstract int setConfiguration(RadioManager.BandConfig config); 71 72 /** 73 * Get current configuration. 74 * @param config a BandConfig array of lengh 1 where the configuration is returned. 75 * @return 76 * <ul> 77 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 78 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 79 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 80 * <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li> 81 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 82 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 83 * service fails, </li> 84 * </ul> 85 * 86 * @deprecated Only applicable for HAL 1.x. 87 */ 88 @Deprecated getConfiguration(RadioManager.BandConfig[] config)89 public abstract int getConfiguration(RadioManager.BandConfig[] config); 90 91 92 /** 93 * Set mute state. When muted, the radio tuner audio source is not available for playback on 94 * any audio device. when unmuted, the radio tuner audio source is output as a media source 95 * and renderd over the audio device selected for media use case. 96 * The radio tuner audio source is muted by default when the tuner is first attached. 97 * Only effective if the tuner is attached with audio enabled. 98 * 99 * @param mute the requested mute state. 100 * @return 101 * <ul> 102 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 103 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 104 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 105 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 106 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 107 * service fails, </li> 108 * </ul> 109 */ setMute(boolean mute)110 public abstract int setMute(boolean mute); 111 112 /** 113 * Get mute state. 114 * 115 * @return {@code true} if the radio tuner audio source is muted or a problem occured 116 * retrieving the mute state, {@code false} otherwise. 117 */ getMute()118 public abstract boolean getMute(); 119 120 /** 121 * Step up or down by one channel spacing. 122 * The operation is asynchronous and {@link Callback} 123 * onProgramInfoChanged() will be called when step completes or 124 * onError() when cancelled or timeout. 125 * @param direction {@link #DIRECTION_UP} or {@link #DIRECTION_DOWN}. 126 * @param skipSubChannel indicates to skip sub channels when the configuration currently 127 * selected supports sub channel (e.g HD Radio). N/A otherwise. 128 * @return 129 * <ul> 130 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 131 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 132 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 133 * <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li> 134 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 135 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 136 * service fails, </li> 137 * </ul> 138 */ step(int direction, boolean skipSubChannel)139 public abstract int step(int direction, boolean skipSubChannel); 140 141 /** 142 * Scan up or down to next valid station. 143 * The operation is asynchronous and {@link Callback} 144 * onProgramInfoChanged() will be called when scan completes or 145 * onError() when cancelled or timeout. 146 * @param direction {@link #DIRECTION_UP} or {@link #DIRECTION_DOWN}. 147 * @param skipSubChannel indicates to skip sub channels when the configuration currently 148 * selected supports sub channel (e.g HD Radio). N/A otherwise. 149 * @return 150 * <ul> 151 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 152 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 153 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 154 * <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li> 155 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 156 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 157 * service fails, </li> 158 * </ul> 159 */ scan(int direction, boolean skipSubChannel)160 public abstract int scan(int direction, boolean skipSubChannel); 161 162 /** 163 * Tune to a specific frequency. 164 * The operation is asynchronous and {@link Callback} 165 * onProgramInfoChanged() will be called when tune completes or 166 * onError() when cancelled or timeout. 167 * @param channel the specific channel or frequency to tune to. 168 * @param subChannel the specific sub-channel to tune to. N/A if the selected configuration 169 * does not support cub channels. 170 * @return 171 * <ul> 172 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 173 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 174 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 175 * <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li> 176 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 177 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 178 * service fails, </li> 179 * </ul> 180 * @deprecated Use {@link tune(ProgramSelector)} instead. 181 */ 182 @Deprecated tune(int channel, int subChannel)183 public abstract int tune(int channel, int subChannel); 184 185 /** 186 * Tune to a program. 187 * 188 * The operation is asynchronous and {@link Callback} onProgramInfoChanged() will be called 189 * when tune completes or onError() when cancelled or on timeout. 190 * 191 * @throws IllegalArgumentException if the provided selector is invalid 192 */ tune(@onNull ProgramSelector selector)193 public abstract void tune(@NonNull ProgramSelector selector); 194 195 /** 196 * Cancel a pending scan or tune operation. 197 * If an operation is pending, {@link Callback} onError() will be called with 198 * {@link #ERROR_CANCELLED}. 199 * @return 200 * <ul> 201 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 202 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 203 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 204 * <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li> 205 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 206 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 207 * service fails, </li> 208 * </ul> 209 */ cancel()210 public abstract int cancel(); 211 212 /** 213 * Cancels traffic or emergency announcement. 214 * 215 * If there was no announcement to cancel, no action is taken. 216 * 217 * There is a race condition between calling cancelAnnouncement and the actual announcement 218 * being finished, so onTrafficAnnouncement / onEmergencyAnnouncement callback should be 219 * tracked with proper locking. 220 */ cancelAnnouncement()221 public abstract void cancelAnnouncement(); 222 223 /** 224 * Get current station information. 225 * @param info a ProgramInfo array of lengh 1 where the information is returned. 226 * @return 227 * <ul> 228 * <li>{@link RadioManager#STATUS_OK} in case of success, </li> 229 * <li>{@link RadioManager#STATUS_ERROR} in case of unspecified error, </li> 230 * <li>{@link RadioManager#STATUS_NO_INIT} if the native service cannot be reached, </li> 231 * <li>{@link RadioManager#STATUS_BAD_VALUE} if parameters are invalid, </li> 232 * <li>{@link RadioManager#STATUS_INVALID_OPERATION} if the call is out of sequence, </li> 233 * <li>{@link RadioManager#STATUS_DEAD_OBJECT} if the binder transaction to the native 234 * service fails, </li> 235 * </ul> 236 * @deprecated Use {@link onProgramInfoChanged} callback instead. 237 */ 238 @Deprecated getProgramInformation(RadioManager.ProgramInfo[] info)239 public abstract int getProgramInformation(RadioManager.ProgramInfo[] info); 240 241 /** 242 * Retrieves a {@link Bitmap} for the given image ID or null, 243 * if the image was missing from the tuner. 244 * 245 * This involves doing a call to the tuner, so the bitmap should be cached 246 * on the application side. 247 * 248 * If the method returns null for non-zero ID, it means the image was 249 * updated on the tuner side. There is a race conditon between fetching 250 * image for an old ID and tuner updating the image (and cleaning up the 251 * old image). In such case, a new ProgramInfo with updated image id will 252 * be sent with a {@link onProgramInfoChanged} callback. 253 * 254 * @param id The image identifier, retrieved with 255 * {@link RadioMetadata#getBitmapId(String)}. 256 * @return A {@link Bitmap} or null. 257 * @throws IllegalArgumentException if id==0 258 * @hide This API is not thoroughly elaborated yet 259 */ 260 @SuppressWarnings("HiddenAbstractMethod") getMetadataImage(int id)261 public abstract @Nullable Bitmap getMetadataImage(int id); 262 263 /** 264 * Initiates a background scan to update internally cached program list. 265 * 266 * It may not be necessary to initiate the scan explicitly - the scan MAY be performed on boot. 267 * 268 * The operation is asynchronous and {@link Callback} backgroundScanComplete or onError will 269 * be called if the return value of this call was {@code true}. As result of this call 270 * programListChanged may be triggered (if the scanned list differs). 271 * 272 * @return {@code true} if the scan was properly scheduled, {@code false} if the scan feature 273 * is unavailable; ie. temporarily due to ongoing foreground playback in single-tuner device 274 * or permanently if the feature is not supported 275 * (see ModuleProperties#isBackgroundScanningSupported()). 276 */ startBackgroundScan()277 public abstract boolean startBackgroundScan(); 278 279 /** 280 * Get the list of discovered radio stations. 281 * 282 * To get the full list, set filter to null or empty map. 283 * Keys must be prefixed with unique vendor Java-style namespace, 284 * eg. 'com.somecompany.parameter1'. 285 * 286 * @param vendorFilter vendor-specific selector for radio stations. 287 * @return a list of radio stations. 288 * @throws IllegalStateException if the scan is in progress or has not been started, 289 * startBackgroundScan() call may fix it. 290 * @throws IllegalArgumentException if the vendorFilter argument is not valid. 291 * @deprecated Use {@link getDynamicProgramList} instead. 292 */ 293 @Deprecated 294 public abstract @NonNull List<RadioManager.ProgramInfo> getProgramList(@ullable Map<String, String> vendorFilter)295 getProgramList(@Nullable Map<String, String> vendorFilter); 296 297 /** 298 * Get the dynamic list of discovered radio stations. 299 * 300 * The list object is updated asynchronously; to get the updates register 301 * with {@link ProgramList#addListCallback}. 302 * 303 * When the returned object is no longer used, it must be closed. 304 * 305 * @param filter filter for the list, or null to get the full list. 306 * @return the dynamic program list object, close it after use 307 * or {@code null} if program list is not supported by the tuner 308 */ getDynamicProgramList(@ullable ProgramList.Filter filter)309 public @Nullable ProgramList getDynamicProgramList(@Nullable ProgramList.Filter filter) { 310 return null; 311 } 312 313 /** 314 * Checks, if the analog playback is forced, see setAnalogForced. 315 * 316 * @throws IllegalStateException if the switch is not supported at current 317 * configuration. 318 * @return {@code true} if analog is forced, {@code false} otherwise. 319 * @deprecated Use {@link isConfigFlagSet(int)} instead. 320 */ 321 @Deprecated isAnalogForced()322 public abstract boolean isAnalogForced(); 323 324 /** 325 * Forces the analog playback for the supporting radio technology. 326 * 327 * User may disable digital playback for FM HD Radio or hybrid FM/DAB with 328 * this option. This is purely user choice, ie. does not reflect digital- 329 * analog handover managed from the HAL implementation side. 330 * 331 * Some radio technologies may not support this, ie. DAB. 332 * 333 * @param isForced {@code true} to force analog, {@code false} for a default behaviour. 334 * @throws IllegalStateException if the switch is not supported at current 335 * configuration. 336 * @deprecated Use {@link setConfigFlag(int, boolean)} instead. 337 */ 338 @Deprecated setAnalogForced(boolean isForced)339 public abstract void setAnalogForced(boolean isForced); 340 341 /** 342 * Checks, if a given config flag is supported 343 * 344 * @param flag Flag to check. 345 * @return True, if the flag is supported. 346 */ isConfigFlagSupported(@adioManager.ConfigFlag int flag)347 public boolean isConfigFlagSupported(@RadioManager.ConfigFlag int flag) { 348 return false; 349 } 350 351 /** 352 * Fetches the current setting of a given config flag. 353 * 354 * The success/failure result is consistent with isConfigFlagSupported. 355 * 356 * @param flag Flag to fetch. 357 * @return The current value of the flag. 358 * @throws IllegalStateException if the flag is not applicable right now. 359 * @throws UnsupportedOperationException if the flag is not supported at all. 360 */ isConfigFlagSet(@adioManager.ConfigFlag int flag)361 public boolean isConfigFlagSet(@RadioManager.ConfigFlag int flag) { 362 throw new UnsupportedOperationException(); 363 } 364 365 /** 366 * Sets the config flag. 367 * 368 * The success/failure result is consistent with isConfigFlagSupported. 369 * 370 * @param flag Flag to set. 371 * @param value The new value of a given flag. 372 * @throws IllegalStateException if the flag is not applicable right now. 373 * @throws UnsupportedOperationException if the flag is not supported at all. 374 */ setConfigFlag(@adioManager.ConfigFlag int flag, boolean value)375 public void setConfigFlag(@RadioManager.ConfigFlag int flag, boolean value) { 376 throw new UnsupportedOperationException(); 377 } 378 379 /** 380 * Generic method for setting vendor-specific parameter values. 381 * The framework does not interpret the parameters, they are passed 382 * in an opaque manner between a vendor application and HAL. 383 * 384 * Framework does not make any assumptions on the keys or values, other than 385 * ones stated in VendorKeyValue documentation (a requirement of key 386 * prefixes). 387 * See VendorKeyValue at hardware/interfaces/broadcastradio/2.0/types.hal. 388 * 389 * For each pair in the result map, the key will be one of the keys 390 * contained in the input (possibly with wildcards expanded), and the value 391 * will be a vendor-specific result status (such as "OK" or an error code). 392 * The implementation may choose to return an empty map, or only return 393 * a status for a subset of the provided inputs, at its discretion. 394 * 395 * Application and HAL must not use keys with unknown prefix. In particular, 396 * it must not place a key-value pair in results vector for unknown key from 397 * parameters vector - instead, an unknown key should simply be ignored. 398 * In other words, results vector may contain a subset of parameter keys 399 * (however, the framework doesn't enforce a strict subset - the only 400 * formal requirement is vendor domain prefix for keys). 401 * 402 * @param parameters Vendor-specific key-value pairs. 403 * @return Operation completion status for parameters being set. 404 */ 405 public @NonNull Map<String, String> setParameters(@onNull Map<String, String> parameters)406 setParameters(@NonNull Map<String, String> parameters) { 407 throw new UnsupportedOperationException(); 408 } 409 410 /** 411 * Generic method for retrieving vendor-specific parameter values. 412 * The framework does not interpret the parameters, they are passed 413 * in an opaque manner between a vendor application and HAL. 414 * 415 * Framework does not cache set/get requests, so it's possible for 416 * getParameter to return a different value than previous setParameter call. 417 * 418 * The syntax and semantics of keys are up to the vendor (as long as prefix 419 * rules are obeyed). For instance, vendors may include some form of 420 * wildcard support. In such case, result vector may be of different size 421 * than requested keys vector. However, wildcards are not recognized by 422 * framework and they are passed as-is to the HAL implementation. 423 * 424 * Unknown keys must be ignored and not placed into results vector. 425 * 426 * @param keys Parameter keys to fetch. 427 * @return Vendor-specific key-value pairs. 428 */ 429 public @NonNull Map<String, String> getParameters(@onNull List<String> keys)430 getParameters(@NonNull List<String> keys) { 431 throw new UnsupportedOperationException(); 432 } 433 434 /** 435 * Get current antenna connection state for current configuration. 436 * Only valid if a configuration has been applied. 437 * @return {@code true} if the antenna is connected, {@code false} otherwise. 438 * 439 * @deprecated Use {@link onAntennaState} callback instead 440 */ 441 @Deprecated isAntennaConnected()442 public abstract boolean isAntennaConnected(); 443 444 /** 445 * Indicates if this client actually controls the tuner. 446 * Control is always granted after 447 * {@link RadioManager#openTuner(int, 448 * RadioManager.BandConfig, boolean, Callback, Handler)} 449 * returns a non null tuner interface. 450 * Control is lost when another client opens an interface on the same tuner. 451 * When this happens, {@link Callback#onControlChanged(boolean)} is received. 452 * The client can either wait for control to be returned (which is indicated by the same 453 * callback) or close and reopen the tuner interface. 454 * @return {@code true} if this interface controls the tuner, 455 * {@code false} otherwise or if a problem occured retrieving the state. 456 */ hasControl()457 public abstract boolean hasControl(); 458 459 /** Indicates a failure of radio IC or driver. 460 * The application must close and re open the tuner 461 * @deprecated See {@link onError} callback. 462 */ 463 @Deprecated 464 public static final int ERROR_HARDWARE_FAILURE = 0; 465 /** Indicates a failure of the radio service. 466 * The application must close and re open the tuner 467 * @deprecated See {@link onError} callback. 468 */ 469 @Deprecated 470 public static final int ERROR_SERVER_DIED = 1; 471 /** A pending seek or tune operation was cancelled 472 * @deprecated See {@link onError} callback. 473 */ 474 @Deprecated 475 public static final int ERROR_CANCELLED = 2; 476 /** A pending seek or tune operation timed out 477 * @deprecated See {@link onError} callback. 478 */ 479 @Deprecated 480 public static final int ERROR_SCAN_TIMEOUT = 3; 481 /** The requested configuration could not be applied 482 * @deprecated See {@link onError} callback. 483 */ 484 @Deprecated 485 public static final int ERROR_CONFIG = 4; 486 /** Background scan was interrupted due to hardware becoming temporarily unavailable. 487 * @deprecated See {@link onError} callback. 488 */ 489 @Deprecated 490 public static final int ERROR_BACKGROUND_SCAN_UNAVAILABLE = 5; 491 /** Background scan failed due to other error, ie. HW failure. 492 * @deprecated See {@link onError} callback. 493 */ 494 @Deprecated 495 public static final int ERROR_BACKGROUND_SCAN_FAILED = 6; 496 497 /** 498 * Callback provided by the client application when opening a {@link RadioTuner} 499 * to receive asynchronous operation results, updates and error notifications. 500 */ 501 public static abstract class Callback { 502 /** 503 * onError() is called when an error occured while performing an asynchronous 504 * operation of when the hardware or system service experiences a problem. 505 * status is one of {@link #ERROR_HARDWARE_FAILURE}, {@link #ERROR_SERVER_DIED}, 506 * {@link #ERROR_CANCELLED}, {@link #ERROR_SCAN_TIMEOUT}, 507 * {@link #ERROR_CONFIG} 508 * 509 * @deprecated Use {@link onTuneFailed} for tune, scan and step; 510 * other use cases (configuration, background scan) are already deprecated. 511 */ onError(int status)512 public void onError(int status) {} 513 514 /** 515 * Called when tune, scan or step operation fails. 516 * 517 * @param result cause of the failure 518 * @param selector ProgramSelector argument of tune that failed; 519 * null for scan and step. 520 */ onTuneFailed(int result, @Nullable ProgramSelector selector)521 public void onTuneFailed(int result, @Nullable ProgramSelector selector) {} 522 523 /** 524 * onConfigurationChanged() is called upon successful completion of 525 * {@link RadioManager#openTuner(int, RadioManager.BandConfig, boolean, Callback, Handler)} 526 * or {@link RadioTuner#setConfiguration(RadioManager.BandConfig)} 527 * 528 * @deprecated Only applicable for HAL 1.x. 529 */ 530 @Deprecated onConfigurationChanged(RadioManager.BandConfig config)531 public void onConfigurationChanged(RadioManager.BandConfig config) {} 532 533 /** 534 * Called when program info (including metadata) for the current program has changed. 535 * 536 * It happens either upon successful completion of {@link RadioTuner#step(int, boolean)}, 537 * {@link RadioTuner#scan(int, boolean)}, {@link RadioTuner#tune(int, int)}; when 538 * a switching to alternate frequency occurs; or when metadata is updated. 539 */ onProgramInfoChanged(RadioManager.ProgramInfo info)540 public void onProgramInfoChanged(RadioManager.ProgramInfo info) {} 541 542 /** 543 * Called when metadata is updated for the current program. 544 * 545 * @deprecated Use {@link #onProgramInfoChanged(RadioManager.ProgramInfo)} instead. 546 */ 547 @Deprecated onMetadataChanged(RadioMetadata metadata)548 public void onMetadataChanged(RadioMetadata metadata) {} 549 550 /** 551 * onTrafficAnnouncement() is called when a traffic announcement starts and stops. 552 */ onTrafficAnnouncement(boolean active)553 public void onTrafficAnnouncement(boolean active) {} 554 /** 555 * onEmergencyAnnouncement() is called when an emergency annoucement starts and stops. 556 */ onEmergencyAnnouncement(boolean active)557 public void onEmergencyAnnouncement(boolean active) {} 558 /** 559 * onAntennaState() is called when the antenna is connected or disconnected. 560 */ onAntennaState(boolean connected)561 public void onAntennaState(boolean connected) {} 562 /** 563 * onControlChanged() is called when the client loses or gains control of the radio tuner. 564 * The control is always granted after a successful call to 565 * {@link RadioManager#openTuner(int, RadioManager.BandConfig, boolean, Callback, Handler)}. 566 * If another client opens the same tuner, onControlChanged() will be called with 567 * control set to {@code false} to indicate loss of control. 568 * At this point, RadioTuner APIs other than getters will return 569 * {@link RadioManager#STATUS_INVALID_OPERATION}. 570 * When the other client releases the tuner, onControlChanged() will be called 571 * with control set to {@code true}. 572 */ onControlChanged(boolean control)573 public void onControlChanged(boolean control) {} 574 575 /** 576 * onBackgroundScanAvailabilityChange() is called when background scan 577 * feature becomes available or not. 578 * 579 * @param isAvailable true, if the tuner turned temporarily background- 580 * capable, false in the other case. 581 */ onBackgroundScanAvailabilityChange(boolean isAvailable)582 public void onBackgroundScanAvailabilityChange(boolean isAvailable) {} 583 584 /** 585 * Called when a background scan completes successfully. 586 */ onBackgroundScanComplete()587 public void onBackgroundScanComplete() {} 588 589 /** 590 * Called when available program list changed. 591 * 592 * Use {@link RadioTuner#getProgramList(String)} to get an actual list. 593 */ onProgramListChanged()594 public void onProgramListChanged() {} 595 596 /** 597 * Generic callback for passing updates to vendor-specific parameter values. 598 * The framework does not interpret the parameters, they are passed 599 * in an opaque manner between a vendor application and HAL. 600 * 601 * It's up to the HAL implementation if and how to implement this callback, 602 * as long as it obeys the prefix rule. In particular, only selected keys 603 * may be notified this way. However, setParameters must not trigger 604 * this callback, while an internal event can change parameters 605 * asynchronously. 606 * 607 * @param parameters Vendor-specific key-value pairs. 608 */ onParametersUpdated(@onNull Map<String, String> parameters)609 public void onParametersUpdated(@NonNull Map<String, String> parameters) {} 610 } 611 612 } 613 614