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

Commit f50085e9 authored by Amit Mahajan's avatar Amit Mahajan Committed by android-build-merger
Browse files

Merge "Parse response from hal even in case of error." into oc-dev

am: bbd3a5e6

Change-Id: I25f970d5f6ebff98c7267a606c945369ec0d8878
parents c024814b bbd3a5e6
Loading
Loading
Loading
Loading
+216 −244
Original line number Diff line number Diff line
@@ -1090,11 +1090,9 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            RadioCapability ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = RIL.convertHalRadioCapability(rc, mRil);
            } else if (responseInfo.error == RadioError.REQUEST_NOT_SUPPORTED ||
                    responseInfo.error == RadioError.GENERIC_FAILURE) {
            RadioCapability ret = RIL.convertHalRadioCapability(rc, mRil);
            if (responseInfo.error == RadioError.REQUEST_NOT_SUPPORTED
                    || responseInfo.error == RadioError.GENERIC_FAILURE) {
                // we should construct the RAF bitmask the radio
                // supports based on preferred network bitmasks
                ret = mRil.makeStaticRadioCapability();
@@ -1199,8 +1197,6 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            Object ret = null;
            if (responseInfo.error == RadioError.NONE) {
            IccCardStatus iccCardStatus = new IccCardStatus();
            iccCardStatus.setCardState(cardStatus.cardState);
            iccCardStatus.setUniversalPinState(cardStatus.universalPinState);
@@ -1231,10 +1227,10 @@ public class RadioResponse extends IRadioResponse.Stub {
                iccCardStatus.mApplications[i] = appStatus;
            }
            mRil.riljLog("responseIccCardStatus: from HIDL: " + iccCardStatus);
                ret = iccCardStatus;
                sendMessageResponse(rr.mResult, ret);
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, iccCardStatus);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
            mRil.processResponseDone(rr, responseInfo, iccCardStatus);
        }
    }

@@ -1250,13 +1246,11 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            Object ret = null;
            if (responseInfo.error == RadioError.NONE) {
                int[] response = new int[var.size()];
            int[] ret = new int[var.size()];
            for (int i = 0; i < var.size(); i++) {
                    response[i] = var.get(i);
                ret[i] = var.get(i);
            }
                ret = response;
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1268,15 +1262,10 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            Object ret = null;
            if (responseInfo.error == RadioError.NONE) {
                int num;
                ArrayList<DriverCall> dcCalls;
            int num = calls.size();
            ArrayList<DriverCall> dcCalls = new ArrayList<DriverCall>(num);
            DriverCall dc;

                num = calls.size();
                dcCalls = new ArrayList<DriverCall>(num);

            for (int i = 0; i < num; i++) {
                dc = new DriverCall();
                // TODO: change name of function stateFromCLCC() in DriverCall.java to name
@@ -1340,10 +1329,10 @@ public class RadioResponse extends IRadioResponse.Stub {
                }
            }

                ret = dcCalls;
                sendMessageResponse(rr.mResult, ret);
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, dcCalls);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
            mRil.processResponseDone(rr, responseInfo, dcCalls);
        }
    }

@@ -1363,12 +1352,10 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            String ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = str;
                sendMessageResponse(rr.mResult, ret);
                sendMessageResponse(rr.mResult, str);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
            mRil.processResponseDone(rr, responseInfo, str);
        }
    }

@@ -1385,12 +1372,11 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = ril.processResponse(responseInfo);

        if (rr != null) {
            String[] ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = new String[strings.size()];
            String[] ret = new String[strings.size()];
            for (int i = 0; i < strings.size(); i++) {
                ret[i] = strings.get(i);
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            ril.processResponseDone(rr, responseInfo, ret);
@@ -1402,11 +1388,10 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            LastCallFailCause ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = new LastCallFailCause();
            LastCallFailCause ret = new LastCallFailCause();
            ret.causeCode = fcInfo.causeCode;
            ret.vendorCause = fcInfo.vendorCause;
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1418,9 +1403,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            SignalStrength ret = null;
            SignalStrength ret = RIL.convertHalSignalStrength(sigStrength);
            if (responseInfo.error == RadioError.NONE) {
                ret = RIL.convertHalSignalStrength(sigStrength);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1431,9 +1415,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            SmsResponse ret = null;
            SmsResponse ret = new SmsResponse(sms.messageRef, sms.ackPDU, sms.errorCode);
            if (responseInfo.error == RadioError.NONE) {
                ret = new SmsResponse(sms.messageRef, sms.ackPDU, sms.errorCode);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1458,9 +1441,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            IccIoResult ret = null;
            IccIoResult ret = new IccIoResult(result.sw1, result.sw2, result.simResponse);
            if (responseInfo.error == RadioError.NONE) {
                ret = new IccIoResult(result.sw1, result.sw2, result.simResponse);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1472,9 +1454,7 @@ public class RadioResponse extends IRadioResponse.Stub {
                                                 callForwardInfos) {
        RILRequest rr = mRil.processResponse(responseInfo);
        if (rr != null) {
            CallForwardInfo[] ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = new CallForwardInfo[callForwardInfos.size()];
            CallForwardInfo[] ret = new CallForwardInfo[callForwardInfos.size()];
            for (int i = 0; i < callForwardInfos.size(); i++) {
                ret[i] = new CallForwardInfo();
                ret[i].status = callForwardInfos.get(i).status;
@@ -1484,6 +1464,7 @@ public class RadioResponse extends IRadioResponse.Stub {
                ret[i].number = callForwardInfos.get(i).number;
                ret[i].timeSeconds = callForwardInfos.get(i).timeSeconds;
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1510,14 +1491,13 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<OperatorInfo> ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret =  new ArrayList<OperatorInfo>();
            ArrayList<OperatorInfo> ret = new ArrayList<OperatorInfo>();
            for (int i = 0; i < networkInfos.size(); i++) {
                ret.add(new OperatorInfo(networkInfos.get(i).alphaLong,
                        networkInfos.get(i).alphaShort, networkInfos.get(i).operatorNumeric,
                        convertOpertatorInfoToString(networkInfos.get(i).status)));
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1529,12 +1509,11 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<DataCallResponse> dcResponseList = null;
            if (responseInfo.error == RadioError.NONE) {
                dcResponseList = new ArrayList<>();
            ArrayList<DataCallResponse> dcResponseList = new ArrayList<>();
            for (SetupDataCallResult dcResult : dataCallResultList) {
                dcResponseList.add(RIL.convertDataCallResult(dcResult));
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, dcResponseList);
            }
            mRil.processResponseDone(rr, responseInfo, dcResponseList);
@@ -1548,12 +1527,9 @@ public class RadioResponse extends IRadioResponse.Stub {
        if (rr != null) {
            int rssi;
            String location;
            ArrayList<NeighboringCellInfo> ret = null;
            ArrayList<NeighboringCellInfo> ret = new ArrayList<NeighboringCellInfo>();
            NeighboringCellInfo cell;

            if (responseInfo.error == RadioError.NONE) {
                ret =  new ArrayList<NeighboringCellInfo>();

            int[] subId = SubscriptionManager.getSubId(mRil.mPhoneId);
            int radioType =
                    ((TelephonyManager) mRil.mContext.getSystemService(
@@ -1567,6 +1543,7 @@ public class RadioResponse extends IRadioResponse.Stub {
                    ret.add(cell);
                }
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1578,14 +1555,13 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<SmsBroadcastConfigInfo> ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret =  new ArrayList<SmsBroadcastConfigInfo>();
            ArrayList<SmsBroadcastConfigInfo> ret = new ArrayList<SmsBroadcastConfigInfo>();
            for (int i = 0; i < configs.size(); i++) {
                ret.add(new SmsBroadcastConfigInfo(configs.get(i).fromServiceId,
                        configs.get(i).toServiceId, configs.get(i).fromCodeScheme,
                        configs.get(i).toCodeScheme, configs.get(i).selected));
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1599,7 +1575,6 @@ public class RadioResponse extends IRadioResponse.Stub {
        if (rr != null) {
            int[] ret = null;

            if (responseInfo.error == RadioError.NONE) {
            int numServiceCategories = configs.size();

            if (numServiceCategories == 0) {
@@ -1634,6 +1609,7 @@ public class RadioResponse extends IRadioResponse.Stub {
                    ret[i + 2] = configs.get(j).selected ? 1 : 0;
                }
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1645,9 +1621,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<CellInfo> ret = null;
            ArrayList<CellInfo> ret = RIL.convertHalCellInfoList(cellInfo);
            if (responseInfo.error == RadioError.NONE) {
                ret =  RIL.convertHalCellInfoList(cellInfo);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1686,9 +1661,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<HardwareConfig> ret = null;
            ArrayList<HardwareConfig> ret = RIL.convertHalHwConfigList(config, mRil);
            if (responseInfo.error == RadioError.NONE) {
                ret = RIL.convertHalHwConfigList(config, mRil);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1700,11 +1674,13 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            IccIoResult ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = new IccIoResult(result.sw1, result.sw2, (!(result.simResponse).equals(""))
            IccIoResult ret = new IccIoResult(
                    result.sw1,
                    result.sw2,
                    (!(result.simResponse).equals(""))
                            ? android.util.Base64.decode(result.simResponse,
                            android.util.Base64.DEFAULT) : (byte[]) null);
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1716,9 +1692,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            RadioCapability ret = null;
            RadioCapability ret = RIL.convertHalRadioCapability(rc, mRil);
            if (responseInfo.error == RadioError.NONE) {
                ret = RIL.convertHalRadioCapability(rc, mRil);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1729,11 +1704,10 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<Integer> ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = new ArrayList<Integer>();
            ArrayList<Integer> ret = new ArrayList<Integer>();
            ret.add(statusInfo.lceStatus);
            ret.add((int) statusInfo.actualIntervalMs);
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1744,9 +1718,8 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            ArrayList<Integer> ret = null;
            ArrayList<Integer> ret = RIL.convertHalLceData(lceInfo, mRil);
            if (responseInfo.error == RadioError.NONE) {
                ret = RIL.convertHalLceData(lceInfo, mRil);
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1758,9 +1731,7 @@ public class RadioResponse extends IRadioResponse.Stub {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            List<CarrierIdentifier> ret = null;
            if (responseInfo.error == RadioError.NONE) {
                ret = new ArrayList<CarrierIdentifier>();
            List<CarrierIdentifier> ret = new ArrayList<CarrierIdentifier>();
            for (int i = 0; i < carriers.allowedCarriers.size(); i++) {
                String mcc = carriers.allowedCarriers.get(i).mcc;
                String mnc = carriers.allowedCarriers.get(i).mnc;
@@ -1778,6 +1749,7 @@ public class RadioResponse extends IRadioResponse.Stub {
                }
                ret.add(new CarrierIdentifier(mcc, mnc, spn, imsi, gid1, gid2));
            }
            if (responseInfo.error == RadioError.NONE) {
                /* TODO: Handle excluded carriers */
                sendMessageResponse(rr.mResult, ret);
            }