Loading proto/src/persist_atoms.proto +10 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ option java_outer_classname = "PersistAtomsProto"; // Holds atoms to store on persist storage in case of power cycle or process crash. // NOTE: using int64 rather than google.protobuf.Timestamp for timestamps simplifies implementation. // Next id: 50 // Next id: 53 message PersistAtoms { /* Aggregated RAT usage during the call. */ repeated VoiceCallRatUsage voice_call_rat_usage = 1; Loading Loading @@ -177,6 +177,9 @@ message PersistAtoms { /* Timestamp of last network_requests_v2 pull. */ optional int64 network_requests_v2_pull_timestamp_millis = 51; /* Unmetered networks information. */ repeated UnmeteredNetworks unmetered_networks = 52; } // The canonical versions of the following enums live in: Loading Loading @@ -498,3 +501,9 @@ message GbaEvent { optional int32 failed_reason = 4; optional int32 count = 5; } message UnmeteredNetworks { optional int32 phone_id = 1; optional int32 carrier_id = 2; optional int64 unmetered_networks_bitmask = 3; } src/java/com/android/internal/telephony/data/DataNetwork.java +4 −0 Original line number Diff line number Diff line Loading @@ -2718,6 +2718,10 @@ public class DataNetwork extends StateMachine { if (changed) { updateNetworkCapabilities(); } if (mTempNotMetered && isInternetSupported()) { // NR NSA and NR have the same network type: NR mDataCallSessionStats.onUnmeteredUpdate(networkType); } } /** Loading src/java/com/android/internal/telephony/metrics/DataCallSessionStats.java +9 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,15 @@ public class DataCallSessionStats { } } /** Stores the current unmetered network types information in permanent storage. */ public void onUnmeteredUpdate(@NetworkType int networkType) { mAtomsStorage .addUnmeteredNetworks( mPhone.getPhoneId(), mPhone.getCarrierId(), TelephonyManager.getBitMaskForNetworkType(networkType)); } /** * Take a snapshot of the on-going data call segment to add to the atom storage. * Loading src/java/com/android/internal/telephony/metrics/MetricsCollector.java +2 −1 Original line number Diff line number Diff line Loading @@ -683,7 +683,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { perSimStatus.disabled2g, // is2gDisabled perSimStatus.pin1Enabled, // isPin1Enabled perSimStatus.minimumVoltageClass, // simVoltageClass perSimStatus.userModifiedApnTypes); // userModifiedApnTypeBitmask perSimStatus.userModifiedApnTypes, // userModifiedApnTypeBitmask perSimStatus.unmeteredNetworks); // unmeteredNetworks data.add(statsEvent); result = StatsManager.PULL_SUCCESS; } Loading src/java/com/android/internal/telephony/metrics/PerSimStatus.java +11 −3 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.text.TextUtils; import com.android.internal.telephony.IccCard; import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.SubscriptionController; import com.android.internal.telephony.uicc.UiccController; import com.android.internal.telephony.uicc.UiccSlot; Loading Loading @@ -74,16 +75,20 @@ public class PerSimStatus { public final boolean pin1Enabled; public final int minimumVoltageClass; public final int userModifiedApnTypes; public final long unmeteredNetworks; /** Returns the current sim status of the given {@link Phone}. */ @Nullable public static PerSimStatus getCurrentState(Phone phone) { int[] numberIds = getNumberIds(phone); if (numberIds == null) return null; int carrierId = phone.getCarrierId(); ImsMmTelManager imsMmTelManager = getImsMmTelManager(phone); IccCard iccCard = phone.getIccCard(); PersistAtomsStorage persistAtomsStorage = PhoneFactory.getMetricsCollector().getAtomsStorage(); return new PerSimStatus( phone.getCarrierId(), carrierId, numberIds[0], numberIds[1], numberIds[2], Loading @@ -101,7 +106,8 @@ public class PerSimStatus { is2gDisabled(phone), iccCard == null ? false : iccCard.getIccLockEnabled(), getMinimumVoltageClass(phone), getUserModifiedApnTypes(phone)); getUserModifiedApnTypes(phone), persistAtomsStorage.getUnmeteredNetworks(phone.getPhoneId(), carrierId)); } private PerSimStatus( Loading @@ -119,7 +125,8 @@ public class PerSimStatus { boolean disabled2g, boolean pin1Enabled, int minimumVoltageClass, int userModifiedApnTypes) { int userModifiedApnTypes, long unmeteredNetworks) { this.carrierId = carrierId; this.phoneNumberSourceUicc = phoneNumberSourceUicc; this.phoneNumberSourceCarrier = phoneNumberSourceCarrier; Loading @@ -135,6 +142,7 @@ public class PerSimStatus { this.pin1Enabled = pin1Enabled; this.minimumVoltageClass = minimumVoltageClass; this.userModifiedApnTypes = userModifiedApnTypes; this.unmeteredNetworks = unmeteredNetworks; } @Nullable Loading Loading
proto/src/persist_atoms.proto +10 −1 Original line number Diff line number Diff line Loading @@ -23,7 +23,7 @@ option java_outer_classname = "PersistAtomsProto"; // Holds atoms to store on persist storage in case of power cycle or process crash. // NOTE: using int64 rather than google.protobuf.Timestamp for timestamps simplifies implementation. // Next id: 50 // Next id: 53 message PersistAtoms { /* Aggregated RAT usage during the call. */ repeated VoiceCallRatUsage voice_call_rat_usage = 1; Loading Loading @@ -177,6 +177,9 @@ message PersistAtoms { /* Timestamp of last network_requests_v2 pull. */ optional int64 network_requests_v2_pull_timestamp_millis = 51; /* Unmetered networks information. */ repeated UnmeteredNetworks unmetered_networks = 52; } // The canonical versions of the following enums live in: Loading Loading @@ -498,3 +501,9 @@ message GbaEvent { optional int32 failed_reason = 4; optional int32 count = 5; } message UnmeteredNetworks { optional int32 phone_id = 1; optional int32 carrier_id = 2; optional int64 unmetered_networks_bitmask = 3; }
src/java/com/android/internal/telephony/data/DataNetwork.java +4 −0 Original line number Diff line number Diff line Loading @@ -2718,6 +2718,10 @@ public class DataNetwork extends StateMachine { if (changed) { updateNetworkCapabilities(); } if (mTempNotMetered && isInternetSupported()) { // NR NSA and NR have the same network type: NR mDataCallSessionStats.onUnmeteredUpdate(networkType); } } /** Loading
src/java/com/android/internal/telephony/metrics/DataCallSessionStats.java +9 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,15 @@ public class DataCallSessionStats { } } /** Stores the current unmetered network types information in permanent storage. */ public void onUnmeteredUpdate(@NetworkType int networkType) { mAtomsStorage .addUnmeteredNetworks( mPhone.getPhoneId(), mPhone.getCarrierId(), TelephonyManager.getBitMaskForNetworkType(networkType)); } /** * Take a snapshot of the on-going data call segment to add to the atom storage. * Loading
src/java/com/android/internal/telephony/metrics/MetricsCollector.java +2 −1 Original line number Diff line number Diff line Loading @@ -683,7 +683,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { perSimStatus.disabled2g, // is2gDisabled perSimStatus.pin1Enabled, // isPin1Enabled perSimStatus.minimumVoltageClass, // simVoltageClass perSimStatus.userModifiedApnTypes); // userModifiedApnTypeBitmask perSimStatus.userModifiedApnTypes, // userModifiedApnTypeBitmask perSimStatus.unmeteredNetworks); // unmeteredNetworks data.add(statsEvent); result = StatsManager.PULL_SUCCESS; } Loading
src/java/com/android/internal/telephony/metrics/PerSimStatus.java +11 −3 Original line number Diff line number Diff line Loading @@ -44,6 +44,7 @@ import android.text.TextUtils; import com.android.internal.telephony.IccCard; import com.android.internal.telephony.Phone; import com.android.internal.telephony.PhoneFactory; import com.android.internal.telephony.SubscriptionController; import com.android.internal.telephony.uicc.UiccController; import com.android.internal.telephony.uicc.UiccSlot; Loading Loading @@ -74,16 +75,20 @@ public class PerSimStatus { public final boolean pin1Enabled; public final int minimumVoltageClass; public final int userModifiedApnTypes; public final long unmeteredNetworks; /** Returns the current sim status of the given {@link Phone}. */ @Nullable public static PerSimStatus getCurrentState(Phone phone) { int[] numberIds = getNumberIds(phone); if (numberIds == null) return null; int carrierId = phone.getCarrierId(); ImsMmTelManager imsMmTelManager = getImsMmTelManager(phone); IccCard iccCard = phone.getIccCard(); PersistAtomsStorage persistAtomsStorage = PhoneFactory.getMetricsCollector().getAtomsStorage(); return new PerSimStatus( phone.getCarrierId(), carrierId, numberIds[0], numberIds[1], numberIds[2], Loading @@ -101,7 +106,8 @@ public class PerSimStatus { is2gDisabled(phone), iccCard == null ? false : iccCard.getIccLockEnabled(), getMinimumVoltageClass(phone), getUserModifiedApnTypes(phone)); getUserModifiedApnTypes(phone), persistAtomsStorage.getUnmeteredNetworks(phone.getPhoneId(), carrierId)); } private PerSimStatus( Loading @@ -119,7 +125,8 @@ public class PerSimStatus { boolean disabled2g, boolean pin1Enabled, int minimumVoltageClass, int userModifiedApnTypes) { int userModifiedApnTypes, long unmeteredNetworks) { this.carrierId = carrierId; this.phoneNumberSourceUicc = phoneNumberSourceUicc; this.phoneNumberSourceCarrier = phoneNumberSourceCarrier; Loading @@ -135,6 +142,7 @@ public class PerSimStatus { this.pin1Enabled = pin1Enabled; this.minimumVoltageClass = minimumVoltageClass; this.userModifiedApnTypes = userModifiedApnTypes; this.unmeteredNetworks = unmeteredNetworks; } @Nullable Loading