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

Commit 19cb2a62 authored by Thomas Nguyen's avatar Thomas Nguyen
Browse files

Check isInCarrierRoamingNbIotNtn for the phone associated with SmsDispatchersController object

FLAG: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn 
Bug: 369502538
Test: atest GsmSmsDispatcherTest ImsSmsDispatcherTest CdmaSmsDispatcherTest SmsDispatchersControllerTest
Manually test send P2P SMS over NTN using test app

Change-Id: I4f0e0e4cb3719a5a43d43607e4a68e298ef38574
parent 0dc776da
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1248,7 +1248,7 @@ public class SmsDispatchersController extends Handler {
    }

    private void notifySmsSentToDatagramDispatcher(long messageId, boolean success) {
        if (SatelliteController.getInstance().isInCarrierRoamingNbIotNtn()) {
        if (SatelliteController.getInstance().isInCarrierRoamingNbIotNtn(mPhone)) {
            DatagramDispatcher.getInstance().onSendSmsDone(mPhone.getSubId(), messageId, success);
        }
    }
@@ -1856,7 +1856,7 @@ public class SmsDispatchersController extends Handler {
                messageUri, persistMessage, priority, expectMore, validityPeriod, messageId,
                skipShortCodeCheck);

        if (SatelliteController.getInstance().isInCarrierRoamingNbIotNtn()) {
        if (SatelliteController.getInstance().isInCarrierRoamingNbIotNtn(mPhone)) {
            // Send P2P SMS using carrier roaming NB IOT NTN
            DatagramDispatcher.getInstance().sendSms(pendingRequest);
            return;
@@ -2021,7 +2021,7 @@ public class SmsDispatchersController extends Handler {
                null, 0, parts, messageUri, persistMessage, priority, expectMore,
                validityPeriod, messageId, false);

        if (SatelliteController.getInstance().isInCarrierRoamingNbIotNtn()) {
        if (SatelliteController.getInstance().isInCarrierRoamingNbIotNtn(mPhone)) {
            // Send multipart P2P SMS using carrier roaming NB IOT NTN
            DatagramDispatcher.getInstance().sendSms(pendingRequest);
            return;
+28 −1
Original line number Diff line number Diff line
@@ -3535,7 +3535,7 @@ public class SatelliteController extends Handler {
            return false;
        }

        if (!isSatelliteEnabledOrBeingEnabled()) {
        if (!isSatelliteEnabled()) {
            plogd("iisInCarrierRoamingNbIotNtn: satellite is disabled");
            return false;
        }
@@ -3545,7 +3545,34 @@ public class SatelliteController extends Handler {
            plogd("isInCarrierRoamingNbIotNtn: not carrier roaming ntn eligible.");
            return false;
        }
        plogd("isInCarrierRoamingNbIotNtn: carrier roaming ntn eligible.");
        return true;
    }

    /**
     * @return {@code true} if phone is in carrier roaming nb iot ntn mode,
     * else {@return false}
     */
    public boolean isInCarrierRoamingNbIotNtn(@NonNull Phone phone) {
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            plogd("isInCarrierRoamingNbIotNtn: carrier roaming nb iot ntn "
                    + "feature flag is disabled");
            return false;
        }

        if (!isSatelliteEnabled()) {
            plogd("iisInCarrierRoamingNbIotNtn: satellite is disabled");
            return false;
        }

        if (!isCarrierRoamingNtnEligible(phone)) {
            plogd("isInCarrierRoamingNbIotNtn: phone associated with subId "
                      + phone.getSubId()
                      + " is not carrier roaming ntn eligible.");
            return false;
        }
        plogd("isInCarrierRoamingNbIotNtn: carrier roaming ntn eligible for phone"
                  + " associated with subId " + phone.getSubId());
        return true;
    }

+1 −1
Original line number Diff line number Diff line
@@ -1086,7 +1086,7 @@ public class SmsDispatchersControllerTest extends TelephonyTest {

    @Test
    public void testSendSmsToDatagramDispatcher() {
        when(mSatelliteController.isInCarrierRoamingNbIotNtn()).thenReturn(true);
        when(mSatelliteController.isInCarrierRoamingNbIotNtn(any(Phone.class))).thenReturn(true);
        mSmsDispatchersController.sendText("1111", "2222", "text", mSentIntent, null, null,
                "test-app", mCallingUserId, false, 0, false, 10, false, 1L, false);
        processAllMessages();