TS43 Entitlement Enhancement with data plan type
Handle provisioned plmn list with data plan type information
Flag:com.android.internal.telephony.flags.carrier_enabled_satellite_flag
Bug: 376877718
Test: m and atest
Test: Device test for regression at b/381033899 and b/377063214
Change-Id: I3a53b6b6ac77f4d22a3f0a72e627c408ebbbbedd
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
index 8d9850d..b6da03a 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
@@ -489,7 +489,8 @@
logd("queryCompleted: updateSatelliteEntitlementStatus");
updateSatelliteEntitlementStatus(subId, entitlementResult.getEntitlementStatus() ==
SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_ENABLED,
- entitlementResult.getAllowedPLMNList(), entitlementResult.getBarredPLMNList());
+ entitlementResult.getAllowedPLMNList(), entitlementResult.getBarredPLMNList(),
+ entitlementResult.getDataPlanInfoForPlmnList());
}
private boolean shouldStartQueryEntitlement(int subId) {
@@ -546,7 +547,7 @@
mSatelliteEntitlementResultPerSub.put(subId, enabledResult);
}
updateSatelliteEntitlementStatus(subId, true, enabledResult.getAllowedPLMNList(),
- enabledResult.getBarredPLMNList());
+ enabledResult.getBarredPLMNList(), enabledResult.getDataPlanInfoForPlmnList());
}
resetEntitlementQueryPerSubId(subId);
}
@@ -655,9 +656,10 @@
*/
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
public void updateSatelliteEntitlementStatus(int subId, boolean enabled,
- List<String> plmnAllowedList, List<String> plmnBarredList) {
+ List<String> plmnAllowedList, List<String> plmnBarredList,
+ Map<String,Integer> plmnDataPlanMap) {
SatelliteController.getInstance().onSatelliteEntitlementStatusUpdated(subId, enabled,
- plmnAllowedList, plmnBarredList, null);
+ plmnAllowedList, plmnBarredList, plmnDataPlanMap, null);
}
private @SatelliteConstants.SatelliteEntitlementStatus int getEntitlementStatus(
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
index 014e28e..821e8dd 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
@@ -16,12 +16,18 @@
package com.android.phone.satellite.entitlement;
+import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_METERED;
+import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_UNMETERED;
+
import android.annotation.IntDef;
import com.android.internal.telephony.satellite.SatelliteNetworkInfo;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -112,4 +118,22 @@
return new SatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_DISABLED,
new ArrayList<>(), new ArrayList<>());
}
+
+ /**
+ * Get the data plan for the plmn List
+ *
+ * @return data plan for the plmn List
+ */
+ public Map<String, Integer> getDataPlanInfoForPlmnList() {
+ Map<String, Integer> dataPlanInfo = new HashMap<>();
+
+ for (SatelliteNetworkInfo plmnInfo : mAllowedSatelliteNetworkInfoList) {
+ int dataPlan = SATELLITE_DATA_PLAN_METERED; // default metered is available
+ if (plmnInfo.mDataPlanType.equalsIgnoreCase("unmetered")) {
+ dataPlan = SATELLITE_DATA_PLAN_UNMETERED; // overwrite data plan if unmetered
+ }
+ dataPlanInfo.put(plmnInfo.mPlmn, dataPlan);
+ }
+ return dataPlanInfo;
+ }
}
diff --git a/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java b/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java
index f41f861..11cf53b 100644
--- a/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java
+++ b/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java
@@ -16,6 +16,8 @@
package com.android.phone.satellite.entitlement;
+import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_METERED;
+import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_UNMETERED;
import static com.android.libraries.entitlement.ServiceEntitlementException.ERROR_HTTP_STATUS_NOT_SUCCESS;
import static com.android.phone.satellite.entitlement.SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_DISABLED;
import static com.android.phone.satellite.entitlement.SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_ENABLED;
@@ -28,6 +30,7 @@
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.ArgumentMatchers.anyMap;
import static org.mockito.ArgumentMatchers.anyVararg;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doAnswer;
@@ -91,7 +94,11 @@
private static final int DEFAULT_QUERY_REFRESH_DAY = 7;
private static final List<String> PLMN_ALLOWED_LIST = Arrays.asList("31026", "302820");
private static final List<String> PLMN_BARRED_LIST = Arrays.asList("12345", "98765");
+ private static final Map<String, Integer> PLMN_DATA_PLAN_LIST = Map.of(
+ "31026", SATELLITE_DATA_PLAN_METERED,
+ "302820", SATELLITE_DATA_PLAN_UNMETERED);
private static final List<String> EMPTY_PLMN_LIST = new ArrayList<>();
+ private static final Map<String, Integer> EMPTY_PLMN_DATA_PLAN_LIST = new HashMap<>();
private static final int CMD_START_QUERY_ENTITLEMENT = 1;
private static final int CMD_RETRY_QUERY_ENTITLEMENT = 2;
private static final int CMD_SIM_REFRESH = 3;
@@ -173,7 +180,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
mCarrierConfigBundle.putBoolean(
CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
@@ -184,7 +191,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
setInternetConnected(true);
// Verify don't start the query when last query refresh time is not expired.
@@ -193,7 +200,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
setLastQueryTime(0L);
// Verify don't start the query when retry count is reached max
@@ -206,7 +213,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
replaceInstance(SatelliteEntitlementController.class, "mRetryCountPerSub",
mSatelliteEntitlementController, new HashMap<>());
@@ -220,7 +227,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
replaceInstance(SatelliteEntitlementController.class, "mIsEntitlementInProgressPerSub",
mSatelliteEntitlementController, new HashMap<>());
@@ -228,12 +235,12 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
}
@Test
@@ -246,7 +253,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
// Verify don't call the updateSatelliteEntitlementStatus.
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// Verify call the checkSatelliteEntitlementStatus with invalid response.
setIsQueryAvailableTrue();
@@ -261,7 +268,8 @@
// Verify call the updateSatelliteEntitlementStatus with satellite service is disabled
// , empty PLMNAllowed and empty PLMNBarred.
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
- eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
// Verify call the checkSatelliteEntitlementStatus with the subscribed result.
clearInvocationsForMock();
@@ -269,14 +277,14 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
// Verify call the updateSatelliteEntitlementStatus with satellite service is enable,
// availablePLMNAllowedList and availablePLMNBarredList.
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
// Change subId and verify call the updateSatelliteEntitlementStatus with satellite
// service is enable, availablePLMNAllowedList and availablePLMNBarredList
@@ -287,43 +295,43 @@
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID_2), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
// Verify call the updateSatelliteEntitlementStatus with satellite service is enable,
// availablePLMNAllowedList and empty plmn barred list.
clearInvocationsForMock();
setIsQueryAvailableTrue();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- new ArrayList<>());
+ new ArrayList<>(), new HashMap<>());
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
// Verify call the updateSatelliteEntitlementStatus with satellite service is enable,
// empty PLMNAllowedList and PLMNBarredList.
clearInvocationsForMock();
setIsQueryAvailableTrue();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, new ArrayList<>(),
- new ArrayList<>());
+ new ArrayList<>(), new HashMap<>());
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
// Verify call the updateSatelliteEntitlementStatus with satellite service is enable,
// empty PLMNAllowedList and availablePLMNBarredList.
clearInvocationsForMock();
setIsQueryAvailableTrue();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, new ArrayList<>(),
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(EMPTY_PLMN_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(EMPTY_PLMN_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -336,7 +344,7 @@
setInternetConnected(true);
setLastQueryTime(0L);
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
networkCallback.onAvailable(mockNetwork);
mTestableLooper.processAllMessages();
@@ -344,7 +352,7 @@
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
// Verify call the updateSatelliteEntitlementStatus with satellite service is available.
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -354,13 +362,13 @@
setInternetConnected(true);
setLastQueryTime(0L);
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
triggerCarrierConfigChanged();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
// Verify call the updateSatelliteEntitlementStatus with satellite service is available.
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -429,7 +437,8 @@
// Verify only called onSatelliteEntitlementStatusUpdated once.
verify(mSatelliteController, times(1)).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
- eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
// Verify that the query is not restarted after reaching the maximum retry count even if
// a start cmd is received.
@@ -525,7 +534,8 @@
// Verify only called onSatelliteEntitlementStatusUpdated once.
verify(mSatelliteController, times(1)).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
- eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -540,7 +550,8 @@
verify(mSatelliteEntitlementApi, times(1)).checkEntitlementStatus();
assertNull(retryCountPerSub.get(SUB_ID));
verify(mSatelliteController, times(1)).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
- eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -561,13 +572,13 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
mTestableLooper.moveTimeForward(TimeUnit.SECONDS.toMillis(1));
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
assertNull(retryCountPerSub.get(SUB_ID));
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -590,7 +601,7 @@
assertNotNull(exponentialBackoffPerSub.get(SUB_ID));
// Verify don't call the onSatelliteEntitlementStatusUpdated.
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// Verify the retry in progress.
sendMessage(CMD_RETRY_QUERY_ENTITLEMENT, SUB_ID);
@@ -599,21 +610,21 @@
assertEquals(1, retryCountPerSub.get(SUB_ID).longValue());
// Verify don't call the onSatelliteEntitlementStatusUpdated.
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// Received the 200 response, Verify call the onSatelliteEntitlementStatusUpdated.
setIsQueryAvailableTrue();
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
sendMessage(CMD_RETRY_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi, times(3)).checkEntitlementStatus();
assertEquals(1, retryCountPerSub.get(SUB_ID).longValue());
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -625,14 +636,15 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_DISABLED, EMPTY_PLMN_LIST,
- EMPTY_PLMN_LIST);
+ EMPTY_PLMN_LIST, EMPTY_PLMN_DATA_PLAN_LIST);
sendMessage(CMD_START_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
// Verify call the onSatelliteEntitlementStatusUpdated - entitlement status false
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
// Verify call the onSatelliteEntitlementStatusUpdated - entitlement status true
mCarrierConfigBundle.putBoolean(
@@ -641,7 +653,8 @@
mTestableLooper.processAllMessages();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- eq(true), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(true), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
// KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL changed from Support(entitlement status
// enabled) to not support.
@@ -650,14 +663,15 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
sendMessage(CMD_START_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
// Verify call the onSatelliteEntitlementStatusUpdated - entitlement status true.
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- eq(true), eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(true), eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST),
+ eq(PLMN_DATA_PLAN_LIST), any());
// Verify not call the onSatelliteEntitlementStatusUpdated.
clearInvocationsForMock();
@@ -667,7 +681,8 @@
mTestableLooper.processAllMessages();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- eq(true), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(true), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -680,13 +695,13 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
sendMessage(CMD_START_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// After move to the refresh time, verify the query started and success.
setLastQueryTime(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1) - 1000);
@@ -695,7 +710,7 @@
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
verify(mSatelliteController, times(2)).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
}
@Test
@@ -710,20 +725,20 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// Verify the query start and success after internet connected.
setInternetConnected(true);
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
sendMessage(CMD_START_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -737,7 +752,7 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// Verify whether the second query has been triggered and whether
// onSatelliteEntitlementStatusUpdated has been called after received the 500 error.
@@ -747,7 +762,8 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
- eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), any());
+ eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -761,7 +777,7 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// Verify whether the second query was triggered and onSatelliteEntitlementStatusUpdated
// was not called after received a 503 error without valid retry-after header.
@@ -771,20 +787,20 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// Verify whether the third query was triggered and onSatelliteEntitlementStatusUpdated
// was called after received a success case.
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
mTestableLooper.moveTimeForward(TimeUnit.MINUTES.toMillis(10));
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
}
@Test
@@ -795,12 +811,12 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
// SIM_REFRESH event occurred before expired the query refresh timer, verify the start
// the query.
@@ -810,7 +826,7 @@
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
verify(mSatelliteController, times(2)).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), any());
}
private void triggerCarrierConfigChanged() {
@@ -868,10 +884,12 @@
}
private void setSatelliteEntitlementResult(int entitlementStatus,
- List<String> plmnAllowedList, List<String> plmnBarredList) {
+ List<String> plmnAllowedList, List<String> plmnBarredList,
+ Map<String,Integer> plmnDataPlanMap) {
doReturn(entitlementStatus).when(mSatelliteEntitlementResult).getEntitlementStatus();
doReturn(plmnAllowedList).when(mSatelliteEntitlementResult).getAllowedPLMNList();
doReturn(plmnBarredList).when(mSatelliteEntitlementResult).getBarredPLMNList();
+ doReturn(plmnDataPlanMap).when(mSatelliteEntitlementResult).getDataPlanInfoForPlmnList();
}
private void setLastQueryTime(Long lastQueryTime) throws Exception {