Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c56d7512 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix converting 28-bit DAB radio id to AIDL HAL id" into udc-qpr-dev am: 504df8c4

parents c492366c 504df8c4
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -250,6 +250,20 @@ public final class ConversionUtilsTest extends ExtendedRadioMockitoTestCase {
                .isEqualTo(TEST_HAL_DAB_SID_EXT_ID);
    }

    @Test
    public void identifierToHalProgramIdentifier_withDeprecateDabId() {
        long value = 0x98765ABCDL;
        ProgramSelector.Identifier dabId = new ProgramSelector.Identifier(
                        ProgramSelector.IDENTIFIER_TYPE_DAB_SID_EXT, value);
        ProgramIdentifier halDabIdExpected = AidlTestUtils.makeHalIdentifier(
                IdentifierType.DAB_SID_EXT, 0x987650000ABCDL);

        ProgramIdentifier halDabId = ConversionUtils.identifierToHalProgramIdentifier(dabId);

        expect.withMessage("Converted 28-bit DAB identifier for HAL").that(halDabId)
                .isEqualTo(halDabIdExpected);
    }

    @Test
    public void identifierFromHalProgramIdentifier_withDabId() {
        ProgramSelector.Identifier dabId =
+10 −2
Original line number Diff line number Diff line
@@ -323,10 +323,15 @@ final class ConversionUtils {
    static ProgramIdentifier identifierToHalProgramIdentifier(ProgramSelector.Identifier id) {
        ProgramIdentifier hwId = new ProgramIdentifier();
        hwId.type = id.getType();
        if (hwId.type == ProgramSelector.IDENTIFIER_TYPE_DAB_DMB_SID_EXT) {
        if (id.getType() == ProgramSelector.IDENTIFIER_TYPE_DAB_DMB_SID_EXT) {
            hwId.type = IdentifierType.DAB_SID_EXT;
        }
        hwId.value = id.getValue();
        long value = id.getValue();
        if (id.getType() == ProgramSelector.IDENTIFIER_TYPE_DAB_SID_EXT) {
            hwId.value = (value & 0xFFFF) | ((value >>> 16) << 32);
        } else {
            hwId.value = value;
        }
        return hwId;
    }

@@ -609,6 +614,9 @@ final class ConversionUtils {
                || isNewIdentifierInU(info.getPhysicallyTunedTo())) {
            return false;
        }
        if (info.getRelatedContent() == null) {
            return true;
        }
        Iterator<ProgramSelector.Identifier> relatedContentIt = info.getRelatedContent().iterator();
        while (relatedContentIt.hasNext()) {
            if (isNewIdentifierInU(relatedContentIt.next())) {