Loading src/java/com/android/internal/telephony/metrics/SatelliteStats.java +2 −0 Original line number Diff line number Diff line Loading @@ -2053,6 +2053,7 @@ public class SatelliteStats { */ public Builder setSupportedSatelliteServices(int[] supportedSatelliteServices) { this.mSupportedSatelliteServices = supportedSatelliteServices; Arrays.sort(this.mSupportedSatelliteServices); return this; } Loading Loading @@ -2495,6 +2496,7 @@ public class SatelliteStats { */ public Builder setEntitlementServiceType(int[] entitlementServiceType) { this.mEntitlementServiceType = entitlementServiceType; Arrays.sort(this.mEntitlementServiceType); return this; } Loading tests/telephonytests/src/com/android/internal/telephony/metrics/SatelliteStatsTest.java +35 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import java.util.Arrays; import java.util.concurrent.TimeUnit; public class SatelliteStatsTest extends TelephonyTest { Loading Loading @@ -636,4 +637,38 @@ public class SatelliteStatsTest extends TelephonyTest { assertEquals(param.getConfigDataSource(), stats.configDataSource); verifyNoMoreInteractions(mPersistAtomsStorage); } @Test public void testReportRepeatedDataWithAscendingOrder() { int[] supportedSatelliteServicesArray = {3, 2, 1}; SatelliteStats.CarrierRoamingSatelliteSessionParams sessionParams = new SatelliteStats.CarrierRoamingSatelliteSessionParams.Builder() .setSupportedSatelliteServices(supportedSatelliteServicesArray) .build(); mSatelliteStats.onCarrierRoamingSatelliteSessionMetrics(sessionParams); ArgumentCaptor<CarrierRoamingSatelliteSession> sessionArgumentCaptor = ArgumentCaptor.forClass(CarrierRoamingSatelliteSession.class); verify(mPersistAtomsStorage).addCarrierRoamingSatelliteSessionStats( sessionArgumentCaptor.capture()); CarrierRoamingSatelliteSession sessionStats = sessionArgumentCaptor.getValue(); Arrays.sort(supportedSatelliteServicesArray); assertEquals(supportedSatelliteServicesArray, sessionStats.supportedSatelliteServices); verifyNoMoreInteractions(mPersistAtomsStorage); int[] entitlementServiceTypeArray = {2, 3, 1}; SatelliteStats.SatelliteEntitlementParams entitlementParams = new SatelliteStats.SatelliteEntitlementParams.Builder() .setEntitlementServiceType(entitlementServiceTypeArray) .build(); mSatelliteStats.onSatelliteEntitlementMetrics(entitlementParams); ArgumentCaptor<SatelliteEntitlement> entitlementArgumentCaptor = ArgumentCaptor.forClass(SatelliteEntitlement.class); verify(mPersistAtomsStorage).addSatelliteEntitlementStats( entitlementArgumentCaptor.capture()); SatelliteEntitlement entitlementStats = entitlementArgumentCaptor.getValue(); Arrays.sort(entitlementServiceTypeArray); assertEquals(entitlementServiceTypeArray, entitlementStats.entitlementServiceType); verifyNoMoreInteractions(mPersistAtomsStorage); } } Loading
src/java/com/android/internal/telephony/metrics/SatelliteStats.java +2 −0 Original line number Diff line number Diff line Loading @@ -2053,6 +2053,7 @@ public class SatelliteStats { */ public Builder setSupportedSatelliteServices(int[] supportedSatelliteServices) { this.mSupportedSatelliteServices = supportedSatelliteServices; Arrays.sort(this.mSupportedSatelliteServices); return this; } Loading Loading @@ -2495,6 +2496,7 @@ public class SatelliteStats { */ public Builder setEntitlementServiceType(int[] entitlementServiceType) { this.mEntitlementServiceType = entitlementServiceType; Arrays.sort(this.mEntitlementServiceType); return this; } Loading
tests/telephonytests/src/com/android/internal/telephony/metrics/SatelliteStatsTest.java +35 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; import java.util.Arrays; import java.util.concurrent.TimeUnit; public class SatelliteStatsTest extends TelephonyTest { Loading Loading @@ -636,4 +637,38 @@ public class SatelliteStatsTest extends TelephonyTest { assertEquals(param.getConfigDataSource(), stats.configDataSource); verifyNoMoreInteractions(mPersistAtomsStorage); } @Test public void testReportRepeatedDataWithAscendingOrder() { int[] supportedSatelliteServicesArray = {3, 2, 1}; SatelliteStats.CarrierRoamingSatelliteSessionParams sessionParams = new SatelliteStats.CarrierRoamingSatelliteSessionParams.Builder() .setSupportedSatelliteServices(supportedSatelliteServicesArray) .build(); mSatelliteStats.onCarrierRoamingSatelliteSessionMetrics(sessionParams); ArgumentCaptor<CarrierRoamingSatelliteSession> sessionArgumentCaptor = ArgumentCaptor.forClass(CarrierRoamingSatelliteSession.class); verify(mPersistAtomsStorage).addCarrierRoamingSatelliteSessionStats( sessionArgumentCaptor.capture()); CarrierRoamingSatelliteSession sessionStats = sessionArgumentCaptor.getValue(); Arrays.sort(supportedSatelliteServicesArray); assertEquals(supportedSatelliteServicesArray, sessionStats.supportedSatelliteServices); verifyNoMoreInteractions(mPersistAtomsStorage); int[] entitlementServiceTypeArray = {2, 3, 1}; SatelliteStats.SatelliteEntitlementParams entitlementParams = new SatelliteStats.SatelliteEntitlementParams.Builder() .setEntitlementServiceType(entitlementServiceTypeArray) .build(); mSatelliteStats.onSatelliteEntitlementMetrics(entitlementParams); ArgumentCaptor<SatelliteEntitlement> entitlementArgumentCaptor = ArgumentCaptor.forClass(SatelliteEntitlement.class); verify(mPersistAtomsStorage).addSatelliteEntitlementStats( entitlementArgumentCaptor.capture()); SatelliteEntitlement entitlementStats = entitlementArgumentCaptor.getValue(); Arrays.sort(entitlementServiceTypeArray); assertEquals(entitlementServiceTypeArray, entitlementStats.entitlementServiceType); verifyNoMoreInteractions(mPersistAtomsStorage); } }