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

Commit 6d08308c authored by Adrian Mejia's avatar Adrian Mejia
Browse files

Block incoming SMS if SMS is not supported.


Change-Id: I1c5acde9514207aba7cabceeaca9ccbd8c7f461a
BUG: 382769472
FLAG: com.android.internal.telephony.flags.carrier_roaming_nb_iot_ntn
parent 84f7a57a
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -764,6 +764,15 @@ public abstract class InboundSmsHandler extends StateMachine {
            return Intents.RESULT_SMS_HANDLED;
            return Intents.RESULT_SMS_HANDLED;
        }
        }


        if (mFeatureFlags.carrierRoamingNbIotNtn()) {
            SatelliteController satelliteController = SatelliteController.getInstance();
            if (satelliteController != null
                    && satelliteController.shouldDropSms(mPhone)) {
                log("SMS not supported during satellite session.");
                return Intents.RESULT_SMS_HANDLED;
            }
        }

        int result = dispatchMessageRadioSpecific(smsb, smsSource, token);
        int result = dispatchMessageRadioSpecific(smsb, smsSource, token);


        // In case of error, add to metrics. This is not required in case of success, as the
        // In case of error, add to metrics. This is not required in case of success, as the
+15 −0
Original line number Original line Diff line number Diff line
@@ -8279,6 +8279,21 @@ public class SatelliteController extends Handler {
        }
        }
    }
    }


    /** Returns whether to drop SMS or not. */
    public boolean shouldDropSms(@Nullable Phone phone) {
        final long identity = Binder.clearCallingIdentity();
        try {
            if (!isInCarrierRoamingNbIotNtn(phone)) {
                return false;
            }

            int[] services = getSupportedServicesOnCarrierRoamingNtn(phone.getSubId());
            return !ArrayUtils.contains(services, NetworkRegistrationInfo.SERVICE_TYPE_SMS);
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
    }

    private boolean isWaitingForSatelliteModemOff() {
    private boolean isWaitingForSatelliteModemOff() {
        synchronized (mSatelliteEnabledRequestLock) {
        synchronized (mSatelliteEnabledRequestLock) {
            return mWaitingForSatelliteModemOff;
            return mWaitingForSatelliteModemOff;