Merge "Extract and fix logic for showing rac dialog." into 24D1-dev am: 958b737fcc

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/27072479

Change-Id: I9f5c4c8dea3c7aebc73b5121d6ace7aca22c1dfc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Rafael Higuera Silva
2024-04-25 19:07:24 +00:00
committed by Automerger Merge Worker
5 changed files with 87 additions and 13 deletions

View File

@@ -658,36 +658,36 @@ public class SubscriptionUtilTest {
}
@Test
public void hasSubscriptionWithRacCarrier_hasNoWifi_showRacDialog_returnTrue() {
public void hasSubscriptionWithRacCarrier_hasNoWifi_showRacDialogForAllEsims_returnTrue() {
when(mResources.getIntArray(anyInt())).thenReturn(CARRIERS_THAT_USE_RAC);
final SubscriptionInfo info = mock(SubscriptionInfo.class);
when(info.getCarrierId()).thenReturn(RAC_CARRIER_ID);
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info));
addNetworkTransportType(NetworkCapabilities.TRANSPORT_BLUETOOTH);
assertTrue(SubscriptionUtil.shouldShowRacDialog(mContext));
assertTrue(SubscriptionUtil.shouldShowRacDialogWhenErasingAllEsims(mContext));
}
@Test
public void hasSubscriptionWithRacCarrier_hasWifi_showRacDialog_returnFalse() {
public void hasSubscriptionWithRacCarrier_hasWifi_showRacDialogForAllEsims_returnFalse() {
when(mResources.getIntArray(anyInt())).thenReturn(CARRIERS_THAT_USE_RAC);
final SubscriptionInfo info = mock(SubscriptionInfo.class);
when(info.getCarrierId()).thenReturn(RAC_CARRIER_ID);
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info));
addNetworkTransportType(NetworkCapabilities.TRANSPORT_WIFI);
assertFalse(SubscriptionUtil.shouldShowRacDialog(mContext));
assertFalse(SubscriptionUtil.shouldShowRacDialogWhenErasingAllEsims(mContext));
}
@Test
public void hasNoSubscriptionWithRacCarrier_hasNoWifi_showRacDialog_returnFalse() {
public void hasNoSubscriptionWithRacCarrier_hasNoWifi_showRacDialogForAllEsims_returnFalse() {
when(mResources.getIntArray(anyInt())).thenReturn(CARRIERS_THAT_USE_RAC);
final SubscriptionInfo info = mock(SubscriptionInfo.class);
when(info.getCarrierId()).thenReturn(NO_RAC_CARRIER_ID);
when(mSubMgr.getAvailableSubscriptionInfoList()).thenReturn(Arrays.asList(info));
addNetworkTransportType(NetworkCapabilities.TRANSPORT_WIFI);
assertFalse(SubscriptionUtil.shouldShowRacDialog(mContext));
assertFalse(SubscriptionUtil.shouldShowRacDialogWhenErasingAllEsims(mContext));
}
private void addNetworkTransportType(int networkType) {