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

Commit dda14f90 authored by Thomas Nguyen's avatar Thomas Nguyen Committed by Android (Google) Code Review
Browse files

Merge "Check isInCarrierRoamingNbIotNtn for the phone associated with...

Merge "Check isInCarrierRoamingNbIotNtn for the phone associated with SmsDispatchersController object" into main
parents 787b0c5f 19cb2a62
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
@@ -3546,7 +3546,7 @@ public class SatelliteController extends Handler {
            return false;
        }

        if (!isSatelliteEnabledOrBeingEnabled()) {
        if (!isSatelliteEnabled()) {
            plogd("iisInCarrierRoamingNbIotNtn: satellite is disabled");
            return false;
        }
@@ -3556,7 +3556,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();