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

Commit 84e3c047 authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by Automerger Merge Worker
Browse files

Merge "Remove redundant logging and message sending when Radio is null" into...

Merge "Remove redundant logging and message sending when Radio is null" into rvc-dev am: cd87321d am: 93d9cab2

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/11855086

Change-Id: I87d32d305c43def4a003f768ae7369fe01f19d44
parents 260d3cc8 93d9cab2
Loading
Loading
Loading
Loading
+7 −38
Original line number Diff line number Diff line
@@ -4719,9 +4719,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        workSource = getDeafultWorkSourceIfInvalid(workSource);

        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy == null) {
            return;
        }
        if (radioProxy == null) return;

        RILRequest rr = obtainRequest(RIL_REQUEST_SET_ALLOWED_CARRIERS, result, workSource);

@@ -4801,9 +4799,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        workSource = getDeafultWorkSourceIfInvalid(workSource);

        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy == null) {
            return;
        }
        if (radioProxy == null) return;

        RILRequest rr = obtainRequest(RIL_REQUEST_GET_ALLOWED_CARRIERS, result,
                workSource);
@@ -5130,10 +5126,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            int contextId, KeepalivePacketData packetData, int intervalMillis, Message result) {
        checkNotNull(packetData, "KeepaliveRequest cannot be null.");
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy == null) {
            riljLoge("Radio Proxy object is null!");
            return;
        }
        if (radioProxy == null) return;

        if (mRadioVersion.less(RADIO_HAL_VERSION_1_1)) {
            if (result != null) {
@@ -5188,10 +5181,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void stopNattKeepalive(int sessionHandle, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy == null) {
            Rlog.e(RIL.RILJ_LOG_TAG, "Radio Proxy object is null!");
            return;
        }
        if (radioProxy == null) return;

        if (mRadioVersion.less(RADIO_HAL_VERSION_1_1)) {
            if (result != null) {
@@ -5253,14 +5243,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void enableUiccApplications(boolean enable, Message onCompleteMessage) {
        IRadio radioProxy = getRadioProxy(onCompleteMessage);
        if (radioProxy == null) {
            Rlog.e(RIL.RILJ_LOG_TAG, "Radio Proxy object is null!");
            if (onCompleteMessage != null) {
                AsyncResult.forMessage(onCompleteMessage, null,
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                onCompleteMessage.sendToTarget();
            }
        }
        if (radioProxy == null) return;

        if (mRadioVersion.less(RADIO_HAL_VERSION_1_5)) {
            if (onCompleteMessage != null) {
@@ -5294,14 +5277,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void areUiccApplicationsEnabled(Message onCompleteMessage) {
        IRadio radioProxy = getRadioProxy(onCompleteMessage);
        if (radioProxy == null) {
            Rlog.e(RIL.RILJ_LOG_TAG, "Radio Proxy object is null!");
            if (onCompleteMessage != null) {
                AsyncResult.forMessage(onCompleteMessage, null,
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                onCompleteMessage.sendToTarget();
            }
        }
        if (radioProxy == null) return;

        if (mRadioVersion.less(RADIO_HAL_VERSION_1_5)) {
            if (onCompleteMessage != null) {
@@ -5389,14 +5365,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
    @Override
    public void getBarringInfo(Message result) {
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy == null) {
            Rlog.e(RIL.RILJ_LOG_TAG, "Radio Proxy object is null!");
            if (result != null) {
                AsyncResult.forMessage(result, null,
                        CommandException.fromRilErrno(RADIO_NOT_AVAILABLE));
                result.sendToTarget();
            }
        }
        if (radioProxy == null) return;

        if (mRadioVersion.less(RADIO_HAL_VERSION_1_5)) {
            if (result != null) {
+13 −0
Original line number Diff line number Diff line
@@ -2490,6 +2490,19 @@ public class RILTest extends TelephonyTest {
                RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT);
    }

    @Test
    public void testAreUiccApplicationsEnabled_nullRadioProxy() throws Exception {
        // Not supported on Radio 1.0.
        doReturn(null).when(mRILUnderTest).getRadioProxy(any());
        Message message = obtainMessage();
        mRILUnderTest.areUiccApplicationsEnabled(message);
        processAllMessages();
        verify(mRadioProxy, never()).areUiccApplicationsEnabled(mSerialNumberCaptor.capture());
        // Sending message is handled by getRadioProxy when proxy is null.
        // areUiccApplicationsEnabled shouldn't explicitly send another callback.
        assertEquals(null, message.obj);
    }

    @Test
    public void testSetGetCompatVersion() throws Exception {
        final int testRequest = RIL_REQUEST_GET_UICC_APPLICATIONS_ENABLEMENT;