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

Commit b27a58ef authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30996379',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/30996379', 'googleplex-android-review.googlesource.com/31042170', 'googleplex-android-review.googlesource.com/31035581'] into 25Q1-release.

Change-Id: I5448c3c77cc865c0f49c660137654cb895ec4743
parents e37a4725 5f0c77d1
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -2626,7 +2626,7 @@ public abstract class SMSDispatcher extends Handler {
        }

        @VisibleForTesting
        public SmsTracker(String destAddr, long messageId) {
        public SmsTracker(String destAddr, long messageId, String messageText) {
            mData = null;
            mSentIntent = null;
            mDeliveryIntent = null;
@@ -2643,6 +2643,7 @@ public abstract class SMSDispatcher extends Handler {
            mSkipShortCodeDestAddrCheck = false;
            mUniqueMessageId = 0;
            mResultCodeFromCarrierMessagingService = CarrierMessagingService.SEND_STATUS_OK;
            mFullMessageText = messageText;
        }

        public HashMap<String, Object> getData() {
@@ -2682,6 +2683,22 @@ public abstract class SMSDispatcher extends Handler {
            return mIsFromDefaultSmsApplication;
        }

        /**
         * Check if the message is a MT SMS polling message.
         *
         * @param context The Context
         * @return true if the message is a MT SMS polling message, false otherwise.
         */
        public boolean isMtSmsPollingMessage(Context context) {
            if (mFullMessageText == null) {
                return false;
            }

            String mtSmsPollingText =
                    context.getResources().getString(R.string.config_mt_sms_polling_text);
            return mFullMessageText.equals(mtSmsPollingText);
        }

        /**
         * Update the status of this message if we persisted it
         */
+7 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.os.Build;
import android.os.Message;
import android.telephony.ServiceState;

import com.android.internal.R;
import com.android.internal.telephony.GsmAlphabet.TextEncodingDetails;
import com.android.internal.telephony.InboundSmsHandler;
import com.android.internal.telephony.Phone;
@@ -165,8 +166,13 @@ public final class GsmSMSDispatcher extends SMSDispatcher {
                + " SS=" + ss
                + " " + SmsController.formatCrossStackMessageId(tracker.mMessageId));

        boolean allowCheckMessageInNotConnected =
                mContext.getResources()
                        .getBoolean(R.bool.config_satellite_allow_check_message_in_not_connected);
        boolean mtPollingMessageThatsAllowedInOOS =
                tracker.isMtSmsPollingMessage(mContext) && allowCheckMessageInNotConnected;
        // if sms over IMS is not supported on data and voice is not available...
        if (!isIms() && ss != ServiceState.STATE_IN_SERVICE) {
        if (!isIms() && ss != ServiceState.STATE_IN_SERVICE && !mtPollingMessageThatsAllowedInOOS) {
        //In 5G case only Data Rat is reported.
            if(mPhone.getServiceState().getRilDataRadioTechnology()
                    != ServiceState.RIL_RADIO_TECHNOLOGY_NR) {
+18 −1
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ public class DatagramDispatcher extends Handler {
    private boolean mShouldPollMtSms = false;
    @GuardedBy("mLock")
    private boolean mIsMtSmsPollingThrottled = false;
    @GuardedBy("mLock")
    private int mConnectedStateCounter = 0;

    /**
     * Create the DatagramDispatcher singleton instance.
@@ -806,6 +808,12 @@ public class DatagramDispatcher extends Handler {

            if (state == SATELLITE_MODEM_STATE_CONNECTED) {
                mHasEnteredConnectedState = true;

                mConnectedStateCounter++;
                if (isFirstConnected()) {
                    mShouldPollMtSms = shouldPollMtSms();
                }

                if (isDatagramWaitForConnectedStateTimerStarted()) {
                    stopDatagramWaitForConnectedStateTimer();
                    sendPendingMessages();
@@ -825,6 +833,11 @@ public class DatagramDispatcher extends Handler {
        }
    }

    /** Returns true if this is the first time the satellite modem is connected. */
    private boolean isFirstConnected() {
        return mConnectedStateCounter == 1;
    }

    @GuardedBy("mLock")
    private void cleanUpResources() {
        plogd("cleanUpResources");
@@ -856,6 +869,7 @@ public class DatagramDispatcher extends Handler {
        mModemState = SATELLITE_MODEM_STATE_UNKNOWN;
        mHasEnteredConnectedState = false;
        mShouldPollMtSms = false;
        mConnectedStateCounter = 0;
        stopMtSmsPollingThrottle();
    }

@@ -1254,6 +1268,7 @@ public class DatagramDispatcher extends Handler {
                        getPendingMessagesCount(), SATELLITE_RESULT_SUCCESS);
                if (datagramType == DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS) {
                    startMtSmsPollingThrottle();
                    mShouldPollMtSms = false;
                }
            } else {
                // Update send status
@@ -1295,7 +1310,9 @@ public class DatagramDispatcher extends Handler {
        }

        plogd("sendMtSmsPollingMessage");
        if (!allowCheckMessageInNotConnected()) {
            mShouldPollMtSms = false;
        }

        for (Entry<Long, PendingRequest> entry : mPendingSmsMap.entrySet()) {
            PendingRequest pendingRequest = entry.getValue();
+42 −14
Original line number Diff line number Diff line
@@ -875,8 +875,7 @@ public class SatelliteSessionController extends StateMachine {

            //Enable Cellular Modem scanning
            boolean configSatelliteAllowTnScanningDuringSatelliteSession =
                    mContext.getResources().getBoolean(
                        R.bool.config_satellite_allow_tn_scanning_during_satellite_session);
                    isTnScanningAllowedDuringSatelliteSession();
            if (configSatelliteAllowTnScanningDuringSatelliteSession) {
                Message onCompleted =
                    obtainMessage(EVENT_ENABLE_CELLULAR_MODEM_WHILE_SATELLITE_MODE_IS_ON_DONE);
@@ -1217,12 +1216,7 @@ public class SatelliteSessionController extends StateMachine {
                    }
                    break;
                case EVENT_P2P_SMS_INACTIVITY_TIMER_TIMED_OUT:
                    if (isEsosInActivityTimerStarted()) {
                        plogd("NotConnectedState: processing: ESOS inactivity timer running "
                                + "can not move to IDLE");
                    } else {
                        transitionTo(mIdleState);
                    }
                    handleEventP2pSmsInactivityTimerTimedOut();
                    break;
                case EVENT_NB_IOT_INACTIVITY_TIMER_TIMED_OUT:
                    transitionTo(mIdleState);
@@ -1345,12 +1339,7 @@ public class SatelliteSessionController extends StateMachine {
                    }
                    break;
                case EVENT_P2P_SMS_INACTIVITY_TIMER_TIMED_OUT:
                    if (isEsosInActivityTimerStarted()) {
                        plogd("ConnectedState: processing: ESOS inactivity timer running "
                                + "can not move to IDLE");
                    } else {
                        transitionTo(mIdleState);
                    }
                    handleEventP2pSmsInactivityTimerTimedOut();
                    break;
            }
            // Ignore all unexpected events.
@@ -1690,6 +1679,35 @@ public class SatelliteSessionController extends StateMachine {
        }
    }

    private void handleEventP2pSmsInactivityTimerTimedOut() {
        if (isEsosInActivityTimerStarted()) {
            plogd("handleEventP2pSmsInactivityTimerTimedOut: processing: ESOS inactivity timer "
                    + "running can not move to IDLE");
        } else {
            if (isTnScanningAllowedDuringSatelliteSession()) {
                plogd("handleEventP2pSmsInactivityTimerTimedOut: Transition to IDLE state");
                transitionTo(mIdleState);
            } else {
                if (mSatelliteController.getRequestIsEmergency()) {
                    plogd("handleEventP2pSmsInactivityTimerTimedOut: Emergency mode");
                    return;
                }

                plogd("handleEventP2pSmsInactivityTimerTimedOut: request disable satellite");
                mSatelliteController.requestSatelliteEnabled(
                        false /*enableSatellite*/,
                        false /*enableDemoMode*/,
                        mSatelliteController.getRequestIsEmergency() /*isEmergency*/,
                        new IIntegerConsumer.Stub() {
                            @Override
                            public void accept(int result) {
                                plogd("requestSatelliteEnabled result=" + result);
                            }
                        });
            }
        }
    }

    private int getScreenOffInactivityTimeoutDurationSec() {
        PersistableBundle config = mSatelliteController.getPersistableBundle(getSubId());

@@ -1963,6 +1981,16 @@ public class SatelliteSessionController extends StateMachine {
        }
    }

    private boolean isTnScanningAllowedDuringSatelliteSession() {
        try {
            return mContext.getResources().getBoolean(
                    R.bool.config_satellite_allow_tn_scanning_during_satellite_session);
        } catch (RuntimeException e) {
            plogd("isTnScanningAllowedDuringSatelliteSession: ex=" + e);
            return false;
        }
    }

    private void plogd(@NonNull String log) {
        logd(log);
        if (mPersistentLogger != null) {
+1 −1
Original line number Diff line number Diff line
@@ -132,7 +132,7 @@ public class SmsDispatchersControllerTest extends TelephonyTest {
        }

        private SMSDispatcher.SmsTracker getSmsTracker(String destAddr, long messageId) {
            return new SMSDispatcher.SmsTracker(destAddr, messageId);
            return new SMSDispatcher.SmsTracker(destAddr, messageId, "testMessage");
        }
    }

Loading