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

Commit aa349627 authored by Sarah Chin's avatar Sarah Chin Committed by Jack Yu
Browse files

DN#onDeactivateResponse check illegal state for error

Update UUID for anomaly report as well

Test: atest DataNetworkTest, DataNetworkControllerTest
Test: crash locally and verify disconnected
Bug: 224832687
Merged-In: I32a3cc7113f9b19c001a102b865c28f4db3c338d
Change-Id: I32a3cc7113f9b19c001a102b865c28f4db3c338d
parent 709827c2
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -71,15 +71,7 @@ public class DataResponse extends IRadioDataResponse.Stub {
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void deactivateDataCallResponse(RadioResponseInfo responseInfo) {
        RILRequest rr = mRil.processResponse(RIL.DATA_SERVICE, responseInfo);

        if (rr != null) {
            int response = responseInfo.error;
            if (responseInfo.error == RadioError.NONE) {
                RadioResponse.sendMessageResponse(rr.mResult, response);
            }
            mRil.processResponseDone(rr, responseInfo, response);
        }
        RadioResponse.responseVoid(RIL.DATA_SERVICE, mRil, responseInfo);
    }

    /**
+1 −9
Original line number Diff line number Diff line
@@ -740,15 +740,7 @@ public class RadioResponse extends IRadioResponse.Stub {
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void deactivateDataCallResponse(RadioResponseInfo responseInfo) {
        RILRequest rr = mRil.processResponse(responseInfo);

        if (rr != null) {
            int response = responseInfo.error;
            if (responseInfo.error == RadioError.NONE) {
                sendMessageResponse(rr.mResult, response);
            }
            mRil.processResponseDone(rr, responseInfo, response);
        }
        responseVoid(responseInfo);
    }

    /**
+1 −4
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.internal.telephony.data;
import static android.telephony.data.DataServiceCallback.RESULT_SUCCESS;

import android.annotation.Nullable;
import android.hardware.radio.RadioError;
import android.net.LinkProperties;
import android.os.AsyncResult;
import android.os.Handler;
@@ -89,11 +88,9 @@ public class CellularDataService extends DataService {
                                    response);
                            break;
                        case DEACTIVATE_DATA_CALL_COMPLETE:
                            int error = (int) ar.result;
                            callback.onDeactivateDataCallComplete(ar.exception != null
                                    ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE
                                    : error == RadioError.NONE ? RESULT_SUCCESS
                                            : DataServiceCallback.RESULT_ERROR_INVALID_RESPONSE);
                                    : RESULT_SUCCESS);
                            break;
                        case SET_INITIAL_ATTACH_APN_COMPLETE:
                            callback.onSetInitialAttachApnComplete(ar.exception != null
+2 −2
Original line number Diff line number Diff line
@@ -1328,7 +1328,7 @@ public class DataNetwork extends StateMachine {
                                    MAXIMUM_DISCONNECTING_DURATION_MILLIS) + " seconds.";
                    logl(message);
                    AnomalyReporter.reportAnomaly(
                            UUID.fromString("d0e4fa1c-c57b-4ba5-b4b6-8955487012ca"), message);
                            UUID.fromString("d0e4fa1c-c57b-4ba5-b4b6-8955487012cb"), message);
                    mFailCause = DataFailCause.LOST_CONNECTION;
                    transitionTo(mDisconnectedState);
                    break;
@@ -2123,7 +2123,7 @@ public class DataNetwork extends StateMachine {
    private void onDeactivateResponse(@DataServiceCallback.ResultCode int resultCode) {
        logl("onDeactivateResponse: resultCode="
                + DataServiceCallback.resultCodeToString(resultCode));
        if (resultCode == DataServiceCallback.RESULT_ERROR_INVALID_RESPONSE) {
        if (resultCode == DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE) {
            log("Remove network since deactivate request returned an error.");
            mFailCause = DataFailCause.RADIO_NOT_AVAILABLE;
            transitionTo(mDisconnectedState);
+1 −1
Original line number Diff line number Diff line
@@ -696,7 +696,7 @@ public class DataNetworkTest extends TelephonyTest {
        testCreateDataNetwork();
        assertThat(mDataNetworkUT.isConnected()).isTrue();
        mDataNetworkUT.sendMessage(19/*EVENT_DEACTIVATE_DATA_NETWORK_RESPONSE*/,
                6/*RESULT_ERROR_INVALID_RESPONSE*/);
                4/*RESULT_ERROR_ILLEGAL_STATE*/);
        processAllMessages();

        verify(mDataNetworkCallback).onDisconnected(eq(mDataNetworkUT), eq(