diff options
2 files changed, 7 insertions, 51 deletions
diff --git a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/ConversionUtilsTest.java b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/ConversionUtilsTest.java index ba0579171c43..aea01783ee68 100644 --- a/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/ConversionUtilsTest.java +++ b/core/tests/BroadcastRadioTests/src/com/android/server/broadcastradio/aidl/ConversionUtilsTest.java @@ -259,20 +259,6 @@ public final class ConversionUtilsTest extends ExtendedRadioMockitoTestCase { } @Test - public void programSelectorToHalProgramSelector_withInvalidDabSelector_returnsNull() { - ProgramSelector invalidDbSelector = new ProgramSelector(ProgramSelector.PROGRAM_TYPE_DAB, - TEST_DAB_SID_EXT_ID, - new ProgramSelector.Identifier[0], - new long[0]); - - android.hardware.broadcastradio.ProgramSelector invalidHalDabSelector = - ConversionUtils.programSelectorToHalProgramSelector(invalidDbSelector); - - expect.withMessage("Invalid HAL DAB selector without required secondary ids") - .that(invalidHalDabSelector).isNull(); - } - - @Test public void programSelectorFromHalProgramSelector_withValidSelector() { android.hardware.broadcastradio.ProgramSelector halDabSelector = AidlTestUtils.makeHalSelector(TEST_HAL_DAB_SID_EXT_ID, new ProgramIdentifier[]{ @@ -289,18 +275,6 @@ public final class ConversionUtilsTest extends ExtendedRadioMockitoTestCase { } @Test - public void programSelectorFromHalProgramSelector_withInvalidSelector_returnsNull() { - android.hardware.broadcastradio.ProgramSelector invalidHalDabSelector = - AidlTestUtils.makeHalSelector(TEST_HAL_DAB_SID_EXT_ID, new ProgramIdentifier[]{}); - - ProgramSelector invalidDabSelector = - ConversionUtils.programSelectorFromHalProgramSelector(invalidHalDabSelector); - - expect.withMessage("Invalid DAB selector without required secondary ids") - .that(invalidDabSelector).isNull(); - } - - @Test public void programInfoFromHalProgramInfo_withValidProgramInfo() { android.hardware.broadcastradio.ProgramSelector halDabSelector = AidlTestUtils.makeHalSelector(TEST_HAL_DAB_SID_EXT_ID, new ProgramIdentifier[]{ diff --git a/services/core/java/com/android/server/broadcastradio/aidl/ConversionUtils.java b/services/core/java/com/android/server/broadcastradio/aidl/ConversionUtils.java index 4f2bfd1c1e52..aab815c93e1a 100644 --- a/services/core/java/com/android/server/broadcastradio/aidl/ConversionUtils.java +++ b/services/core/java/com/android/server/broadcastradio/aidl/ConversionUtils.java @@ -347,31 +347,13 @@ final class ConversionUtils { private static boolean isValidHalProgramSelector( android.hardware.broadcastradio.ProgramSelector sel) { - if (sel.primaryId.type != IdentifierType.AMFM_FREQUENCY_KHZ - && sel.primaryId.type != IdentifierType.RDS_PI - && sel.primaryId.type != IdentifierType.HD_STATION_ID_EXT - && sel.primaryId.type != IdentifierType.DAB_SID_EXT - && sel.primaryId.type != IdentifierType.DRMO_SERVICE_ID - && sel.primaryId.type != IdentifierType.SXM_SERVICE_ID - && !isVendorIdentifierType(sel.primaryId.type)) { - return false; - } - if (sel.primaryId.type == IdentifierType.DAB_SID_EXT) { - boolean hasEnsemble = false; - boolean hasFrequency = false; - for (int i = 0; i < sel.secondaryIds.length; i++) { - if (sel.secondaryIds[i].type == IdentifierType.DAB_ENSEMBLE) { - hasEnsemble = true; - } else if (sel.secondaryIds[i].type == IdentifierType.DAB_FREQUENCY_KHZ) { - hasFrequency = true; - } - if (hasEnsemble && hasFrequency) { - return true; - } - } - return false; - } - return true; + return sel.primaryId.type == IdentifierType.AMFM_FREQUENCY_KHZ + || sel.primaryId.type == IdentifierType.RDS_PI + || sel.primaryId.type == IdentifierType.HD_STATION_ID_EXT + || sel.primaryId.type == IdentifierType.DAB_SID_EXT + || sel.primaryId.type == IdentifierType.DRMO_SERVICE_ID + || sel.primaryId.type == IdentifierType.SXM_SERVICE_ID + || isVendorIdentifierType(sel.primaryId.type); } @Nullable |