diff options
author | 2025-03-06 09:29:16 +0000 | |
---|---|---|
committer | 2025-03-07 04:02:53 +0000 | |
commit | 3ba4955779fc2c6ebbc389e30a1bfd4c25eb3a07 (patch) | |
tree | 09c01d7cefaa3775a0637fc4ec1d9bb723ce3b59 | |
parent | 52e2925d554bb2904a0808deb554e8293a0bcdb6 (diff) |
Add a new field count_of_satellite_sessions into CarrierRoamingSatelliteController atom
Added count_ofSatellite_session field expecting below effcts.
1. When count_of_sessions > 0, we can determine that the user has utilized carrier roaming satellite services.
2. By normalizing count_of_sessions, we can statistically analyze the user's satellite usage behavior.
Flag: EXEMPT bug fix
Bug: 401106561
Test: atest PersistAtomsStorageTest SatelliteStatsTest
Test: manually run Starlink service in live network and pull out the DB, then compared value is same with expected, b/401270233 #comment3
Change-Id: I192cb700856726edbd888316193366fc8766fd2d
7 files changed, 37 insertions, 1 deletions
diff --git a/proto/src/persist_atoms.proto b/proto/src/persist_atoms.proto index 730e672540..cca2435254 100644 --- a/proto/src/persist_atoms.proto +++ b/proto/src/persist_atoms.proto @@ -839,6 +839,7 @@ message CarrierRoamingSatelliteControllerStats { optional int32 carrier_id = 8; optional bool is_device_entitled = 9; optional bool is_multi_sim = 10; + optional int32 count_of_satellite_sessions = 11; } message SatelliteEntitlement { diff --git a/src/java/com/android/internal/telephony/metrics/MetricsCollector.java b/src/java/com/android/internal/telephony/metrics/MetricsCollector.java index d8cbb91434..a5df6e6d9a 100644 --- a/src/java/com/android/internal/telephony/metrics/MetricsCollector.java +++ b/src/java/com/android/internal/telephony/metrics/MetricsCollector.java @@ -1612,7 +1612,8 @@ public class MetricsCollector implements StatsManager.StatsPullAtomCallback { stats.satelliteSessionGapMaxSec, stats.carrierId, stats.isDeviceEntitled, - stats.isMultiSim); + stats.isMultiSim, + stats.countOfSatelliteSessions); } private static StatsEvent buildStatsEvent(SatelliteEntitlement stats) { diff --git a/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java b/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java index 9ac62e0386..9f6af3f7a1 100644 --- a/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java +++ b/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java @@ -886,6 +886,7 @@ public class PersistAtomsStorage { // dimension fields. existingStats.isDeviceEntitled = stats.isDeviceEntitled; existingStats.isMultiSim = stats.isMultiSim; + existingStats.countOfSatelliteSessions += stats.countOfSatelliteSessions; } else { mAtoms.carrierRoamingSatelliteControllerStats = insertAtRandomPlace( mAtoms.carrierRoamingSatelliteControllerStats, stats, mMaxNumSatelliteStats); diff --git a/src/java/com/android/internal/telephony/metrics/SatelliteStats.java b/src/java/com/android/internal/telephony/metrics/SatelliteStats.java index 9337164585..c8bdb5976f 100644 --- a/src/java/com/android/internal/telephony/metrics/SatelliteStats.java +++ b/src/java/com/android/internal/telephony/metrics/SatelliteStats.java @@ -2138,6 +2138,7 @@ public class SatelliteStats { private static int sCarrierId; private static boolean sIsDeviceEntitled; private static boolean sIsMultiSim; + private final int mCountOfSatelliteSessions; private CarrierRoamingSatelliteControllerStatsParams(Builder builder) { this.mConfigDataSource = builder.mConfigDataSource; @@ -2173,6 +2174,8 @@ public class SatelliteStats { if (builder.mIsMultiSim.isPresent()) { sIsMultiSim = builder.mIsMultiSim.get(); } + + this.mCountOfSatelliteSessions = builder.mCountOfSatelliteSessions; } public int getConfigDataSource() { @@ -2216,6 +2219,10 @@ public class SatelliteStats { return sIsMultiSim; } + public int getCountOfSatelliteSessions() { + return mCountOfSatelliteSessions; + } + /** * A builder class to create {@link CarrierRoamingSatelliteControllerStatsParams} * data structure class @@ -2231,6 +2238,7 @@ public class SatelliteStats { private Optional<Integer> mCarrierId = Optional.empty(); private Optional<Boolean> mIsDeviceEntitled = Optional.empty(); private Optional<Boolean> mIsMultiSim = Optional.empty(); + private int mCountOfSatelliteSessions = 0; /** * Sets configDataSource value of {@link CarrierRoamingSatelliteControllerStats} atom @@ -2317,6 +2325,15 @@ public class SatelliteStats { } /** + * Increase the countOfSatelliteSession value of + * {@link CarrierRoamingSatelliteControllerStats} atom by one then returns Builder class + */ + public Builder increaseCountOfSatelliteSessions() { + this.mCountOfSatelliteSessions++; + return this; + } + + /** * Returns CarrierRoamingSatelliteControllerStatsParams, which contains whole component * of {@link CarrierRoamingSatelliteControllerStats} atom */ @@ -2342,6 +2359,7 @@ public class SatelliteStats { + ", carrierId=" + sCarrierId + ", isDeviceEntitled=" + sIsDeviceEntitled + ", isMultiSim=" + sIsMultiSim + + ", countOfSatelliteSession=" + mCountOfSatelliteSessions + ")"; } } @@ -3008,6 +3026,7 @@ public class SatelliteStats { proto.carrierId = param.getCarrierId(); proto.isDeviceEntitled = param.isDeviceEntitled(); proto.isMultiSim = param.isMultiSim(); + proto.countOfSatelliteSessions = param.getCountOfSatelliteSessions(); if (DBG) logd("onCarrierRoamingSatelliteControllerStatsMetrics: " + param); mAtomsStorage.addCarrierRoamingSatelliteControllerStats(proto); } diff --git a/src/java/com/android/internal/telephony/satellite/metrics/CarrierRoamingSatelliteControllerStats.java b/src/java/com/android/internal/telephony/satellite/metrics/CarrierRoamingSatelliteControllerStats.java index 777fe7b243..8d7804551c 100644 --- a/src/java/com/android/internal/telephony/satellite/metrics/CarrierRoamingSatelliteControllerStats.java +++ b/src/java/com/android/internal/telephony/satellite/metrics/CarrierRoamingSatelliteControllerStats.java @@ -113,6 +113,10 @@ public class CarrierRoamingSatelliteControllerStats { /** Log carrier roaming satellite session start */ public void onSessionStart() { mSessionStartTimeList.add(getCurrentTime()); + mSatelliteStats.onCarrierRoamingSatelliteControllerStatsMetrics( + new SatelliteStats.CarrierRoamingSatelliteControllerStatsParams.Builder() + .increaseCountOfSatelliteSessions() + .build()); } /** Log carrier roaming satellite session end */ diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java index 9d8451e2f1..7bd82341cd 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java @@ -1394,6 +1394,7 @@ public class PersistAtomsStorageTest extends TelephonyTest { mCarrierRoamingSatelliteControllerStats1.carrierId = 1; mCarrierRoamingSatelliteControllerStats1.isDeviceEntitled = true; mCarrierRoamingSatelliteControllerStats1.isMultiSim = false; + mCarrierRoamingSatelliteControllerStats1.countOfSatelliteSessions = 1; mCarrierRoamingSatelliteControllerStats2 = new CarrierRoamingSatelliteControllerStats(); mCarrierRoamingSatelliteControllerStats2.configDataSource = @@ -1407,6 +1408,7 @@ public class PersistAtomsStorageTest extends TelephonyTest { mCarrierRoamingSatelliteControllerStats2.carrierId = 10; mCarrierRoamingSatelliteControllerStats2.isDeviceEntitled = false; mCarrierRoamingSatelliteControllerStats2.isMultiSim = true; + mCarrierRoamingSatelliteControllerStats2.countOfSatelliteSessions = 2; // CarrierRoamingSatelliteController has one data point mCarrierRoamingSatelliteControllerStats = new CarrierRoamingSatelliteControllerStats[] { @@ -5158,6 +5160,8 @@ public class PersistAtomsStorageTest extends TelephonyTest { expected.carrierId = mCarrierRoamingSatelliteControllerStats1.carrierId; expected.isDeviceEntitled = mCarrierRoamingSatelliteControllerStats1.isDeviceEntitled; expected.isMultiSim = mCarrierRoamingSatelliteControllerStats1.isMultiSim; + expected.countOfSatelliteSessions = + mCarrierRoamingSatelliteControllerStats1.countOfSatelliteSessions * 2; verifyCurrentStateSavedToFileOnce(); CarrierRoamingSatelliteControllerStats[] output = mPersistAtomsStorage.getCarrierRoamingSatelliteControllerStats(0L); @@ -6461,6 +6465,8 @@ public class PersistAtomsStorageTest extends TelephonyTest { stats.satelliteSessionGapMaxSec); assertEquals(expectedStats.isDeviceEntitled, stats.isDeviceEntitled); assertEquals(expectedStats.isMultiSim, stats.isMultiSim); + assertEquals(expectedStats.countOfSatelliteSessions, + stats.countOfSatelliteSessions); count++; } } diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/SatelliteStatsTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/SatelliteStatsTest.java index fce481ec7e..0cd5ea1b1f 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/metrics/SatelliteStatsTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/SatelliteStatsTest.java @@ -460,6 +460,7 @@ public class SatelliteStatsTest extends TelephonyTest { .setCarrierId(10) .setIsDeviceEntitled(true) .setIsMultiSim(true) + .increaseCountOfSatelliteSessions() .build(); mSatelliteStats.onCarrierRoamingSatelliteControllerStatsMetrics(param); @@ -481,6 +482,7 @@ public class SatelliteStatsTest extends TelephonyTest { assertEquals(param.getCarrierId(), stats.carrierId); assertEquals(param.isDeviceEntitled(), stats.isDeviceEntitled); assertEquals(param.isMultiSim(), stats.isMultiSim); + assertEquals(param.getCountOfSatelliteSessions(), stats.countOfSatelliteSessions); verifyNoMoreInteractions(mPersistAtomsStorage); } @@ -500,6 +502,7 @@ public class SatelliteStatsTest extends TelephonyTest { .setCarrierId(10) .setIsDeviceEntitled(true) .setIsMultiSim(true) + .increaseCountOfSatelliteSessions() .build(); mSatelliteStats.onCarrierRoamingSatelliteControllerStatsMetrics(param); @@ -545,6 +548,7 @@ public class SatelliteStatsTest extends TelephonyTest { assertEquals(20, stats.carrierId); assertEquals(false, stats.isDeviceEntitled); assertEquals(param.isMultiSim(), stats.isMultiSim); + assertEquals(param.getCountOfSatelliteSessions(), stats.countOfSatelliteSessions); verifyNoMoreInteractions(mPersistAtomsStorage); } |