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

Commit 0edd55aa authored by Nathan Harold's avatar Nathan Harold
Browse files

Always call processResponseDone() NATT Responses

In case of errors, stopkeepaliveReponse wasn't calling
processResponseDone(), which leads to a wakelock being
held incorrectly. Move the processResponseDone() to
finally blocks to ensure that it's always called for
any non-null response message.

Bug: 116766779
Test: compilation
Change-Id: I0ced3fa19804f2fa422aaebd039dcaac40156dd9
parent 954e4c54
Loading
Loading
Loading
Loading
+34 −35
Original line number Diff line number Diff line
@@ -1313,13 +1313,10 @@ public class RadioResponse extends IRadioResponse.Stub {
            android.hardware.radio.V1_1.KeepaliveStatus keepaliveStatus) {

        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr == null) {
            return;
        }
        if (rr == null) return;

        KeepaliveStatus ret = null;

        try {
            switch(responseInfo.error) {
                case RadioError.NONE:
                    int convertedStatus = convertHalKeepaliveStatusCode(keepaliveStatus.code);
@@ -1342,26 +1339,28 @@ public class RadioResponse extends IRadioResponse.Stub {
                    ret = new KeepaliveStatus(KeepaliveStatus.ERROR_UNKNOWN);
                    break;
            }
        } finally {
            // If responseInfo.error != NONE, the processResponseDone sends the response message.
            mRil.processResponseDone(rr, responseInfo, ret);
        }
    }

    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void stopKeepaliveResponse(RadioResponseInfo responseInfo) {
        RILRequest rr = mRil.processResponse(responseInfo);
        if (rr == null) return;

        if (rr == null) {
            return;
        }

        try {
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, null);
            mRil.processResponseDone(rr, responseInfo, null);
            } else {
                //TODO: Error code translation
            }
        } finally {
            mRil.processResponseDone(rr, responseInfo, null);
        }
    }

    private int convertHalKeepaliveStatusCode(int halCode) {