From 58141fbd6394b4d7a24b49322db7cbadae5fe8fd Mon Sep 17 00:00:00 2001 From: Weilin Xu Date: Tue, 13 Dec 2022 00:25:48 +0000 Subject: [PATCH] Improve DAB support in radio service and manager The full support for using 44-bit DAB primary identifier in AIDL was implemented. Whether program selectors and program info sent between AIDL HAL and HAL client are valid was checked in HAL client. Unit tests for checking target SDK version and converting program selector and info broadcast radio were added. In addition, existing unit tests were updated by using DAB_DMB_SID_EXT identifier type instead and using more meaningful values for DAB identifiers. Bug: 261912181 Test: atest com.android.server.broadcastradio Test: atest android.hardware.radio.tests.unittests Change-Id: I9e705acafea4fb6c5b77d1ba647097ad43ba7cf9 --- .../hardware/radio/ProgramSelector.java | 87 +++++++--- .../tests/unittests/ProgramListTest.java | 18 +- .../tests/unittests/ProgramSelectorTest.java | 40 ++--- .../tests/unittests/RadioManagerTest.java | 18 +- .../broadcastradio/aidl/AidlTestUtils.java | 34 +++- .../aidl/ConversionUtilsTest.java | 159 ++++++++++++++++++ .../broadcastradio/aidl/TunerSessionTest.java | 28 ++- .../hal2/TunerSessionHidlTest.java | 13 +- .../broadcastradio/aidl/ConversionUtils.java | 88 +++++++++- .../broadcastradio/aidl/ProgramInfoCache.java | 6 + .../broadcastradio/aidl/RadioModule.java | 14 +- .../broadcastradio/aidl/TunerSession.java | 7 +- 12 files changed, 420 insertions(+), 92 deletions(-) diff --git a/core/java/android/hardware/radio/ProgramSelector.java b/core/java/android/hardware/radio/ProgramSelector.java index 7faa285a8fee9..727716e67f28b 100644 --- a/core/java/android/hardware/radio/ProgramSelector.java +++ b/core/java/android/hardware/radio/ProgramSelector.java @@ -65,12 +65,12 @@ public final class ProgramSelector implements Parcelable { */ @Deprecated public static final int PROGRAM_TYPE_INVALID = 0; - /** Analogue AM radio (with or without RDS). + /** Analog AM radio (with or without RDS). * @deprecated use {@link ProgramIdentifier} instead */ @Deprecated public static final int PROGRAM_TYPE_AM = 1; - /** analogue FM radio (with or without RDS). + /** analog FM radio (with or without RDS). * @deprecated use {@link ProgramIdentifier} instead */ @Deprecated @@ -125,25 +125,50 @@ public final class ProgramSelector implements Parcelable { public @interface ProgramType {} public static final int IDENTIFIER_TYPE_INVALID = 0; - /** kHz */ + /** + * Primary identifier for analog (without RDS) AM/FM stations: + * frequency in kHz. + * + *

This identifier also contains band information: + *

  • + *