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

Commit dc0f5ea5 authored by Nathan Harold's avatar Nathan Harold Committed by Jack Yu
Browse files

Catch IAE from Invalid PCC Report by Modem

The modem seems to report invalid physical channel
configs from time to time. Catch them and log and error
rather than throwing an uncaught exception back over the
HAL Binder.

Bug: 189369531
Test: manual
Change-Id: I0bd13a7f7d975caabb8e9af6d5396b7ca8e2b7a0
(cherry picked from commit 549955f9656ed11ccc13680ed270da50f915534b)
parent c3950397
Loading
Loading
Loading
Loading
+53 −43
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS_ON_SIM;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_NEW_SMS_STATUS_REPORT;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM_PHONEBOOK_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM_PHONEBOOK_RECORDS_RECEIVED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM_STATUS_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESTRICTED_STATE_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RIL_CONNECTED;
@@ -68,8 +70,6 @@ import static com.android.internal.telephony.RILConstants.RIL_UNSOL_UICC_SUBSCRI
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_UNTHROTTLE_APN;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_VOICE_RADIO_TECH_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOl_CDMA_PRL_CHANGED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM_PHONEBOOK_RECORDS_RECEIVED;
import static com.android.internal.telephony.RILConstants.RIL_UNSOL_RESPONSE_SIM_PHONEBOOK_CHANGED;

import android.hardware.radio.V1_0.CdmaCallWaiting;
import android.hardware.radio.V1_0.CdmaInformationRecord;
@@ -88,8 +88,8 @@ import android.hardware.radio.V1_0.StkCcUnsolSsResult;
import android.hardware.radio.V1_0.SuppSvcNotification;
import android.hardware.radio.V1_2.CellConnectionStatus;
import android.hardware.radio.V1_6.IRadioIndication;
import android.hardware.radio.V1_6.PhysicalChannelConfig.Band;
import android.hardware.radio.V1_6.PhonebookRecordInfo;
import android.hardware.radio.V1_6.PhysicalChannelConfig.Band;
import android.os.AsyncResult;
import android.os.RemoteException;
import android.sysprop.TelephonyProperties;
@@ -116,9 +116,9 @@ import com.android.internal.telephony.cdma.SmsMessageConverter;
import com.android.internal.telephony.dataconnection.KeepaliveStatus;
import com.android.internal.telephony.gsm.SsData;
import com.android.internal.telephony.gsm.SuppServiceNotification;
import com.android.internal.telephony.uicc.ReceivedPhonebookRecords;
import com.android.internal.telephony.uicc.IccRefreshResponse;
import com.android.internal.telephony.uicc.IccUtils;
import com.android.internal.telephony.uicc.ReceivedPhonebookRecords;
import com.android.internal.telephony.uicc.SimPhonebookRecord;

import java.util.ArrayList;
@@ -1275,6 +1275,7 @@ public class RadioIndication extends IRadioIndication.Stub {

    private void physicalChannelConfigsIndication(List<? extends Object> configs) {
        List<PhysicalChannelConfig> response = new ArrayList<>(configs.size());
        try {
            for (Object obj : configs) {
                if (obj instanceof android.hardware.radio.V1_2.PhysicalChannelConfig) {
                    android.hardware.radio.V1_2.PhysicalChannelConfig config =
@@ -1293,7 +1294,8 @@ public class RadioIndication extends IRadioIndication.Stub {
                    response.add(builder.setCellConnectionStatus(
                            convertConnectionStatusFromCellConnectionStatus(config.base.status))
                            .setCellBandwidthDownlinkKhz(config.base.cellBandwidthDownlink)
                        .setNetworkType(ServiceState.rilRadioTechnologyToNetworkType(config.rat))
                            .setNetworkType(
                                    ServiceState.rilRadioTechnologyToNetworkType(config.rat))
                            .setPhysicalCellId(config.physicalCellId)
                            .setContextIds(config.contextIds.stream().mapToInt(x -> x).toArray())
                            .build());
@@ -1308,7 +1310,8 @@ public class RadioIndication extends IRadioIndication.Stub {
                            .setUplinkChannelNumber(config.uplinkChannelNumber)
                            .setCellBandwidthDownlinkKhz(config.cellBandwidthDownlinkKhz)
                            .setCellBandwidthUplinkKhz(config.cellBandwidthUplinkKhz)
                        .setNetworkType(ServiceState.rilRadioTechnologyToNetworkType(config.rat))
                            .setNetworkType(
                                    ServiceState.rilRadioTechnologyToNetworkType(config.rat))
                            .setPhysicalCellId(config.physicalCellId)
                            .setContextIds(config.contextIds.stream().mapToInt(x -> x).toArray())
                            .build());
@@ -1316,6 +1319,13 @@ public class RadioIndication extends IRadioIndication.Stub {
                    mRil.riljLoge("Unsupported PhysicalChannelConfig " + obj);
                }
            }
        } catch (IllegalArgumentException iae) {
            AnomalyReporter.reportAnomaly(
                    UUID.fromString("918f0970-9aa9-4bcd-a28e-e49a83fe77d5"),
                    "Invalid PhysicalChannelConfig reported by HAL");
            mRil.riljLoge("Invalid PhysicalChannelConfig " + iae);
            return;
        }

        if (RIL.RILJ_LOGD) mRil.unsljLogRet(RIL_UNSOL_PHYSICAL_CHANNEL_CONFIG, response);