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

Commit 0ef1ea57 authored by Xin Li's avatar Xin Li
Browse files

Merge 25Q1 (ab/BP1A.250305.020) to aosp-main-future

Bug: 385190204
Merged-In: Ibe6d50a1768515bc70d8795d148270bf4ae55fb7
Change-Id: I19a57f680bd2121a8ab5f65a1236e7c733a75a99
parents 127a0ecf 1340da9f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -723,6 +723,9 @@ message SatelliteController {
    optional int32 count_of_satellite_allowed_state_changed_events = 31;
    optional int32 count_of_successful_location_queries = 32;
    optional int32 count_of_failed_location_queries = 33;
    optional int32 count_of_p2p_sms_available_notification_shown = 34;
    optional int32 count_of_p2p_sms_available_notification_removed = 35;
    optional bool is_ntn_only_carrier = 36;
}

message SatelliteSession {
@@ -743,6 +746,9 @@ message SatelliteSession {
    optional int32 count_of_satellite_notification_displayed = 15;
    optional int32 count_of_auto_exit_due_to_screen_off = 16;
    optional int32 count_of_auto_exit_due_to_tn_network = 17;
    optional bool is_emergency = 18;
    optional bool is_ntn_only_carrier = 19;
    optional int32 max_inactivity_duration_sec = 20;
}

message SatelliteIncomingDatagram {
@@ -751,6 +757,7 @@ message SatelliteIncomingDatagram {
    optional int64 datagram_transfer_time_millis = 3;
    optional bool is_demo_mode = 4;
    optional int32 carrier_id = 5;
    optional bool is_ntn_only_carrier = 6;
}

message SatelliteOutgoingDatagram {
@@ -760,6 +767,7 @@ message SatelliteOutgoingDatagram {
    optional int64 datagram_transfer_time_millis = 4;
    optional bool is_demo_mode = 5;
    optional int32 carrier_id = 6;
    optional bool is_ntn_only_carrier = 7;
}

message SatelliteProvision {
@@ -768,6 +776,7 @@ message SatelliteProvision {
    optional bool is_provision_request = 3;
    optional bool is_canceled = 4;
    optional int32 carrier_id = 5;
    optional bool is_ntn_only_carrier = 6;
}

message SatelliteSosMessageRecommender {
@@ -781,6 +790,7 @@ message SatelliteSosMessageRecommender {
    optional bool is_satellite_allowed_in_current_location = 8;
    optional bool is_wifi_connected = 9;
    optional int32 carrier_id = 10;
    optional bool is_ntn_only_carrier = 11;
}

message DataNetworkValidation {
@@ -851,4 +861,5 @@ message SatelliteAccessController {
    optional int32 config_data_source = 9;
    optional int32 carrier_id = 10;
    optional int32 triggering_event = 11;
    optional bool is_ntn_only_carrier = 12;
}
+24 −13
Original line number Diff line number Diff line
@@ -115,6 +115,13 @@ public class DisplayInfoController extends Handler {
        // EVENT_UPDATE will transition from DefaultState to the current state
        // and update the TelephonyDisplayInfo based on the current state.
        mNetworkTypeController.sendMessage(NetworkTypeController.EVENT_UPDATE);

        // To Support Satellite bandwidth constrained data capability status at telephony
        // display info
        if (mFeatureFlags.carrierEnabledSatelliteFlag()) {
            log("register for satellite network callback");
            mNetworkTypeController.registerForSatelliteNetwork();
        }
    }

    /**
@@ -129,11 +136,12 @@ public class DisplayInfoController extends Handler {
     * NetworkTypeController.
     */
    public void updateTelephonyDisplayInfo() {
        if (mNetworkTypeController != null && mServiceState != null) {
            TelephonyDisplayInfo newDisplayInfo = new TelephonyDisplayInfo(
                    mNetworkTypeController.getDataNetworkType(),
                    mNetworkTypeController.getOverrideNetworkType(),
                    isRoaming(),
                mPhone.getServiceStateTracker().getServiceState().isUsingNonTerrestrialNetwork(),
                    mServiceState.isUsingNonTerrestrialNetwork(),
                    mNetworkTypeController.getSatelliteConstrainedData());
            if (!newDisplayInfo.equals(mTelephonyDisplayInfo)) {
                logl("TelephonyDisplayInfo changed from " + mTelephonyDisplayInfo + " to "
@@ -143,6 +151,9 @@ public class DisplayInfoController extends Handler {
                mTelephonyDisplayInfoChangedRegistrants.notifyRegistrants();
                mPhone.notifyDisplayInfoChanged(mTelephonyDisplayInfo);
            }
        } else {
            loge("Found null object");
        }
    }

    /**
+0 −4
Original line number Diff line number Diff line
@@ -338,10 +338,6 @@ public class NetworkTypeController extends StateMachine {
        mServiceState = mPhone.getServiceStateTracker().getServiceState();
        mPhysicalChannelConfigs = mPhone.getServiceStateTracker().getPhysicalChannelConfigList();

        if(mFeatureFlags.carrierEnabledSatelliteFlag()) {
            registerForSatelliteNetwork();
        }

        sendMessage(EVENT_INITIALIZE);
    }

+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
         */
+154 −2
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ import android.telephony.SubscriptionManager.OnSubscriptionsChangedListener;
import android.telephony.TelephonyManager;
import android.telephony.VoiceSpecificRegistrationInfo;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.satellite.ISatelliteModemStateCallback;
import android.telephony.satellite.SatelliteManager;
import android.text.TextUtils;
import android.util.EventLog;
import android.util.LocalLog;
@@ -619,6 +621,83 @@ public class ServiceStateTracker extends Handler {
     */
    private AccessNetworksManagerCallback mAccessNetworksManagerCallback = null;

    /**
     * Listens status of nb iot satellite modem.
     */
    private SatelliteModemStateListener mSatelliteModemStateListener = null;

    /**
     * SatelliteModemStateListener class
     */
    protected class SatelliteModemStateListener extends ISatelliteModemStateCallback.Stub {

        /**
         * Satellite Modem Connection Status. True when satellite is connected
         */
        private boolean mSatelliteNbIotConnected = false;

        /**
         * Marks the satellite display change as true.
         */
        private boolean mUpdateSatelliteCarrierDisplay = false;

        @Override
        public void onSatelliteModemStateChanged(int state) {
            boolean isConnected = isInConnectedState();
            if (isConnected != mSatelliteNbIotConnected) {
                log("Satellite connection state is changed to " + isConnected);
                mSatelliteNbIotConnected = isConnected;
                mUpdateSatelliteCarrierDisplay = true;
                // trigger pollStats() because the service state is already OOO in demo mode.
                pollState();
            }
        }

        @Override
        public void onEmergencyModeChanged(boolean isEmergency) {}

        @Override
        public void onRegistrationFailure(int causeCode) {}

        @Override
        public void onTerrestrialNetworkAvailableChanged(boolean isAvailable) {}

        /**
         * Returns true when statellite is connected.
         *
         * Note that this connection state is only applicable carrier roaming nb iot satellite.
         */
        public boolean isInConnectedState() {
            SatelliteController sc = SatelliteController.getInstance();
            if (sc == null) {
                return false;
            }
            int subId = sc.getSelectedSatelliteSubId();
            if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID
                    || subId != mPhone.getSubId()
                    || subId == sc.getNtnOnlySubscriptionId()) {
                return false;
            }
            return sc.isInConnectedState();
        }

        /**
         * Returns true if the satellite connection has changed and the satellite display needs
         * to be updated.
         */
        public boolean needToUpdateSatelliteCarrierDisplay() {
            return mUpdateSatelliteCarrierDisplay;
        }

        /**
         * The satellite carrier display update is complete and is marked to not be updated any
         * further.
         */
        public void doneForUpdateSatelliteCarrierDisplay() {
            mUpdateSatelliteCarrierDisplay = false;
        }
    }

    public ServiceStateTracker(GsmCdmaPhone phone, CommandsInterface ci,
            FeatureFlags featureFlags) {
        mNitzState = TelephonyComponentFactory.getInstance()
@@ -2912,6 +2991,14 @@ public class ServiceStateTracker extends Handler {
            crossSimSpnFormat = crossSimSpnFormats[crossSimSpnFormatIdx];
        }

        String satellitePlmn = null;
        SatelliteModemStateListener satelliteModemStateListener = getSatelliteModemStateListener();
        if (satelliteModemStateListener != null
                && satelliteModemStateListener.isInConnectedState()) {
            satellitePlmn = getSatelliteDisplayName();
        }
        log("updateCarrierDisplayName: satellitePlmn=" + satellitePlmn);

        if (mPhone.isPhoneTypeGsm()) {
            // The values of plmn/showPlmn change in different scenarios.
            // 1) No service but emergency call allowed -> expected
@@ -2981,7 +3068,12 @@ public class ServiceStateTracker extends Handler {
                    && ((rule & CARRIER_NAME_DISPLAY_BITMASK_SHOW_SPN)
                    == CARRIER_NAME_DISPLAY_BITMASK_SHOW_SPN);
            if (DBG) log("updateCarrierDisplayName: rawSpn = " + spn);
            if (!TextUtils.isEmpty(crossSimSpnFormat)) {
            if (!TextUtils.isEmpty(satellitePlmn)) {
                plmn = satellitePlmn;
                showPlmn = true;
                showSpn = false;
                log("updateCarrierDisplayName: Update satellite network name:" + plmn);
            } else if (!TextUtils.isEmpty(crossSimSpnFormat)) {
                if (!TextUtils.isEmpty(spn)) {
                    // Show SPN + Cross-SIM Calling If SIM has SPN and SPN display condition
                    // is satisfied or SPN override is enabled for this carrier.
@@ -3077,6 +3169,52 @@ public class ServiceStateTracker extends Handler {
                .build();
    }

    private void updateSatelliteDisplayOverride() {
        String satelliteDisplayName = getSatelliteDisplayName();
        if (TextUtils.isEmpty(satelliteDisplayName)) {
            // Return, if there is no value to override.
            return;
        }

        SatelliteModemStateListener satelliteModemStateListener = getSatelliteModemStateListener();
        String operator = mNewSS.getOperatorAlphaLong();
        SatelliteController sc = SatelliteController.getInstance();
        // Override satellite display name if device is in carrier roaming nb iot ntn mode
        // and has a valid operator
        if (satelliteModemStateListener != null
                && satelliteModemStateListener.isInConnectedState()
                || (!TextUtils.isEmpty(operator)
                        && sc != null && sc.isInCarrierRoamingNbIotNtn())) {
            // override satellite display name
            mNewSS.setOperatorName(
                    satelliteDisplayName, satelliteDisplayName, mNewSS.getOperatorNumeric());
            log("Override satellite display name to " + satelliteDisplayName);
        }
    }

    @Nullable
    private SatelliteModemStateListener getSatelliteModemStateListener() {
        if (mSatelliteModemStateListener != null) {
            return mSatelliteModemStateListener;
        }

        SatelliteController sc = SatelliteController.getInstance();
        if (sc != null) {
            SatelliteModemStateListener listener = new SatelliteModemStateListener();
            if (sc.registerForSatelliteModemStateChanged(listener)
                    == SatelliteManager.SATELLITE_RESULT_SUCCESS) {
                mSatelliteModemStateListener = listener;
                log("created SatelliteModemStateListener");
            }
        }
        return mSatelliteModemStateListener;
    }

    private String getSatelliteDisplayName() {
        return mCarrierConfig.getString(
                        CarrierConfigManager.KEY_SATELLITE_DISPLAY_NAME_STRING);
    }

    /**
     * Returns whether out-of-service will be displayed as "no service" to the user.
     */
@@ -3431,6 +3569,19 @@ public class ServiceStateTracker extends Handler {
                NetworkRegistrationInfo.DOMAIN_PS, AccessNetworkConstants.TRANSPORT_TYPE_WWAN);
        setPhyCellInfoFromCellIdentity(mNewSS, networkRegState.getCellIdentity());

        boolean hasSatelliteConnectionChanged = false;
        SatelliteModemStateListener satelliteModemStateListener = getSatelliteModemStateListener();
        if (satelliteModemStateListener != null) {
            hasSatelliteConnectionChanged =
                    satelliteModemStateListener.needToUpdateSatelliteCarrierDisplay();
            if (hasSatelliteConnectionChanged) {
                log("Poll ServiceState done : hasSatelliteConnectionChanged="
                        + hasSatelliteConnectionChanged);
                satelliteModemStateListener.doneForUpdateSatelliteCarrierDisplay();
                updateSatelliteDisplayOverride();
            }
        }

        if (DBG) {
            log("Poll ServiceState done: oldSS=" + mSS);
            log("Poll ServiceState done: newSS=" + mNewSS);
@@ -3700,7 +3851,8 @@ public class ServiceStateTracker extends Handler {
        // Trigger updateCarrierDisplayName when
        // 1. Service state is changed.
        // 2. phone type is Cdma or CdmaLte and ERI text has changed.
        if (hasChanged || (!mPhone.isPhoneTypeGsm() && hasEriChanged)) {
        if (hasChanged || (!mPhone.isPhoneTypeGsm() && hasEriChanged)
                || hasSatelliteConnectionChanged) {
            updateCarrierDisplayName();
        }

Loading