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

Commit 4cff8bf9 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 am: 84e3c047 am: 3cc58580

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

Change-Id: I8e1ebe80de6cad009e62cc16671b33dd7a7eaf50
parents 2114d868 3cc58580
Loading
Loading
Loading
Loading
+7 −38
Original line number Diff line number Diff line
@@ -4737,9 +4737,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);

@@ -4819,9 +4817,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);
@@ -5148,10 +5144,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) {
@@ -5206,10 +5199,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) {
@@ -5271,14 +5261,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) {
@@ -5312,14 +5295,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) {
@@ -5407,14 +5383,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;