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

Commit 4752d6c6 authored by Sooraj Sasindran's avatar Sooraj Sasindran Committed by Android (Google) Code Review
Browse files

Merge "Add additional field into sms atoms for satellite service" into 24D1-dev

parents 0e3fe4c1 e8f6b728
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -310,6 +310,7 @@ message IncomingSms {
    optional int64 message_id = 14;
    optional int32 count = 15;
    optional bool is_managed_profile = 16;
    optional bool is_ntn = 17;

    // Internal use only
    optional int32 hashCode = 10001;
@@ -334,6 +335,8 @@ message OutgoingSms {
    optional int32 send_error_code = 16;
    optional int32 network_error_code = 17;
    optional bool is_managed_profile = 18;
    optional bool is_emergency = 19;
    optional bool is_ntn = 20;

    // Internal use only
    optional int32 hashCode = 10001;
+4 −2
Original line number Diff line number Diff line
@@ -247,7 +247,8 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                        networkReasonCode,
                        tracker.mMessageId,
                        tracker.isFromDefaultSmsApplication(mContext),
                        tracker.getInterval());
                        tracker.getInterval(),
                        mTelephonyManager.isEmergencyNumber(tracker.mDestAddress));
                if (mPhone != null) {
                    TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                    if (telephonyAnalytics != null) {
@@ -664,7 +665,8 @@ public class ImsSmsDispatcher extends SMSDispatcher {
                    SmsManager.RESULT_SYSTEM_ERROR,
                    tracker.mMessageId,
                    tracker.isFromDefaultSmsApplication(mContext),
                    tracker.getInterval());
                    tracker.getInterval(),
                    mTelephonyManager.isEmergencyNumber(tracker.mDestAddress));
            if (mPhone != null) {
                TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                if (telephonyAnalytics != null) {
+10 −5
Original line number Diff line number Diff line
@@ -1063,7 +1063,8 @@ public abstract class SMSDispatcher extends Handler {
                    SmsManager.RESULT_ERROR_NONE,
                    tracker.mMessageId,
                    tracker.isFromDefaultSmsApplication(mContext),
                    tracker.getInterval());
                    tracker.getInterval(),
                    mTelephonyManager.isEmergencyNumber(tracker.mDestAddress));
            if (mPhone != null) {
                TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                if (telephonyAnalytics != null) {
@@ -1113,7 +1114,8 @@ public abstract class SMSDispatcher extends Handler {
                        getNotInServiceError(ss),
                        tracker.mMessageId,
                        tracker.isFromDefaultSmsApplication(mContext),
                        tracker.getInterval());
                        tracker.getInterval(),
                        mTelephonyManager.isEmergencyNumber(tracker.mDestAddress));
                if (mPhone != null) {
                    TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                    if (telephonyAnalytics != null) {
@@ -1149,7 +1151,8 @@ public abstract class SMSDispatcher extends Handler {
                        errorCode,
                        tracker.mMessageId,
                        tracker.isFromDefaultSmsApplication(mContext),
                        tracker.getInterval());
                        tracker.getInterval(),
                        mTelephonyManager.isEmergencyNumber(tracker.mDestAddress));
                if (mPhone != null) {
                    TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                    if (telephonyAnalytics != null) {
@@ -1175,7 +1178,8 @@ public abstract class SMSDispatcher extends Handler {
                        errorCode,
                        tracker.mMessageId,
                        tracker.isFromDefaultSmsApplication(mContext),
                        tracker.getInterval());
                        tracker.getInterval(),
                        mTelephonyManager.isEmergencyNumber(tracker.mDestAddress));
                if (mPhone != null) {
                    TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                    if (telephonyAnalytics != null) {
@@ -2403,7 +2407,8 @@ public abstract class SMSDispatcher extends Handler {
                    error,
                    trackers[0].mMessageId,
                    trackers[0].isFromDefaultSmsApplication(mContext),
                    trackers[0].getInterval());
                    trackers[0].getInterval(),
                    mTelephonyManager.isEmergencyNumber(trackers[0].mDestAddress));
            if (mPhone != null) {
                TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics();
                if (telephonyAnalytics != null) {
+5 −2
Original line number Diff line number Diff line
@@ -1052,7 +1052,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                sms.carrierId,
                sms.messageId,
                sms.count,
                sms.isManagedProfile);
                sms.isManagedProfile,
                sms.isNtn);
    }

    private static StatsEvent buildStatsEvent(OutgoingSms sms) {
@@ -1075,7 +1076,9 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback {
                sms.count,
                sms.sendErrorCode,
                sms.networkErrorCode,
                sms.isManagedProfile);
                sms.isManagedProfile,
                sms.isEmergency,
                sms.isNtn);
    }

    private static StatsEvent buildStatsEvent(DataCallSession dataCallSession) {
+23 −5
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.ServiceStateTracker;
import com.android.internal.telephony.flags.Flags;
import com.android.internal.telephony.nano.PersistAtomsProto.IncomingSms;
import com.android.internal.telephony.nano.PersistAtomsProto.OutgoingShortCodeSms;
import com.android.internal.telephony.nano.PersistAtomsProto.OutgoingSms;
@@ -157,18 +158,18 @@ public class SmsStats {
    /** Create a new atom when an outgoing SMS is sent. */
    public void onOutgoingSms(boolean isOverIms, boolean is3gpp2, boolean fallbackToCs,
            @SmsManager.Result int sendErrorCode, long messageId, boolean isFromDefaultApp,
            long intervalMillis) {
            long intervalMillis, boolean isEmergency) {
        onOutgoingSms(isOverIms, is3gpp2, fallbackToCs, sendErrorCode, NO_ERROR_CODE,
                messageId, isFromDefaultApp, intervalMillis);
                messageId, isFromDefaultApp, intervalMillis, isEmergency);
    }

    /** Create a new atom when an outgoing SMS is sent. */
    public void onOutgoingSms(boolean isOverIms, boolean is3gpp2, boolean fallbackToCs,
            @SmsManager.Result int sendErrorCode, int networkErrorCode, long messageId,
            boolean isFromDefaultApp, long intervalMillis) {
            boolean isFromDefaultApp, long intervalMillis, boolean isEmergency) {
        OutgoingSms proto =
                getOutgoingDefaultProto(is3gpp2, isOverIms, messageId, isFromDefaultApp,
                        intervalMillis);
                        intervalMillis, isEmergency);

        // The field errorCode is used for up-to-Android-13 devices. From Android 14, sendErrorCode
        // and networkErrorCode will be used. The field errorCode will be deprecated when most
@@ -234,12 +235,13 @@ public class SmsStats {
        proto.messageId = RANDOM.nextLong();
        proto.count = 1;
        proto.isManagedProfile = mPhone.isManagedProfile();
        proto.isNtn = isNonTerrestrialNetwork();
        return proto;
    }

    /** Create a proto for a normal {@code OutgoingSms} with default values. */
    private OutgoingSms getOutgoingDefaultProto(boolean is3gpp2, boolean isOverIms,
            long messageId, boolean isFromDefaultApp, long intervalMillis) {
            long messageId, boolean isFromDefaultApp, long intervalMillis, boolean isEmergency) {
        OutgoingSms proto = new OutgoingSms();
        proto.smsFormat = getSmsFormat(is3gpp2);
        proto.smsTech = getSmsTech(isOverIms, is3gpp2);
@@ -260,6 +262,8 @@ public class SmsStats {
        proto.intervalMillis = intervalMillis;
        proto.count = 1;
        proto.isManagedProfile = mPhone.isManagedProfile();
        proto.isEmergency = isEmergency;
        proto.isNtn = isNonTerrestrialNetwork();
        return proto;
    }

@@ -397,6 +401,20 @@ public class SmsStats {
        return phone.getCarrierId();
    }

    private boolean isNonTerrestrialNetwork() {
        if (!Flags.carrierEnabledSatelliteFlag()) {
            return false;
        }

        ServiceState ss = getServiceState();
        if (ss != null) {
            return ss.isUsingNonTerrestrialNetwork();
        } else {
            Rlog.e(TAG, "isNonTerrestrialNetwork(), ServiceState is null");
            return false;
        }
    }

    private void loge(String format, Object... args) {
        Rlog.e(TAG, "[" + mPhone.getPhoneId() + "]" + String.format(format, args));
    }
Loading