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

Commit b89457ff authored by Ling Ma's avatar Ling Ma
Browse files

Skip call for deprecated HAL

Deprecated methods getDeviceIdentity and getImsRegistrationState are called in CtsTelephonyTestCases and during boot. This violates best practices.

Fix: 401355649
Test: basic voice call + data browsing
Flag: EXEMPT deprecate
Change-Id: Ib44ad6579a9679d6459a4b0163b7397e8c9e2210
parent 77c23265
Loading
Loading
Loading
Loading
+22 −5
Original line number Diff line number Diff line
@@ -1331,7 +1331,12 @@ public class RIL extends BaseCommands implements CommandsInterface {
    }

    private boolean canMakeRequest(String request, RadioServiceProxy proxy, Message result,
            HalVersion version) {
            HalVersion minVersion) {
        return canMakeRequest(request, proxy, result, minVersion, null /* maxVersion */);
    }

    private boolean canMakeRequest(String request, RadioServiceProxy proxy, Message result,
            HalVersion minVersion, @Nullable HalVersion maxVersion) {
        int service = HAL_SERVICE_RADIO;
        if (proxy instanceof RadioDataProxy) {
            service = HAL_SERVICE_DATA;
@@ -1358,9 +1363,20 @@ public class RIL extends BaseCommands implements CommandsInterface {
            }
            return false;
        }
        if (mHalVersion.get(service).less(version)) {
        if (mHalVersion.get(service).less(minVersion)) {
            riljLoge(String.format("%s not supported on service %s < %s.",
                    request, serviceToString(service), version));
                    request, serviceToString(service), minVersion));
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                result.sendToTarget();
            }
            return false;
        }

        if (maxVersion != null && mHalVersion.get(service).greater(maxVersion)) {
            riljLoge(String.format("%s not supported on service %s > %s.",
                    request, serviceToString(service), maxVersion));
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
@@ -3627,7 +3643,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void getDeviceIdentity(Message result) {
        RadioModemProxy modemProxy = getRadioServiceProxy(RadioModemProxy.class);
        if (!canMakeRequest("getDeviceIdentity", modemProxy, result, RADIO_HAL_VERSION_1_4)) {
        if (!canMakeRequest("getDeviceIdentity", modemProxy, result, RADIO_HAL_VERSION_1_4,
                RADIO_HAL_VERSION_2_2)) {
            return;
        }

@@ -3882,7 +3899,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    public void getImsRegistrationState(Message result) {
        RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
        if (!canMakeRequest("getImsRegistrationState", networkProxy, result,
                RADIO_HAL_VERSION_1_4)) {
                RADIO_HAL_VERSION_1_4, RADIO_HAL_VERSION_2_2)) {
            return;
        }

+0 −20
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CHANGE_SIM
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_CONFERENCE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DATA_REGISTRATION_STATE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DELETE_SMS_ON_SIM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DEVICE_IDENTITY;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DEVICE_IMEI;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_DTMF;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_ENABLE_UICC_APPLICATIONS;
@@ -57,7 +56,6 @@ import static com.android.internal.telephony.RILConstants.RIL_REQUEST_GET_UICC_A
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_HANGUP;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IMS_REGISTRATION_STATE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IMS_SEND_SMS;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_LAST_CALL_FAIL_CAUSE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_NV_READ_ITEM;
@@ -1010,15 +1008,6 @@ public class RILTest extends TelephonyTest {
                mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_DELETE_SMS_ON_SIM);
    }

    @FlakyTest
    @Test
    public void testGetDeviceIdentity() throws Exception {
        mRILUnderTest.getDeviceIdentity(obtainMessage());
        verify(mRadioProxy).getDeviceIdentity(mSerialNumberCaptor.capture());
        verifyRILResponse(
                mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_DEVICE_IDENTITY);
    }

    @FlakyTest
    @Test
    public void testExitEmergencyCallbackMode() throws Exception {
@@ -1154,15 +1143,6 @@ public class RILTest extends TelephonyTest {
                mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_SET_INITIAL_ATTACH_APN);
    }

    @FlakyTest
    @Test
    public void testGetImsRegistrationState() throws Exception {
        mRILUnderTest.getImsRegistrationState(obtainMessage());
        verify(mRadioProxy).getImsRegistrationState(mSerialNumberCaptor.capture());
        verifyRILResponse(
                mRILUnderTest, mSerialNumberCaptor.getValue(), RIL_REQUEST_IMS_REGISTRATION_STATE);
    }

    @FlakyTest
    @Test
    public void testSendRetryImsGsmSms() throws Exception {