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

Commit bc20a958 authored by Sarah Chin's avatar Sarah Chin
Browse files

Make PCC indication logic consistent between HIDL and AIDL

Test: atest PhysicalChannelConfigTest
Bug: 228909053
Change-Id: I006ac22631bca42566d2980a981a5a813c1055f0
parent 9e8ea99b
Loading
Loading
Loading
Loading
+34 −27
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ public class NetworkIndication extends IRadioNetworkIndication.Stub {
            android.hardware.radio.network.PhysicalChannelConfig[] configs) {
        mRil.processIndication(RIL.NETWORK_SERVICE, indicationType);
        List<PhysicalChannelConfig> response = new ArrayList<>(configs.length);
        try {
            for (android.hardware.radio.network.PhysicalChannelConfig config : configs) {
                PhysicalChannelConfig.Builder builder = new PhysicalChannelConfig.Builder();
                switch (config.band.getTag()) {
@@ -169,6 +170,12 @@ public class NetworkIndication extends IRadioNetworkIndication.Stub {
                        .setContextIds(config.contextIds)
                        .build());
            }
        } catch (IllegalArgumentException iae) {
            AnomalyReporter.reportAnomaly(UUID.fromString("918f0970-9aa9-4bcd-a28e-e49a83fe77d5"),
                    "RIL reported invalid PCC (AIDL)");
            mRil.riljLoge("Invalid PhysicalChannelConfig " + iae);
            return;
        }
        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG, response);

        mRil.mPhysicalChannelConfigurationRegistrants.notifyRegistrants(
+2 −3
Original line number Diff line number Diff line
@@ -1238,9 +1238,8 @@ public class RadioIndication extends IRadioIndication.Stub {
                }
            }
        } catch (IllegalArgumentException iae) {
            AnomalyReporter.reportAnomaly(
                    UUID.fromString("918f0970-9aa9-4bcd-a28e-e49a83fe77d5"),
                    "Invalid PhysicalChannelConfig reported by HAL");
            AnomalyReporter.reportAnomaly(UUID.fromString("918f0970-9aa9-4bcd-a28e-e49a83fe77d5"),
                    "RIL reported invalid PCC (HIDL)");
            mRil.riljLoge("Invalid PhysicalChannelConfig " + iae);
            return;
        }
+6 −3
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ package com.android.internal.telephony;

import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.fail;

import android.os.Parcel;
import android.telephony.AccessNetworkConstants;
import android.telephony.PhysicalChannelConfig;
@@ -128,9 +130,10 @@ public class PhysicalChannelConfigTest {

    @Test
    public void testFrequencyRangeWithoutBand() {
        try {
            setUpPhysicalChannelConfig(NETWORK_TYPE_UMTS, 0, CHANNEL_NUMBER, CHANNEL_NUMBER, -1);
        assertThat(mPhysicalChannelConfig.getFrequencyRange())
                .isEqualTo(ServiceState.FREQUENCY_RANGE_UNKNOWN);
            fail();
        } catch (IllegalArgumentException expected) { }
    }

    @Test