TS43 Entitlement enhancement for Allowed Services
- Support TS43 enititlement changes to support service type
and service policy information at allowed services info
Flag:com.android.internal.telephony.flags.carrier_enabled_satellite_flag
Bug: 377063214
Test: m and atest
Test: Device test for regression at b/381033899 and b/377063214
Change-Id: I268290cd8990192a910667451f616497a464f7bb
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
index b6da03a..1f46ff6 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
@@ -490,7 +490,10 @@
updateSatelliteEntitlementStatus(subId, entitlementResult.getEntitlementStatus() ==
SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_ENABLED,
entitlementResult.getAllowedPLMNList(), entitlementResult.getBarredPLMNList(),
- entitlementResult.getDataPlanInfoForPlmnList());
+ entitlementResult.getDataPlanInfoForPlmnList(),
+ entitlementResult.getAvailableServiceTypeInfoForPlmnList(),
+ entitlementResult.getDataServicePolicyInfoForPlmnList(),
+ entitlementResult.getVoiceServicePolicyInfoForPlmnList());
}
private boolean shouldStartQueryEntitlement(int subId) {
@@ -547,7 +550,10 @@
mSatelliteEntitlementResultPerSub.put(subId, enabledResult);
}
updateSatelliteEntitlementStatus(subId, true, enabledResult.getAllowedPLMNList(),
- enabledResult.getBarredPLMNList(), enabledResult.getDataPlanInfoForPlmnList());
+ enabledResult.getBarredPLMNList(), enabledResult.getDataPlanInfoForPlmnList(),
+ enabledResult.getAvailableServiceTypeInfoForPlmnList(),
+ enabledResult.getDataServicePolicyInfoForPlmnList(),
+ enabledResult.getVoiceServicePolicyInfoForPlmnList());
}
resetEntitlementQueryPerSubId(subId);
}
@@ -657,9 +663,13 @@
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
public void updateSatelliteEntitlementStatus(int subId, boolean enabled,
List<String> plmnAllowedList, List<String> plmnBarredList,
- Map<String,Integer> plmnDataPlanMap) {
+ Map<String,Integer> plmnDataPlanMap,
+ Map<String, List<Integer>>plmnAllowedServicesMap,
+ Map<String,Integer>plmnDataServicePolicyMap,
+ Map<String, Integer>plmnVoiceServicePolicyMap) {
SatelliteController.getInstance().onSatelliteEntitlementStatusUpdated(subId, enabled,
- plmnAllowedList, plmnBarredList, plmnDataPlanMap, null);
+ plmnAllowedList, plmnBarredList, plmnDataPlanMap, plmnAllowedServicesMap,
+ plmnDataServicePolicyMap, plmnVoiceServicePolicyMap, null);
}
private @SatelliteConstants.SatelliteEntitlementStatus int getEntitlementStatus(
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java
index 97cb355..7d6b5ba 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponse.java
@@ -30,7 +30,9 @@
import org.json.JSONObject;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -51,6 +53,14 @@
private static final String PLMN_KEY = "PLMN";
/** The data plan is of the metered or un-metered type. This value is optional. */
private static final String DATA_PLAN_TYPE_KEY = "DataPlanType";
+ /** The allowed services info with array of allowed services */
+ private static final String ALLOWED_SERVICES_INFO_TYPE_KEY = "AllowedServicesInfo";
+ /** The allowed services with service type and service policy for the plmn*/
+ private static final String ALLOWED_SERVICES_KEY = "AllowedServices";
+ /** list of service type supported for the plmn*/
+ private static final String SERVICE_TYPE_KEY = "ServiceType";
+ /** list of service policy supported for the plmn*/
+ private static final String SERVICE_POLICY_KEY = "ServicePolicy";
@SatelliteEntitlementResult.SatelliteEntitlementStatus private int mEntitlementStatus;
@@ -90,7 +100,7 @@
*/
public List<SatelliteNetworkInfo> getPlmnAllowed() {
return mPlmnAllowedList.stream().map((info) -> new SatelliteNetworkInfo(info.mPlmn,
- info.mDataPlanType)).collect(Collectors.toList());
+ info.mDataPlanType, info.mAllowedServicesInfo)).collect(Collectors.toList());
}
/**
@@ -125,10 +135,31 @@
for (int i = 0; i < jsonArray.length(); i++) {
String dataPlanType = jsonArray.getJSONObject(i).has(DATA_PLAN_TYPE_KEY)
? jsonArray.getJSONObject(i).getString(DATA_PLAN_TYPE_KEY) : "";
+ Map<String, String> allowedServicesInfo = new HashMap<>();
+ if (jsonArray.getJSONObject(i).has(ALLOWED_SERVICES_INFO_TYPE_KEY)) {
+ allowedServicesInfo = new HashMap<>();
+ JSONArray jsonArray1 = jsonArray.getJSONObject(i)
+ .getJSONArray(ALLOWED_SERVICES_INFO_TYPE_KEY);
+ for (int j = 0; j < jsonArray1.length(); j++) {
+ String serviceType = jsonArray1.getJSONObject(j)
+ .getJSONObject(ALLOWED_SERVICES_KEY)
+ .has(SERVICE_TYPE_KEY) ? jsonArray1.getJSONObject(j)
+ .getJSONObject(ALLOWED_SERVICES_KEY)
+ .getString(SERVICE_TYPE_KEY): "";
+ String servicePolicy = jsonArray1.getJSONObject(j)
+ .getJSONObject(ALLOWED_SERVICES_KEY)
+ .has(SERVICE_POLICY_KEY) ? jsonArray1.getJSONObject(j)
+ .getJSONObject(ALLOWED_SERVICES_KEY)
+ .getString(SERVICE_POLICY_KEY) : "";
+ allowedServicesInfo.put(serviceType, servicePolicy);
+ }
+ }
String plmn = jsonArray.getJSONObject(i).getString(PLMN_KEY);
- logd("parsingResponse: plmn=" + plmn + " dataplan=" + dataPlanType);
+ logd("parsingResponse: plmn=" + plmn + " dataplan=" + dataPlanType
+ + " allowedServices=" + allowedServicesInfo);
if (!TextUtils.isEmpty(plmn)) {
- mPlmnAllowedList.add(new SatelliteNetworkInfo(plmn, dataPlanType));
+ mPlmnAllowedList.add(new SatelliteNetworkInfo(
+ plmn, dataPlanType, allowedServicesInfo));
}
}
}
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
index 821e8dd..5d531fc 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
@@ -16,6 +16,12 @@
package com.android.phone.satellite.entitlement;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ALL;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_VOICE;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
+
import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_METERED;
import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_DATA_PLAN_UNMETERED;
@@ -24,7 +30,6 @@
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;
@@ -136,4 +141,67 @@
}
return dataPlanInfo;
}
+
+ /**
+ * Get ServiceType at Allowed Services for the plmn List
+ *
+ * @return The Allowed Services for the plmn List
+ */
+ public Map<String, List<Integer>> getAvailableServiceTypeInfoForPlmnList() {
+ Map<String, List<Integer>> availableServicesInfo = new HashMap<>();
+ for (SatelliteNetworkInfo plmnInfo : mAllowedSatelliteNetworkInfoList) {
+ List<Integer> allowedServicesList = new ArrayList<>();
+ if (plmnInfo.mAllowedServicesInfo != null) {
+ for (String key : plmnInfo.mAllowedServicesInfo.keySet()) {
+ if (key.equalsIgnoreCase("data")) {
+ allowedServicesList.add(SERVICE_TYPE_DATA);
+ } else if (key.equalsIgnoreCase("voice")) {
+ allowedServicesList.add(SERVICE_TYPE_VOICE);
+ }
+ }
+ // By default sms is added to the allowed services
+ allowedServicesList.add(SERVICE_TYPE_SMS);
+ availableServicesInfo.put(plmnInfo.mPlmn, allowedServicesList);
+ }
+ }
+ return availableServicesInfo;
+ }
+
+ /**
+ * Get ServicePolicy for data at Allowed Services for the plmn List
+ *
+ * @return The Allowed Services for the plmn List
+ */
+ public Map<String, Integer> getDataServicePolicyInfoForPlmnList() {
+ return getServicePolicyInfoForServiceType("data");
+ }
+
+ /**
+ * Get ServicePolicy for voice at Allowed Services for the plmn List
+ *
+ * @return The Allowed Services for the plmn List
+ */
+ public Map<String, Integer> getVoiceServicePolicyInfoForPlmnList() {
+ return getServicePolicyInfoForServiceType("voice");
+ }
+
+ public Map<String, Integer> getServicePolicyInfoForServiceType(String serviceType) {
+ Map<String, Integer> servicePolicyInfo = new HashMap<>();
+ for (SatelliteNetworkInfo plmnInfo : mAllowedSatelliteNetworkInfoList) {
+ if (plmnInfo.mAllowedServicesInfo != null) {
+ for (String key : plmnInfo.mAllowedServicesInfo.keySet()) {
+ if (key.equalsIgnoreCase(serviceType)) {
+ String servicePolicy = plmnInfo.mAllowedServicesInfo.get(key);
+ if (servicePolicy.equalsIgnoreCase("constrained")) {
+ servicePolicyInfo.put(plmnInfo.mPlmn,
+ SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED);
+ } else if (servicePolicy.equalsIgnoreCase("unconstrained")) {
+ servicePolicyInfo.put(plmnInfo.mPlmn, SATELLITE_DATA_SUPPORT_ALL);
+ }
+ }
+ }
+ }
+ }
+ return servicePolicyInfo;
+ }
}
diff --git a/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java b/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java
index 11cf53b..a3b38df 100644
--- a/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java
+++ b/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java
@@ -16,6 +16,11 @@
package com.android.phone.satellite.entitlement;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ALL;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_VOICE;
+
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;
@@ -99,6 +104,23 @@
"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 Map<String, List<Integer>> PLMN_ALLOWED_SERVICES_LIST = Map.of(
+ "31026", List.of(SERVICE_TYPE_DATA),
+ "302820", List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_VOICE)
+ );
+ private static final Map<String, Integer> PLMN_DATA_SERVICE_POLICY_LIST = Map.of(
+ "31026", SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED,
+ "302820", SATELLITE_DATA_SUPPORT_ALL);
+ private static final Map<String, Integer> PLMN_VOICE_SERVICE_POLICY_LIST = Map.of(
+ "31026", SATELLITE_DATA_SUPPORT_ALL,
+ "302820", SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED
+ );
+ private static final Map<String, List<Integer>> EMPTY_PLMN_ALLOWED_SERVICES_LIST =
+ new HashMap<>();
+ private static final Map<String, Integer> EMPTY_PLMN_DATA_SERVICE_POLICY_LIST =
+ new HashMap<>();
+ private static final Map<String, Integer> EMPTY_PLMN_VOICE_SERVICE_POLICY_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;
@@ -180,7 +202,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
mCarrierConfigBundle.putBoolean(
CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
@@ -191,7 +213,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
setInternetConnected(true);
// Verify don't start the query when last query refresh time is not expired.
@@ -200,7 +222,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
setLastQueryTime(0L);
// Verify don't start the query when retry count is reached max
@@ -213,7 +235,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
replaceInstance(SatelliteEntitlementController.class, "mRetryCountPerSub",
mSatelliteEntitlementController, new HashMap<>());
@@ -227,7 +249,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
replaceInstance(SatelliteEntitlementController.class, "mIsEntitlementInProgressPerSub",
mSatelliteEntitlementController, new HashMap<>());
@@ -235,12 +257,13 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_LIST);
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
}
@Test
@@ -253,7 +276,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
// Verify don't call the updateSatelliteEntitlementStatus.
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// Verify call the checkSatelliteEntitlementStatus with invalid response.
setIsQueryAvailableTrue();
@@ -269,7 +292,9 @@
// , empty PLMNAllowed and empty PLMNBarred.
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST), eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST),
+ any());
// Verify call the checkSatelliteEntitlementStatus with the subscribed result.
clearInvocationsForMock();
@@ -277,14 +302,17 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_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), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
// Change subId and verify call the updateSatelliteEntitlementStatus with satellite
// service is enable, availablePLMNAllowedList and availablePLMNBarredList
@@ -295,43 +323,54 @@
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID_2), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_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 HashMap<>());
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>());
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(PLMN_ALLOWED_LIST), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_DATA_PLAN_LIST),
+ eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST), eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_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 HashMap<>());
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>());
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_DATA_PLAN_LIST),
+ eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST), eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_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_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_LIST);
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID), eq(true),
- eq(EMPTY_PLMN_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -344,7 +383,8 @@
setInternetConnected(true);
setLastQueryTime(0L);
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_LIST);
networkCallback.onAvailable(mockNetwork);
mTestableLooper.processAllMessages();
@@ -352,7 +392,9 @@
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), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -362,13 +404,16 @@
setInternetConnected(true);
setLastQueryTime(0L);
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_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), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -438,7 +483,9 @@
// Verify only called onSatelliteEntitlementStatusUpdated once.
verify(mSatelliteController, times(1)).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST), any());
// Verify that the query is not restarted after reaching the maximum retry count even if
// a start cmd is received.
@@ -535,7 +582,9 @@
// Verify only called onSatelliteEntitlementStatusUpdated once.
verify(mSatelliteController, times(1)).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST), eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST),
+ any());
}
@Test
@@ -551,7 +600,9 @@
assertNull(retryCountPerSub.get(SUB_ID));
verify(mSatelliteController, times(1)).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -572,13 +623,16 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_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), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -601,7 +655,7 @@
assertNotNull(exponentialBackoffPerSub.get(SUB_ID));
// Verify don't call the onSatelliteEntitlementStatusUpdated.
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// Verify the retry in progress.
sendMessage(CMD_RETRY_QUERY_ENTITLEMENT, SUB_ID);
@@ -610,21 +664,24 @@
assertEquals(1, retryCountPerSub.get(SUB_ID).longValue());
// Verify don't call the onSatelliteEntitlementStatusUpdated.
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), 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_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_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), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -636,7 +693,8 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_DISABLED, EMPTY_PLMN_LIST,
- EMPTY_PLMN_LIST, EMPTY_PLMN_DATA_PLAN_LIST);
+ EMPTY_PLMN_LIST, EMPTY_PLMN_DATA_PLAN_LIST, EMPTY_PLMN_ALLOWED_SERVICES_LIST,
+ EMPTY_PLMN_DATA_SERVICE_POLICY_LIST, EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST);
sendMessage(CMD_START_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
@@ -644,7 +702,9 @@
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST), eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST),
+ any());
// Verify call the onSatelliteEntitlementStatusUpdated - entitlement status true
mCarrierConfigBundle.putBoolean(
@@ -654,7 +714,9 @@
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
eq(true), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST), eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST),
+ any());
// KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL changed from Support(entitlement status
// enabled) to not support.
@@ -663,7 +725,8 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_LIST);
sendMessage(CMD_START_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
@@ -671,7 +734,8 @@
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
eq(true), eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST),
- eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_DATA_PLAN_LIST), eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
// Verify not call the onSatelliteEntitlementStatusUpdated.
clearInvocationsForMock();
@@ -682,7 +746,8 @@
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
eq(true), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_DATA_PLAN_LIST), eq(PLMN_ALLOWED_SERVICES_LIST),
+ eq(PLMN_DATA_SERVICE_POLICY_LIST), eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -695,13 +760,14 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_LIST);
sendMessage(CMD_START_QUERY_ENTITLEMENT, SUB_ID);
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// After move to the refresh time, verify the query started and success.
setLastQueryTime(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1) - 1000);
@@ -710,7 +776,7 @@
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
verify(mSatelliteController, times(2)).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
}
@Test
@@ -725,20 +791,23 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), 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_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_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), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -752,7 +821,7 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// Verify whether the second query has been triggered and whether
// onSatelliteEntitlementStatusUpdated has been called after received the 500 error.
@@ -763,7 +832,9 @@
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(eq(SUB_ID),
eq(false), eq(EMPTY_PLMN_LIST), eq(EMPTY_PLMN_LIST),
- eq(EMPTY_PLMN_DATA_PLAN_LIST), any());
+ eq(EMPTY_PLMN_DATA_PLAN_LIST), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST), eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST),
+ any());
}
@Test
@@ -777,7 +848,7 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// Verify whether the second query was triggered and onSatelliteEntitlementStatusUpdated
// was not called after received a 503 error without valid retry-after header.
@@ -787,20 +858,23 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), 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_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_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), eq(PLMN_DATA_PLAN_LIST), any());
+ eq(PLMN_ALLOWED_LIST), eq(PLMN_BARRED_LIST), eq(PLMN_DATA_PLAN_LIST),
+ eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -811,12 +885,13 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST);
+ PLMN_BARRED_LIST, PLMN_DATA_PLAN_LIST, PLMN_ALLOWED_SERVICES_LIST,
+ PLMN_DATA_SERVICE_POLICY_LIST, PLMN_VOICE_SERVICE_POLICY_LIST);
mSatelliteEntitlementController.handleCmdStartQueryEntitlement();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// SIM_REFRESH event occurred before expired the query refresh timer, verify the start
// the query.
@@ -825,8 +900,9 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
- verify(mSatelliteController, times(2)).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), anyMap(), any());
+ verify(mSatelliteController, times(2))
+ .onSatelliteEntitlementStatusUpdated(anyInt(), anyBoolean(), anyList(), anyList(),
+ anyMap(), anyMap(), anyMap(), anyMap(), any());
}
private void triggerCarrierConfigChanged() {
@@ -885,11 +961,20 @@
private void setSatelliteEntitlementResult(int entitlementStatus,
List<String> plmnAllowedList, List<String> plmnBarredList,
- Map<String,Integer> plmnDataPlanMap) {
+ Map<String,Integer> plmnDataPlanMap,
+ Map<String,List<Integer>> plmnAllowedServicesMap,
+ Map<String,Integer> plmnDataServicePolicyMap,
+ Map<String,Integer> plmnVoiceServicePolicyMap) {
doReturn(entitlementStatus).when(mSatelliteEntitlementResult).getEntitlementStatus();
doReturn(plmnAllowedList).when(mSatelliteEntitlementResult).getAllowedPLMNList();
doReturn(plmnBarredList).when(mSatelliteEntitlementResult).getBarredPLMNList();
doReturn(plmnDataPlanMap).when(mSatelliteEntitlementResult).getDataPlanInfoForPlmnList();
+ doReturn(plmnAllowedServicesMap).when(mSatelliteEntitlementResult)
+ .getAvailableServiceTypeInfoForPlmnList();
+ doReturn(plmnDataServicePolicyMap).when(mSatelliteEntitlementResult)
+ .getDataServicePolicyInfoForPlmnList();
+ doReturn(plmnVoiceServicePolicyMap).when(mSatelliteEntitlementResult)
+ .getVoiceServicePolicyInfoForPlmnList();
}
private void setLastQueryTime(Long lastQueryTime) throws Exception {
diff --git a/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponseTest.java b/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponseTest.java
index 8e45a73..92dd997 100644
--- a/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponseTest.java
+++ b/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResponseTest.java
@@ -16,6 +16,11 @@
package com.android.phone.satellite.entitlement;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ALL;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_VOICE;
+
import static com.android.phone.satellite.entitlement.SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_DISABLED;
import static com.android.phone.satellite.entitlement.SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_ENABLED;
import static com.android.phone.satellite.entitlement.SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_INCOMPATIBLE;
@@ -34,13 +39,17 @@
import java.util.Arrays;
import java.util.List;
+import java.util.Map;
@RunWith(AndroidJUnit4.class)
public class SatelliteEntitlementResponseTest {
private static final String TEST_OTHER_APP_ID = "ap201x";
+
private static final List<SatelliteNetworkInfo> TEST_PLMN_DATA_PLAN_TYPE_LIST = Arrays.asList(
- new SatelliteNetworkInfo("31026", "unmetered"),
- new SatelliteNetworkInfo("302820", "metered"));
+ new SatelliteNetworkInfo("31026", "unmetered",
+ Map.of("data","constrained")),
+ new SatelliteNetworkInfo("302820", "metered",
+ Map.of("voice","unconstrained")));
private static final List<String> TEST_PLMN_BARRED_LIST = Arrays.asList("31017", "302020");
private static final String RESPONSE_WITHOUT_SATELLITE_APP_ID =
"{\"VERS\":{\"version\":\"1\",\"validity\":\"172800\"},"
@@ -77,10 +86,14 @@
response.getPlmnAllowed().get(0).mPlmn);
assertEquals(TEST_PLMN_DATA_PLAN_TYPE_LIST.get(0).mDataPlanType,
response.getPlmnAllowed().get(0).mDataPlanType);
+ assertEquals(TEST_PLMN_DATA_PLAN_TYPE_LIST.get(0).mAllowedServicesInfo,
+ response.getPlmnAllowed().get(0).mAllowedServicesInfo);
assertEquals(TEST_PLMN_DATA_PLAN_TYPE_LIST.get(1).mPlmn,
response.getPlmnAllowed().get(1).mPlmn);
assertEquals(TEST_PLMN_DATA_PLAN_TYPE_LIST.get(1).mDataPlanType,
response.getPlmnAllowed().get(1).mDataPlanType);
+ assertEquals(TEST_PLMN_DATA_PLAN_TYPE_LIST.get(1).mAllowedServicesInfo,
+ response.getPlmnAllowed().get(1).mAllowedServicesInfo);
assertTrue(response.getPlmnBarredList().size() == 2);
assertEquals(TEST_PLMN_BARRED_LIST, response.getPlmnBarredList());
@@ -207,15 +220,17 @@
private String getPLMNListOrEmpty(int entitlementStatus) {
return entitlementStatus == SATELLITE_ENTITLEMENT_STATUS_ENABLED ? ","
- + "\"PLMNAllowed\":[{\"PLMN\":\"31026\",\"DataPlanType\":\"unmetered\"},"
- + "{\"PLMN\":\"302820\",\"DataPlanType\":\"metered\"}],"
+ + "\"PLMNAllowed\":[{\"PLMN\":\"31026\",\"DataPlanType\":\"unmetered\",\"AllowedServicesInfo\":[{\"AllowedServices\":{\"ServiceType\":\"data\",\"ServicePolicy\":\"constrained\"}}]},"
+ + "{\"PLMN\":\"302820\",\"DataPlanType\":\"metered\",\"AllowedServicesInfo\":[{\"AllowedServices\":{\"ServiceType\":\"voice\",\"ServicePolicy\":\"unconstrained\"}}]}],"
+ "\"PLMNBarred\":[{\"PLMN\":\"31017\"},"
+ "{\"PLMN\":\"302020\"}]" : "";
}
private String getAllowedPlmns(String firstPlmn, String secondPlmn) {
- return ",\"PLMNAllowed\":[{\"PLMN\":\"" + firstPlmn + "\",\"DataPlanType\":\"unmetered\"},"
- + "{\"PLMN\":\"" + secondPlmn + "\",\"DataPlanType\":\"metered\"}]";
+ return ",\"PLMNAllowed\":[{\"PLMN\":\"" + firstPlmn +
+ "\",\"DataPlanType\":\"unmetered\",\"AllowedServicesInfo\":[{\"AllowedServices\":{\"ServiceType\":\"data\",\"ServicePolicy\":\"constrained\"}}]},"
+ + "{\"PLMN\":\"" + secondPlmn +
+ "\",\"DataPlanType\":\"metered\",\"AllowedServicesInfo\":[{\"AllowedServices\":{\"ServiceType\":\"voice\",\"ServicePolicy\":\"unconstrained\"}}]}]";
}
private String getBarredPlmns(String firstPlmn, String secondPlmn) {
@@ -237,8 +252,8 @@
+ "\"TOKEN\":{\"token\":\"ASH127AHHA88SF\"},\""
+ ServiceEntitlement.APP_SATELLITE_ENTITLEMENT + "\":{"
+ "\"EntitlementStatus\":\"" + SATELLITE_ENTITLEMENT_STATUS_ENABLED + "\""
- + ",\"PLMNAllowed\":[{\"PLMN\":\"31026\",\"DataPlanType\":\"unmetered\"},"
- + "{\"PLMN\":\"302820\",\"DataPlanType\":\"metered\"}]"
+ + ",\"PLMNAllowed\":[{\"PLMN\":\"31026\",\"DataPlanType\":\"unmetered\",\"AllowedServicesInfo\":[{\"AllowedServices\":{\"ServiceType\":\"data\",\"ServicePolicy\":\"constrained\"}}]},"
+ + "{\"PLMN\":\"302820\",\"DataPlanType\":\"metered\",\"AllowedServicesInfo\":[{\"AllowedServices\":{\"ServiceType\":\"voice\",\"ServicePolicy\":\"unconstrained\"}}]}]"
+ getBarredPlmns(firstPlmn, secondPlmn)
+ "}}";
}