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

Commit ca0cf6cf 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

am: f50085e9

Change-Id: I825a4556476c933bf006f4c2833206e2e148ec46
parents efe87b8b f50085e9
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();
@@ -1206,8 +1204,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);
@@ -1238,10 +1234,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);
        }
    }

@@ -1257,13 +1253,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);
@@ -1275,15 +1269,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
@@ -1347,10 +1336,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);
        }
    }

@@ -1370,12 +1359,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);
        }
    }

@@ -1392,12 +1379,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);
@@ -1409,11 +1395,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);
@@ -1425,9 +1410,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);
@@ -1438,9 +1422,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);
@@ -1465,9 +1448,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);
@@ -1479,9 +1461,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;
@@ -1491,6 +1471,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);
@@ -1517,14 +1498,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);
@@ -1536,12 +1516,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);
@@ -1555,12 +1534,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(
@@ -1574,6 +1550,7 @@ public class RadioResponse extends IRadioResponse.Stub {
                    ret.add(cell);
                }
            }
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, ret);
            }
            mRil.processResponseDone(rr, responseInfo, ret);
@@ -1585,14 +1562,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);
@@ -1606,7 +1582,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) {
@@ -1641,6 +1616,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);
@@ -1652,9 +1628,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);
@@ -1693,9 +1668,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);
@@ -1707,11 +1681,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);
@@ -1723,9 +1699,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);
@@ -1736,11 +1711,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);
@@ -1751,9 +1725,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);
@@ -1765,9 +1738,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;
@@ -1785,6 +1756,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);
            }