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

Commit 2f27354e authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Block incoming SMS if SMS is not supported." into main

parents 68e3d4be 6d08308c
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -764,6 +764,15 @@ public abstract class InboundSmsHandler extends StateMachine {
            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);

        // In case of error, add to metrics. This is not required in case of success, as the
+15 −0
Original line number 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() {
        synchronized (mSatelliteEnabledRequestLock) {
            return mWaitingForSatelliteModemOff;