Merge "Removing permission check" into main
diff --git a/src/com/android/phone/EventLogTags.logtags b/src/com/android/phone/EventLogTags.logtags
index 474a01c..f7654af 100644
--- a/src/com/android/phone/EventLogTags.logtags
+++ b/src/com/android/phone/EventLogTags.logtags
@@ -1,4 +1,4 @@
-# See system/core/logcat/event.logtags for a description of the format of this file.
+# See system/logging/logcat/event.logtags for a description of the format of this file.
option java_package com.android.phone;
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index c29d1b3..6dcfa03 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -26,6 +26,9 @@
import static android.telephony.satellite.SatelliteManager.KEY_SATELLITE_COMMUNICATION_ALLOWED;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_ACCESS_BARRED;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED;
+import static android.telephony.satellite.SatelliteManager.SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP;
import static com.android.internal.telephony.PhoneConstants.PHONE_TYPE_CDMA;
import static com.android.internal.telephony.PhoneConstants.PHONE_TYPE_GSM;
@@ -13228,6 +13231,15 @@
result.accept(resultCode);
return;
}
+ List<Integer> disallowedReasons =
+ mSatelliteAccessController.getSatelliteDisallowedReasons();
+ if (disallowedReasons.stream().anyMatch(r ->
+ (r == SATELLITE_DISALLOWED_REASON_UNSUPPORTED_DEFAULT_MSG_APP
+ || r == SATELLITE_DISALLOWED_REASON_NOT_PROVISIONED
+ || r == SATELLITE_DISALLOWED_REASON_NOT_SUPPORTED))) {
+ result.accept(SATELLITE_RESULT_ACCESS_BARRED);
+ return;
+ }
if (isAllowed) {
ResultReceiver resultReceiver = new ResultReceiver(mMainThreadHandler) {
@Override
diff --git a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
index fa56cd0..9618f7a 100644
--- a/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
+++ b/src/com/android/phone/satellite/accesscontrol/SatelliteAccessController.java
@@ -184,7 +184,8 @@
private static final String KEY_AVAILABLE_NOTIFICATION_SHOWN = "available_notification_shown";
private static final String KEY_UNAVAILABLE_NOTIFICATION_SHOWN =
"unavailable_notification_shown";
- private static final String NOTIFICATION_TAG = "SatelliteAccessController";
+ private static final String AVAILABLE_NOTIFICATION_TAG = "available_notification_tag";
+ private static final String UNAVAILABLE_NOTIFICATION_TAG = "unavailable_notification_tag";
private static final int NOTIFICATION_ID = 1;
private static final String NOTIFICATION_CHANNEL = "satelliteChannel";
private static final String NOTIFICATION_CHANNEL_ID = "satellite";
@@ -471,6 +472,7 @@
mControllerMetricsStats = ControllerMetricsStats.getInstance();
mAccessControllerMetricsStats = AccessControllerMetricsStats.getInstance();
initSharedPreferences(context);
+ checkSharedPreference();
loadOverlayConfigs(context);
// loadConfigUpdaterConfigs has to be called after loadOverlayConfigs
// since config updater config has higher priority and thus can override overlay config
@@ -1488,7 +1490,11 @@
logd("mSatelliteDisallowedReasons:"
+ String.join(", ", mSatelliteDisallowedReasons.toString()));
notifySatelliteDisallowedReasonsChanged();
- if (mFeatureFlags.carrierRoamingNbIotNtn() && mNotifySatelliteAvailabilityEnabled) {
+ int subId = mSatelliteController.getSelectedSatelliteSubId();
+ int carrierRoamingNtnConnectType =
+ mSatelliteController.getCarrierRoamingNtnConnectType(subId);
+ if (mSatelliteController.isSatelliteSystemNotificationsEnabled(
+ carrierRoamingNtnConnectType)) {
showSatelliteSystemNotification();
}
}
@@ -1500,44 +1506,59 @@
}
if (mSatelliteDisallowedReasons.isEmpty()) {
- if (!hasAlreadyNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, 0)) {
+ mNotificationManager.cancel(UNAVAILABLE_NOTIFICATION_TAG, NOTIFICATION_ID);
+ if (!hasAlreadyNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN)) {
mNotificationManager.notifyAsUser(
- NOTIFICATION_TAG,
+ AVAILABLE_NOTIFICATION_TAG,
NOTIFICATION_ID,
mSatelliteAvailableNotification,
UserHandle.ALL
);
- markAsNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, 0);
+ markAsNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, true);
+ markAsNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, false);
}
} else {
+ mNotificationManager.cancel(AVAILABLE_NOTIFICATION_TAG, NOTIFICATION_ID);
for (Integer reason : mSatelliteDisallowedReasons) {
- if (!hasAlreadyNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, reason)) {
+ if (!hasAlreadyNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN)) {
mNotificationManager.notifyAsUser(
- NOTIFICATION_TAG,
+ UNAVAILABLE_NOTIFICATION_TAG,
NOTIFICATION_ID,
mSatelliteUnAvailableNotifications.get(reason),
UserHandle.ALL
);
- markAsNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, reason);
+ markAsNotified(KEY_UNAVAILABLE_NOTIFICATION_SHOWN, true);
+ markAsNotified(KEY_AVAILABLE_NOTIFICATION_SHOWN, false);
break;
}
}
}
}
- private boolean hasAlreadyNotified(String key, int reason) {
- Set<String> reasons = mSharedPreferences.getStringSet(key, new HashSet<>());
- return reasons.contains(String.valueOf(reason));
+ private boolean hasAlreadyNotified(String key) {
+ return mSharedPreferences.getBoolean(key, false);
}
- private void markAsNotified(String key, int reason) {
- Set<String> reasons = mSharedPreferences.getStringSet(key, new HashSet<>());
- if (!reasons.contains(String.valueOf(reason))) {
- reasons.add(String.valueOf(reason));
- SharedPreferences.Editor editor = mSharedPreferences.edit();
- editor.putStringSet(key, reasons);
- editor.apply();
- }
+ private void markAsNotified(String key, boolean notified) {
+ mSharedPreferences.edit().putBoolean(key, notified).apply();
+ }
+
+ private void checkSharedPreference() {
+ String[] keys = {
+ CONFIG_UPDATER_SATELLITE_IS_ALLOW_ACCESS_CONTROL_KEY,
+ LATEST_SATELLITE_COMMUNICATION_ALLOWED_KEY,
+ KEY_AVAILABLE_NOTIFICATION_SHOWN,
+ KEY_UNAVAILABLE_NOTIFICATION_SHOWN
+ };
+ // An Exception may occur if the initial value is set to HashSet while attempting to obtain
+ // a boolean value. If an exception occurs, the SharedPreferences will be removed with Keys.
+ Arrays.stream(keys).forEach(key -> {
+ try {
+ mSharedPreferences.getBoolean(key, false);
+ } catch (ClassCastException e) {
+ mSharedPreferences.edit().remove(key).apply();
+ }
+ });
}
/**
diff --git a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
index 8d9850d..1f46ff6 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementController.java
@@ -489,7 +489,11 @@
logd("queryCompleted: updateSatelliteEntitlementStatus");
updateSatelliteEntitlementStatus(subId, entitlementResult.getEntitlementStatus() ==
SatelliteEntitlementResult.SATELLITE_ENTITLEMENT_STATUS_ENABLED,
- entitlementResult.getAllowedPLMNList(), entitlementResult.getBarredPLMNList());
+ entitlementResult.getAllowedPLMNList(), entitlementResult.getBarredPLMNList(),
+ entitlementResult.getDataPlanInfoForPlmnList(),
+ entitlementResult.getAvailableServiceTypeInfoForPlmnList(),
+ entitlementResult.getDataServicePolicyInfoForPlmnList(),
+ entitlementResult.getVoiceServicePolicyInfoForPlmnList());
}
private boolean shouldStartQueryEntitlement(int subId) {
@@ -546,7 +550,10 @@
mSatelliteEntitlementResultPerSub.put(subId, enabledResult);
}
updateSatelliteEntitlementStatus(subId, true, enabledResult.getAllowedPLMNList(),
- enabledResult.getBarredPLMNList());
+ enabledResult.getBarredPLMNList(), enabledResult.getDataPlanInfoForPlmnList(),
+ enabledResult.getAvailableServiceTypeInfoForPlmnList(),
+ enabledResult.getDataServicePolicyInfoForPlmnList(),
+ enabledResult.getVoiceServicePolicyInfoForPlmnList());
}
resetEntitlementQueryPerSubId(subId);
}
@@ -655,9 +662,14 @@
*/
@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,
+ Map<String, List<Integer>>plmnAllowedServicesMap,
+ Map<String,Integer>plmnDataServicePolicyMap,
+ Map<String, Integer>plmnVoiceServicePolicyMap) {
SatelliteController.getInstance().onSatelliteEntitlementStatusUpdated(subId, enabled,
- plmnAllowedList, plmnBarredList, 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 014e28e..5d531fc 100644
--- a/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
+++ b/src/com/android/phone/satellite/entitlement/SatelliteEntitlementResult.java
@@ -16,12 +16,23 @@
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;
+
import android.annotation.IntDef;
import com.android.internal.telephony.satellite.SatelliteNetworkInfo;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -112,4 +123,85 @@
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;
+ }
+
+ /**
+ * 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/accesscontrol/SatelliteAccessControllerTest.java b/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
index a47095d..315184e 100644
--- a/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
+++ b/tests/src/com/android/phone/satellite/accesscontrol/SatelliteAccessControllerTest.java
@@ -65,6 +65,7 @@
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
@@ -234,6 +235,7 @@
@Mock
private ConcurrentHashMap<IBinder, ISatelliteCommunicationAllowedStateCallback>
mSatelliteCommunicationAllowedStateCallbackMap;
+ private SatelliteInfo mSatelliteInfo;
private TestableLooper mTestableLooper;
private Phone[] mPhones;
@@ -422,6 +424,13 @@
mMockApplicationInfo.targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE;
when(mMockPackageManager.getApplicationInfo(anyString(), anyInt()))
.thenReturn(mMockApplicationInfo);
+
+ mSatelliteInfo = new SatelliteInfo(
+ UUID.randomUUID(),
+ new SatellitePosition(10, 15),
+ new ArrayList<>(Arrays.asList(5, 30)),
+ new ArrayList<>(Arrays.asList(new EarfcnRange(0, 250))));
+
mSatelliteAccessControllerUT = new TestSatelliteAccessController(mMockContext,
mMockFeatureFlags, mTestableLooper.getLooper(), mMockLocationManager,
mMockTelecomManager, mMockSatelliteOnDeviceAccessController, mMockSatS2File);
@@ -658,7 +667,7 @@
Parcel satelliteAccessconfigParcel = Parcel.obtain();
List<SatelliteInfo> satelliteInfoList = new ArrayList<>();
- satelliteInfoList.add(mock(SatelliteInfo.class));
+ satelliteInfoList.add(mSatelliteInfo);
satelliteAccessconfigParcel.writeTypedList(satelliteInfoList);
List<Integer> tagIds = new ArrayList<>(List.of(1, 2));
@@ -1476,7 +1485,7 @@
// These APIs are executed during loadRemoteConfigs
verify(mMockSharedPreferences, times(1)).getStringSet(anyString(), any());
- verify(mMockSharedPreferences, times(1)).getBoolean(anyString(), anyBoolean());
+ verify(mMockSharedPreferences, times(5)).getBoolean(anyString(), anyBoolean());
// satelliteConfig is null
SatelliteConfigParser spyConfigParser =
@@ -1847,22 +1856,18 @@
int[] expectedBandsArray = IntStream.concat(
IntStream.concat(Arrays.stream(bands1), Arrays.stream(bands2)),
Arrays.stream(bands3)).toArray();
- int[] actualBandsArray = IntStream.range(0, systemSelectionSpecifier.getBands().size()).map(
- systemSelectionSpecifier.getBands()::get).toArray();
+ int[] actualBandsArray = systemSelectionSpecifier.getBands();
assertArrayEquals(expectedBandsArray, actualBandsArray);
int[] expectedEarfcnsArray = {300, 301, 310, 311, 320, 321, 330, 331, 340, 341, 350, 351};
- int[] actualEarfcnsArray = IntStream.range(0,
- systemSelectionSpecifier.getEarfcns().size()).map(
- systemSelectionSpecifier.getEarfcns()::get).toArray();
+ int[] actualEarfcnsArray = systemSelectionSpecifier.getEarfcns();
assertArrayEquals(expectedEarfcnsArray, actualEarfcnsArray);
SatelliteInfo[] expectedSatelliteInfos = {satelliteInfo1, satelliteInfo2, satelliteInfo3};
- assertArrayEquals(expectedSatelliteInfos, systemSelectionSpecifier.getSatelliteInfos());
+ assertArrayEquals(expectedSatelliteInfos,
+ systemSelectionSpecifier.getSatelliteInfos().toArray(new SatelliteInfo[0]));
- int[] actualTagIdArray = IntStream.range(0,
- systemSelectionSpecifier.getTagIds().size()).map(
- systemSelectionSpecifier.getTagIds()::get).toArray();
+ int[] actualTagIdArray = systemSelectionSpecifier.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
// Verify backward compatibility when there is valid data for default regional config ID
@@ -1884,20 +1889,16 @@
// Data will be same with default regional config ID
// Verify the fields value of given systemSelectionSpecifier matched with expected.
- actualBandsArray = IntStream.range(0, systemSelectionSpecifier.getBands().size()).map(
- systemSelectionSpecifier.getBands()::get).toArray();
+ actualBandsArray = systemSelectionSpecifier.getBands();
assertArrayEquals(expectedBandsArray, actualBandsArray);
- actualEarfcnsArray = IntStream.range(0,
- systemSelectionSpecifier.getEarfcns().size()).map(
- systemSelectionSpecifier.getEarfcns()::get).toArray();
+ actualEarfcnsArray = systemSelectionSpecifier.getEarfcns();
assertArrayEquals(expectedEarfcnsArray, actualEarfcnsArray);
- assertArrayEquals(expectedSatelliteInfos, systemSelectionSpecifier.getSatelliteInfos());
+ assertArrayEquals(expectedSatelliteInfos,
+ systemSelectionSpecifier.getSatelliteInfos().toArray(new SatelliteInfo[0]));
- actualTagIdArray = IntStream.range(0,
- systemSelectionSpecifier.getTagIds().size()).map(
- systemSelectionSpecifier.getTagIds()::get).toArray();
+ actualTagIdArray = systemSelectionSpecifier.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
mSatelliteAccessControllerUT.resetSatelliteAccessConfigMap();
@@ -1984,25 +1985,22 @@
expectedBandList.addAll(bandList2);
expectedBandList.addAll(bandList3);
- List<Integer> actualBandList = IntStream.range(0,
- systemSelectionSpecifier.getBands().size()).map(
- systemSelectionSpecifier.getBands()::get).boxed().toList();
+ List<Integer> actualBandList = Arrays.stream(systemSelectionSpecifier.getBands()).boxed()
+ .collect(Collectors.toList());
assertEquals(expectedBandList, actualBandList);
List<Integer> expectedEarfcnList = new ArrayList<>(
List.of(300, 301, 310, 311, 320, 321, 330, 331, 340, 341, 350, 351));
- List<Integer> actualEarfcnList = IntStream.range(0,
- systemSelectionSpecifier.getEarfcns().size()).map(
- systemSelectionSpecifier.getEarfcns()::get).boxed().toList();
+ List<Integer> actualEarfcnList = Arrays.stream(systemSelectionSpecifier.getEarfcns())
+ .boxed().collect(Collectors.toList());
assertEquals(expectedEarfcnList, actualEarfcnList);
- assertEquals(satelliteInfo1, systemSelectionSpecifier.getSatelliteInfos()[0]);
- assertEquals(satelliteInfo2, systemSelectionSpecifier.getSatelliteInfos()[1]);
- assertEquals(satelliteInfo3, systemSelectionSpecifier.getSatelliteInfos()[2]);
+ assertEquals(satelliteInfo1, systemSelectionSpecifier.getSatelliteInfos().get(0));
+ assertEquals(satelliteInfo2, systemSelectionSpecifier.getSatelliteInfos().get(1));
+ assertEquals(satelliteInfo3, systemSelectionSpecifier.getSatelliteInfos().get(2));
- List<Integer> actualTagIdList = IntStream.range(0,
- systemSelectionSpecifier.getTagIds().size()).map(
- systemSelectionSpecifier.getTagIds()::get).boxed().toList();
+ List<Integer> actualTagIdList = Arrays.stream(systemSelectionSpecifier.getTagIds()).boxed()
+ .collect(Collectors.toList());
assertEquals(tagIdList, actualTagIdList);
// Create satelliteAccessConfiguration with empty list of SatelliteInfo.
@@ -2026,20 +2024,34 @@
systemSelectionSpecifier = capturedList.getFirst();
// Verify the fields value of given systemSelectionSpecifier matched with expected.
- assertEquals(0, systemSelectionSpecifier.getBands().size());
- assertEquals(0, systemSelectionSpecifier.getEarfcns().size());
+ assertEquals(0, systemSelectionSpecifier.getBands().length);
+ assertEquals(0, systemSelectionSpecifier.getEarfcns().length);
SatelliteInfo[] expectedSatelliteInfoArray = new SatelliteInfo[0];
- assertArrayEquals(expectedSatelliteInfoArray, systemSelectionSpecifier.getSatelliteInfos());
+ assertArrayEquals(expectedSatelliteInfoArray,
+ systemSelectionSpecifier.getSatelliteInfos().toArray(new SatelliteInfo[0]));
- actualTagIdList = IntStream.range(0,
- systemSelectionSpecifier.getTagIds().size()).map(
- systemSelectionSpecifier.getTagIds()::get).boxed().toList();
+ actualTagIdList = Arrays.stream(systemSelectionSpecifier.getTagIds()).boxed().collect(
+ Collectors.toList());
assertEquals(tagIdList, actualTagIdList);
mSatelliteAccessControllerUT.resetSatelliteAccessConfigMap();
}
+ @Test
+ public void testCheckSharedPreferenceException() {
+ doReturn(mMockSharedPreferencesEditor).when(mMockSharedPreferencesEditor)
+ .remove(anyString());
+ doThrow(new ClassCastException()).when(mMockSharedPreferences)
+ .getBoolean(anyString(), eq(false));
+
+ mSatelliteAccessControllerUT = new TestSatelliteAccessController(mMockContext,
+ mMockFeatureFlags, mTestableLooper.getLooper(), mMockLocationManager,
+ mMockTelecomManager, mMockSatelliteOnDeviceAccessController, mMockSatS2File);
+
+ verify(mMockSharedPreferencesEditor, times(4)).remove(anyString());
+ }
+
private void sendSatelliteCommunicationAllowedEvent() {
Pair<Integer, ResultReceiver> requestPair =
new Pair<>(DEFAULT_SUBSCRIPTION_ID,
diff --git a/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java b/tests/src/com/android/phone/satellite/entitlement/SatelliteEntitlementControllerTest.java
index f41f861..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,13 @@
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;
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 +35,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 +99,28 @@
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 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;
@@ -173,7 +202,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
mCarrierConfigBundle.putBoolean(
CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
@@ -184,7 +213,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), 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.
@@ -193,7 +222,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
setLastQueryTime(0L);
// Verify don't start the query when retry count is reached max
@@ -206,7 +235,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
replaceInstance(SatelliteEntitlementController.class, "mRetryCountPerSub",
mSatelliteEntitlementController, new HashMap<>());
@@ -220,7 +249,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
replaceInstance(SatelliteEntitlementController.class, "mIsEntitlementInProgressPerSub",
mSatelliteEntitlementController, new HashMap<>());
@@ -228,12 +257,13 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
}
@Test
@@ -246,7 +276,7 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
// Verify don't call the updateSatelliteEntitlementStatus.
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// Verify call the checkSatelliteEntitlementStatus with invalid response.
setIsQueryAvailableTrue();
@@ -261,7 +291,10 @@
// 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), 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();
@@ -269,14 +302,17 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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), 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
@@ -287,43 +323,54 @@
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),
+ 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 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), 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 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), 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_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), 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
@@ -336,7 +383,8 @@
setInternetConnected(true);
setLastQueryTime(0L);
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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();
@@ -344,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), 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
@@ -354,13 +404,16 @@
setInternetConnected(true);
setLastQueryTime(0L);
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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), 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
@@ -429,7 +482,10 @@
// 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), 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.
@@ -525,7 +581,10 @@
// 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), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST), eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST),
+ any());
}
@Test
@@ -540,7 +599,10 @@
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), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -561,13 +623,16 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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), 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
@@ -590,7 +655,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(), anyMap(), anyMap(), anyMap(), any());
// Verify the retry in progress.
sendMessage(CMD_RETRY_QUERY_ENTITLEMENT, SUB_ID);
@@ -599,21 +664,24 @@
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(), 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_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), 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
@@ -625,14 +693,18 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_DISABLED, EMPTY_PLMN_LIST,
- EMPTY_PLMN_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();
// 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), 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(
@@ -641,7 +713,10 @@
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), 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.
@@ -650,14 +725,17 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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 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), eq(PLMN_ALLOWED_SERVICES_LIST), eq(PLMN_DATA_SERVICE_POLICY_LIST),
+ eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
// Verify not call the onSatelliteEntitlementStatusUpdated.
clearInvocationsForMock();
@@ -667,7 +745,9 @@
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), eq(PLMN_ALLOWED_SERVICES_LIST),
+ eq(PLMN_DATA_SERVICE_POLICY_LIST), eq(PLMN_VOICE_SERVICE_POLICY_LIST), any());
}
@Test
@@ -680,13 +760,14 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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(), 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);
@@ -695,7 +776,7 @@
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
verify(mSatelliteController, times(2)).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
}
@Test
@@ -710,20 +791,23 @@
verify(mSatelliteEntitlementApi, never()).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), 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_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), 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
@@ -737,7 +821,7 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), 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.
@@ -747,7 +831,10 @@
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), eq(EMPTY_PLMN_ALLOWED_SERVICES_LIST),
+ eq(EMPTY_PLMN_DATA_SERVICE_POLICY_LIST), eq(EMPTY_PLMN_VOICE_SERVICE_POLICY_LIST),
+ any());
}
@Test
@@ -761,7 +848,7 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), 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.
@@ -771,20 +858,23 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi).checkEntitlementStatus();
verify(mSatelliteController, never()).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), 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_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), 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
@@ -795,12 +885,13 @@
doReturn(mSatelliteEntitlementResult).when(
mSatelliteEntitlementApi).checkEntitlementStatus();
setSatelliteEntitlementResult(SATELLITE_ENTITLEMENT_STATUS_ENABLED, PLMN_ALLOWED_LIST,
- PLMN_BARRED_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(), any());
+ anyBoolean(), anyList(), anyList(), anyMap(), anyMap(), anyMap(), anyMap(), any());
// SIM_REFRESH event occurred before expired the query refresh timer, verify the start
// the query.
@@ -809,8 +900,9 @@
mTestableLooper.processAllMessages();
verify(mSatelliteEntitlementApi, times(2)).checkEntitlementStatus();
- verify(mSatelliteController, times(2)).onSatelliteEntitlementStatusUpdated(anyInt(),
- anyBoolean(), anyList(), anyList(), any());
+ verify(mSatelliteController, times(2))
+ .onSatelliteEntitlementStatusUpdated(anyInt(), anyBoolean(), anyList(), anyList(),
+ anyMap(), anyMap(), anyMap(), anyMap(), any());
}
private void triggerCarrierConfigChanged() {
@@ -868,10 +960,21 @@
}
private void setSatelliteEntitlementResult(int entitlementStatus,
- List<String> plmnAllowedList, List<String> plmnBarredList) {
+ List<String> plmnAllowedList, List<String> plmnBarredList,
+ 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)
+ "}}";
}