Loading proto/src/persist_atoms.proto +1 −0 Original line number Diff line number Diff line Loading @@ -381,6 +381,7 @@ message OutgoingSms { optional bool is_ntn = 20; optional bool is_mt_sms_polling = 21; optional bool is_nb_iot_ntn = 22; optional int32 pdu_length = 23; // Internal use only optional int32 hashCode = 10001; Loading src/java/com/android/internal/telephony/ImsSmsDispatcher.java +4 −2 Original line number Diff line number Diff line Loading @@ -249,7 +249,8 @@ public class ImsSmsDispatcher extends SMSDispatcher { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -668,7 +669,8 @@ public class ImsSmsDispatcher extends SMSDispatcher { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading src/java/com/android/internal/telephony/SMSDispatcher.java +28 −5 Original line number Diff line number Diff line Loading @@ -1144,7 +1144,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -1206,7 +1207,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -1244,7 +1246,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -1272,7 +1275,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -2544,7 +2548,8 @@ public abstract class SMSDispatcher extends Handler { trackers[0].isFromDefaultSmsApplication(mContext), trackers[0].getInterval(), mTelephonyManager.isEmergencyNumber(trackers[0].mDestAddress), trackers[0].isMtSmsPollingMessage(mContext)); trackers[0].isMtSmsPollingMessage(mContext), trackers[0].getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -2745,6 +2750,24 @@ public abstract class SMSDispatcher extends Handler { return mFullMessageText.equals(mtSmsPollingText); } /** * Returns the length of the PDU in bytes for this tracker, if available. * This value is expected to be populated in the {@code mData} map during tracker creation * after the PDU has been generated. * * @return The PDU length in bytes, or 0 if the length is not available or invalid. */ public int getPduLength() { if (mData == null) { return 0; } byte[] encodedPdu = (byte[]) mData.get(MAP_KEY_PDU); if (encodedPdu == null) { return 0; } return encodedPdu.length; } /** * Update the status of this message if we persisted it */ Loading src/java/com/android/internal/telephony/metrics/MetricsCollector.java +2 −1 Original line number Diff line number Diff line Loading @@ -1203,7 +1203,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { sms.isEmergency, sms.isNtn, sms.isMtSmsPolling, sms.isNbIotNtn); sms.isNbIotNtn, sms.pduLength); } private static StatsEvent buildStatsEvent(DataCallSession dataCallSession) { Loading src/java/com/android/internal/telephony/metrics/SmsStats.java +9 −6 Original line number Diff line number Diff line Loading @@ -160,19 +160,20 @@ 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, boolean isEmergency, boolean isMtSmsPolling) { long intervalMillis, boolean isEmergency, boolean isMtSmsPolling, int pduLength) { onOutgoingSms(isOverIms, is3gpp2, fallbackToCs, sendErrorCode, NO_ERROR_CODE, messageId, isFromDefaultApp, intervalMillis, isEmergency, isMtSmsPolling); messageId, isFromDefaultApp, intervalMillis, isEmergency, isMtSmsPolling, pduLength); } /** 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 isEmergency, boolean isMtSmsPolling) { boolean isMtSmsPolling, int pduLength) { OutgoingSms proto = getOutgoingDefaultProto(is3gpp2, isOverIms, messageId, isFromDefaultApp, intervalMillis, isEmergency, isMtSmsPolling); intervalMillis, isEmergency, isMtSmsPolling, pduLength); // 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 Loading Loading @@ -250,7 +251,7 @@ public class SmsStats { /** Create a proto for a normal {@code OutgoingSms} with default values. */ private OutgoingSms getOutgoingDefaultProto(boolean is3gpp2, boolean isOverIms, long messageId, boolean isFromDefaultApp, long intervalMillis, boolean isEmergency, boolean isMtSmsPolling) { boolean isMtSmsPolling, int pduLength) { OutgoingSms proto = new OutgoingSms(); proto.smsFormat = getSmsFormat(is3gpp2); proto.smsTech = getSmsTech(isOverIms, is3gpp2); Loading @@ -275,6 +276,7 @@ public class SmsStats { proto.isNtn = isNonTerrestrialNetwork(); proto.isMtSmsPolling = isMtSmsPolling; proto.isNbIotNtn = isNbIotNtn(mPhone); proto.pduLength = pduLength; return proto; } Loading Loading @@ -348,7 +350,8 @@ public class SmsStats { static int getSmsHashCode(OutgoingSms sms) { return Objects.hash(sms.smsFormat, sms.smsTech, sms.rat, sms.sendResult, sms.errorCode, sms.isRoaming, sms.isFromDefaultApp, sms.simSlotIndex, sms.isMultiSim, sms.isEsim, sms.carrierId, sms.isEmergency, sms.isNtn, sms.isMtSmsPolling, sms.isNbIotNtn); sms.carrierId, sms.isEmergency, sms.isNtn, sms.isMtSmsPolling, sms.isNbIotNtn, sms.pduLength); } /** Loading Loading
proto/src/persist_atoms.proto +1 −0 Original line number Diff line number Diff line Loading @@ -381,6 +381,7 @@ message OutgoingSms { optional bool is_ntn = 20; optional bool is_mt_sms_polling = 21; optional bool is_nb_iot_ntn = 22; optional int32 pdu_length = 23; // Internal use only optional int32 hashCode = 10001; Loading
src/java/com/android/internal/telephony/ImsSmsDispatcher.java +4 −2 Original line number Diff line number Diff line Loading @@ -249,7 +249,8 @@ public class ImsSmsDispatcher extends SMSDispatcher { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -668,7 +669,8 @@ public class ImsSmsDispatcher extends SMSDispatcher { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading
src/java/com/android/internal/telephony/SMSDispatcher.java +28 −5 Original line number Diff line number Diff line Loading @@ -1144,7 +1144,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -1206,7 +1207,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -1244,7 +1246,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -1272,7 +1275,8 @@ public abstract class SMSDispatcher extends Handler { tracker.isFromDefaultSmsApplication(mContext), tracker.getInterval(), mTelephonyManager.isEmergencyNumber(tracker.mDestAddress), tracker.isMtSmsPollingMessage(mContext)); tracker.isMtSmsPollingMessage(mContext), tracker.getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -2544,7 +2548,8 @@ public abstract class SMSDispatcher extends Handler { trackers[0].isFromDefaultSmsApplication(mContext), trackers[0].getInterval(), mTelephonyManager.isEmergencyNumber(trackers[0].mDestAddress), trackers[0].isMtSmsPollingMessage(mContext)); trackers[0].isMtSmsPollingMessage(mContext), trackers[0].getPduLength()); if (mPhone != null) { TelephonyAnalytics telephonyAnalytics = mPhone.getTelephonyAnalytics(); if (telephonyAnalytics != null) { Loading Loading @@ -2745,6 +2750,24 @@ public abstract class SMSDispatcher extends Handler { return mFullMessageText.equals(mtSmsPollingText); } /** * Returns the length of the PDU in bytes for this tracker, if available. * This value is expected to be populated in the {@code mData} map during tracker creation * after the PDU has been generated. * * @return The PDU length in bytes, or 0 if the length is not available or invalid. */ public int getPduLength() { if (mData == null) { return 0; } byte[] encodedPdu = (byte[]) mData.get(MAP_KEY_PDU); if (encodedPdu == null) { return 0; } return encodedPdu.length; } /** * Update the status of this message if we persisted it */ Loading
src/java/com/android/internal/telephony/metrics/MetricsCollector.java +2 −1 Original line number Diff line number Diff line Loading @@ -1203,7 +1203,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { sms.isEmergency, sms.isNtn, sms.isMtSmsPolling, sms.isNbIotNtn); sms.isNbIotNtn, sms.pduLength); } private static StatsEvent buildStatsEvent(DataCallSession dataCallSession) { Loading
src/java/com/android/internal/telephony/metrics/SmsStats.java +9 −6 Original line number Diff line number Diff line Loading @@ -160,19 +160,20 @@ 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, boolean isEmergency, boolean isMtSmsPolling) { long intervalMillis, boolean isEmergency, boolean isMtSmsPolling, int pduLength) { onOutgoingSms(isOverIms, is3gpp2, fallbackToCs, sendErrorCode, NO_ERROR_CODE, messageId, isFromDefaultApp, intervalMillis, isEmergency, isMtSmsPolling); messageId, isFromDefaultApp, intervalMillis, isEmergency, isMtSmsPolling, pduLength); } /** 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 isEmergency, boolean isMtSmsPolling) { boolean isMtSmsPolling, int pduLength) { OutgoingSms proto = getOutgoingDefaultProto(is3gpp2, isOverIms, messageId, isFromDefaultApp, intervalMillis, isEmergency, isMtSmsPolling); intervalMillis, isEmergency, isMtSmsPolling, pduLength); // 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 Loading Loading @@ -250,7 +251,7 @@ public class SmsStats { /** Create a proto for a normal {@code OutgoingSms} with default values. */ private OutgoingSms getOutgoingDefaultProto(boolean is3gpp2, boolean isOverIms, long messageId, boolean isFromDefaultApp, long intervalMillis, boolean isEmergency, boolean isMtSmsPolling) { boolean isMtSmsPolling, int pduLength) { OutgoingSms proto = new OutgoingSms(); proto.smsFormat = getSmsFormat(is3gpp2); proto.smsTech = getSmsTech(isOverIms, is3gpp2); Loading @@ -275,6 +276,7 @@ public class SmsStats { proto.isNtn = isNonTerrestrialNetwork(); proto.isMtSmsPolling = isMtSmsPolling; proto.isNbIotNtn = isNbIotNtn(mPhone); proto.pduLength = pduLength; return proto; } Loading Loading @@ -348,7 +350,8 @@ public class SmsStats { static int getSmsHashCode(OutgoingSms sms) { return Objects.hash(sms.smsFormat, sms.smsTech, sms.rat, sms.sendResult, sms.errorCode, sms.isRoaming, sms.isFromDefaultApp, sms.simSlotIndex, sms.isMultiSim, sms.isEsim, sms.carrierId, sms.isEmergency, sms.isNtn, sms.isMtSmsPolling, sms.isNbIotNtn); sms.carrierId, sms.isEmergency, sms.isNtn, sms.isMtSmsPolling, sms.isNbIotNtn, sms.pduLength); } /** Loading