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