summaryrefslogtreecommitdiff
path: root/tests/telephonytests
diff options
context:
space:
mode:
author Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-05-07 13:47:17 -0700
committer Android Build Coastguard Worker <android-build-coastguard-worker@google.com> 2025-05-07 13:47:17 -0700
commit3449e9e2cd2738d8cdeb88514498f728622e3a6b (patch)
tree29629a89f180adf16860dc35f114a464b257c3ee /tests/telephonytests
parent6f7e004afc19bcc268f862140f755f53c90da8af (diff)
parent0a93c66b9d3d6337d7ed99c4cfd29ebe9a5bf850 (diff)
Merge cherrypicks of ['googleplex-android-review.googlesource.com/33443931'] into 25Q2-release.
Change-Id: I51a951e3fa0595a07d664d964cdf63592f674b1e
Diffstat (limited to 'tests/telephonytests')
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java14
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java8
-rw-r--r--tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteServiceUtilsTest.java13
3 files changed, 28 insertions, 7 deletions
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
index 60cd83bcd9..7bdb3d2372 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
@@ -248,6 +248,8 @@ public class SatelliteControllerTest extends TelephonyTest {
(int) TimeUnit.SECONDS.toMillis(60);
private static final int TEST_WAIT_FOR_CELLULAR_MODEM_OFF_TIMEOUT_MILLIS =
(int) TimeUnit.SECONDS.toMillis(60);
+ private static final Set<String> TEST_ALL_SATELLITE_PLMN_SET = new HashSet<>(
+ Arrays.asList("310830", "313210"));
private static final String SATELLITE_PLMN = "00103";
@@ -262,7 +264,7 @@ public class SatelliteControllerTest extends TelephonyTest {
private SubscriptionInfo testSubscriptionInfo;
private SubscriptionInfo testSubscriptionInfo2;
- @Mock private SatelliteController mMockSatelliteController;
+ @Mock private TestSatelliteController mMockSatelliteController;
@Mock private DatagramController mMockDatagramController;
@Mock private SatelliteModemInterface mMockSatelliteModemInterface;
@Mock private SatelliteSessionController mMockSatelliteSessionController;
@@ -729,6 +731,7 @@ public class SatelliteControllerTest extends TelephonyTest {
doReturn(mSubscriptionInfo).when(mMockSubscriptionManagerService).getSubscriptionInfo(
anyInt());
doReturn("").when(mSubscriptionInfo).getIccId();
+ doReturn(TEST_ALL_SATELLITE_PLMN_SET).when(mMockSatelliteController).getAllPlmnSet();
}
@After
@@ -5911,7 +5914,7 @@ public class SatelliteControllerTest extends TelephonyTest {
}
}
- private class TestSatelliteController extends SatelliteController {
+ public class TestSatelliteController extends SatelliteController {
public boolean setSettingsKeyForSatelliteModeCalled = false;
public boolean allRadiosDisabled = true;
public long elapsedRealtime = 0;
@@ -5930,7 +5933,7 @@ public class SatelliteControllerTest extends TelephonyTest {
private boolean mLocationServiceEnabled = true;
- TestSatelliteController(
+ public TestSatelliteController(
Context context, Looper looper, @NonNull FeatureFlags featureFlags) {
super(context, looper, featureFlags);
logd("Constructing TestSatelliteController");
@@ -6073,6 +6076,11 @@ public class SatelliteControllerTest extends TelephonyTest {
}
}
+ @Override
+ protected Set<String> getAllPlmnSet() {
+ return super.getAllPlmnSet();
+ }
+
public boolean isRadioOn() {
synchronized (mIsRadioOnLock) {
return mIsRadioOn;
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
index 6592c4c657..ed709fc009 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
@@ -31,6 +31,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.times;
@@ -88,6 +89,7 @@ import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -122,6 +124,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest {
private static final String DEFAULT_SATELLITE_SOS_HANDOVER_CLASS =
"android.com.vendor.message.SosHandoverApp";
private static final String DEFAULT_T911_HANDOVER_INTENT_ACTION = Intent.ACTION_SENDTO;
+ private static final Set<String> TEST_ALL_SATELLITE_PLMN_SET = new HashSet<>(
+ Arrays.asList("310830", "313210"));
private TestSatelliteController mTestSatelliteController;
private TestImsManager mTestImsManager;
@Mock
@@ -139,6 +143,7 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest {
@Mock
private SatelliteStats mMockSatelliteStats;
@Mock private SubscriptionManagerService mMockSubscriptionManagerService;
+ @Mock private SatelliteControllerTest.TestSatelliteController mMockSatelliteController;
@Before
public void setUp() throws Exception {
@@ -183,6 +188,8 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest {
mMockSatelliteStats);
replaceInstance(SubscriptionManagerService.class, "sInstance", null,
mMockSubscriptionManagerService);
+ replaceInstance(SatelliteController.class, "sInstance", null,
+ mMockSatelliteController);
doNothing().when(mMockSatelliteStats).onSatelliteSosMessageRecommender(
any(SatelliteStats.SatelliteSosMessageRecommenderParams.class));
mTestSatelliteController.setSatelliteConnectedViaCarrierWithinHysteresisTime(
@@ -194,6 +201,7 @@ public class SatelliteSOSMessageRecommenderTest extends TelephonyTest {
.setId(SUB_ID1).setOnlyNonTerrestrialNetwork(true).build();
when(mMockSubscriptionManagerService.getSubscriptionInfo(eq(SUB_ID1)))
.thenReturn(subscriptionInfo);
+ doReturn(TEST_ALL_SATELLITE_PLMN_SET).when(mMockSatelliteController).getAllPlmnSet();
}
@After
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteServiceUtilsTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteServiceUtilsTest.java
index 9185dcec24..c27103ab38 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteServiceUtilsTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteServiceUtilsTest.java
@@ -43,6 +43,7 @@ import org.mockito.MockitoAnnotations;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -55,6 +56,8 @@ public class SatelliteServiceUtilsTest extends TelephonyTest {
private static final int SUB_ID1 = 1;
@Mock private ServiceState mServiceState2;
+ @Mock SatelliteControllerTest.TestSatelliteController mMockSatelliteController;
+
@Before
public void setUp() throws Exception {
super.setUp(getClass().getSimpleName());
@@ -68,6 +71,8 @@ public class SatelliteServiceUtilsTest extends TelephonyTest {
when(mPhone2.getServiceState()).thenReturn(mServiceState2);
when(mPhone2.getSubId()).thenReturn(SUB_ID1);
when(mPhone2.getPhoneId()).thenReturn(1);
+ replaceInstance(SatelliteController.class, "sInstance", null,
+ mMockSatelliteController);
}
@After
@@ -182,8 +187,8 @@ public class SatelliteServiceUtilsTest extends TelephonyTest {
public void testIsSatellitePlmn() {
int subId = 1;
- when(mSatelliteController.getSatellitePlmnsForCarrier(eq(subId)))
- .thenReturn(new ArrayList<>());
+ when(mMockSatelliteController.getAllPlmnSet())
+ .thenReturn(new HashSet<>(new ArrayList<>()));
assertFalse(SatelliteServiceUtils.isSatellitePlmn(subId, mServiceState));
// registered PLMN is null
@@ -196,8 +201,8 @@ public class SatelliteServiceUtilsTest extends TelephonyTest {
assertFalse(SatelliteServiceUtils.isSatellitePlmn(subId, mServiceState));
// cell identity is null
- when(mSatelliteController.getSatellitePlmnsForCarrier(eq(subId))).thenReturn(
- List.of("120260"));
+ when(mMockSatelliteController.getAllPlmnSet()).thenReturn(
+ new HashSet<>(List.of("120260")));
nri = new NetworkRegistrationInfo.Builder()
.setRegisteredPlmn("123456")
.setCellIdentity(null)