Merge "Fix wrong transfer time log for incoming satellite datagram" into main
diff --git a/flags/calling.aconfig b/flags/calling.aconfig
index 906abfc..65cfbaf 100644
--- a/flags/calling.aconfig
+++ b/flags/calling.aconfig
@@ -69,4 +69,5 @@
namespace: "telephony"
description: "Used to notify the emergency callback mode for call/SMS to other applications."
bug:"359064059"
+ is_exported: true
}
diff --git a/flags/data.aconfig b/flags/data.aconfig
index ba1be88..17d1adb 100644
--- a/flags/data.aconfig
+++ b/flags/data.aconfig
@@ -127,4 +127,5 @@
namespace: "telephony"
description: "Support OEM_PAID and OEM_PRIVATE networks"
bug: "366194627"
+ is_exported: true
}
diff --git a/flags/ims.aconfig b/flags/ims.aconfig
index 4ce7508..703440f 100644
--- a/flags/ims.aconfig
+++ b/flags/ims.aconfig
@@ -155,6 +155,7 @@
namespace: "telephony"
description: "Used to expose SMS related hidden APIs for SMS over IMS to public API."
bug:"359721349"
+ is_exported: true
}
# OWNER=jhyoon TARGET=25Q2
@@ -163,4 +164,5 @@
namespace: "telephony"
description: "This flag controls the type of API regarding MmTelFeature, either hidden or system type."
bug:"359721349"
+ is_exported: true
}
diff --git a/flags/satellite.aconfig b/flags/satellite.aconfig
index 8662572..ee4570e 100644
--- a/flags/satellite.aconfig
+++ b/flags/satellite.aconfig
@@ -41,6 +41,7 @@
namespace: "telephony"
description: "This flag enables satellite carrier roaming to nb iot ntn."
bug:"348253735"
+ is_exported: true
}
# OWNER=tnd TARGET=24Q4
@@ -78,4 +79,5 @@
namespace: "telephony"
description: "Introduce SatelliteManager APIs for carrier apps to monitor satellite state change"
bug: "357638490"
+ is_exported: true
}
diff --git a/flags/subscription.aconfig b/flags/subscription.aconfig
index aea9bd0..0522a3c 100644
--- a/flags/subscription.aconfig
+++ b/flags/subscription.aconfig
@@ -88,4 +88,5 @@
namespace: "telephony"
description: "Provide APIs to retrieve the status and recurrence rule info on a subscription plan"
bug: "357272015"
+ is_exported: true
}
diff --git a/flags/uicc.aconfig b/flags/uicc.aconfig
index aed4bff..edb4ce2 100644
--- a/flags/uicc.aconfig
+++ b/flags/uicc.aconfig
@@ -49,6 +49,7 @@
namespace: "telephony"
description: "This flag controls the visibility of the setCarrierRestrictionStatus API in carrierRestrictionRules class."
bug:"342411308"
+ is_exported: true
}
# OWNER=arunvoddu TARGET=24Q4
@@ -87,6 +88,7 @@
namespace: "telephony"
description: "This flag controls the type of API that retrieves ISIM records, either hidden or system type."
bug:"359721349"
+ is_exported: true
}
# OWNER=jinjeong TARGET=25Q2
@@ -95,6 +97,7 @@
namespace: "telephony"
description: "This flag controls to get a carrier id using a carrier identifier."
bug:"378778278"
+ is_exported: true
}
# OWNER=arunvoddu TARGET=25Q2
@@ -107,3 +110,11 @@
purpose: PURPOSE_BUGFIX
}
}
+
+# OWNER=jinjeong TARGET=25Q2
+flag {
+ name: "get_group_id_level2"
+ namespace: "telephony"
+ description: "This flag controls to get a group id level2."
+ bug:"381171540"
+}
diff --git a/src/java/com/android/internal/telephony/CommandsInterface.java b/src/java/com/android/internal/telephony/CommandsInterface.java
index ee7447c..1b19c99 100644
--- a/src/java/com/android/internal/telephony/CommandsInterface.java
+++ b/src/java/com/android/internal/telephony/CommandsInterface.java
@@ -2952,4 +2952,39 @@
* @param h Handler to be removed from the registrant list.
*/
default void unregisterForSecurityAlgorithmUpdates(Handler h) {}
+
+ /**
+ * Set the non-terrestrial PLMN with lower priority than terrestrial networks.
+ *
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param carrierPlmnList The list of roaming PLMN used for connecting to satellite networks
+ * supported by user subscription.
+ * @param allSatellitePlmnList Modem should use the allSatellitePlmnList to identify satellite
+ * PLMNs that are not supported by the carrier and make sure not to
+ * attach to them.
+ * @param result Callback message to receive the result.
+ */
+ default void setSatellitePlmn(int simSlot,
+ @NonNull List<String> carrierPlmnList, @NonNull List<String> allSatellitePlmnList,
+ Message result) {}
+
+ /**
+ * Enable or disable satellite in the cellular modem associated with a carrier.
+ *
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param satelliteEnabled {@code true} to enable satellite, {@code false} to disable satellite.
+ * @param result Callback message to receive the result.
+ */
+ default void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
+ Message result) {}
+
+ /**
+ * Check whether satellite is enabled in the cellular modem associated with a carrier.
+ *
+ * @param simSlot Indicates the SIM slot to which this API will be applied.
+ * @param result Callback message to receive the result.
+ */
+ default void isSatelliteEnabledForCarrier(int simSlot, Message result) {}
}
diff --git a/src/java/com/android/internal/telephony/EventLogTags.logtags b/src/java/com/android/internal/telephony/EventLogTags.logtags
index b5e458b..2f30c33 100644
--- a/src/java/com/android/internal/telephony/EventLogTags.logtags
+++ b/src/java/com/android/internal/telephony/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.internal.telephony;
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
index 175bbb5..5a73cae 100644
--- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java
+++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java
@@ -3775,6 +3775,13 @@
&& disclosure != null) {
mIdentifierDisclosureNotifier.addDisclosure(mContext, getSubId(), disclosure);
}
+ if (mFeatureFlags.cellularIdentifierDisclosureIndications()
+ && mIdentifierDisclosureNotifier != null
+ && disclosure != null) {
+ logd("EVENT_CELL_IDENTIFIER_DISCLOSURE for non-Safety Center listeners "
+ + "phoneId = " + getPhoneId());
+ mNotifier.notifyCellularIdentifierDisclosedChanged(this, disclosure);
+ }
break;
case EVENT_SET_IDENTIFIER_DISCLOSURE_ENABLED_DONE:
@@ -3785,13 +3792,21 @@
case EVENT_SECURITY_ALGORITHM_UPDATE:
logd("EVENT_SECURITY_ALGORITHM_UPDATE phoneId = " + getPhoneId());
+
+ ar = (AsyncResult) msg.obj;
+ SecurityAlgorithmUpdate update = (SecurityAlgorithmUpdate) ar.result;
+
if (mFeatureFlags.enableModemCipherTransparencyUnsolEvents()
&& mNullCipherNotifier != null) {
- ar = (AsyncResult) msg.obj;
- SecurityAlgorithmUpdate update = (SecurityAlgorithmUpdate) ar.result;
mNullCipherNotifier.onSecurityAlgorithmUpdate(mContext, getPhoneId(),
getSubId(), update);
}
+ if (mFeatureFlags.securityAlgorithmsUpdateIndications()
+ && mNullCipherNotifier != null) {
+ logd("EVENT_SECURITY_ALGORITHM_UPDATE for non-Safety Center listeners "
+ + "phoneId = " + getPhoneId());
+ mNotifier.notifySecurityAlgorithmsChanged(this, update);
+ }
break;
case EVENT_SET_SECURITY_ALGORITHMS_UPDATED_ENABLED_DONE:
diff --git a/src/java/com/android/internal/telephony/NetworkResponse.java b/src/java/com/android/internal/telephony/NetworkResponse.java
index b4a37b3..ccf066f 100644
--- a/src/java/com/android/internal/telephony/NetworkResponse.java
+++ b/src/java/com/android/internal/telephony/NetworkResponse.java
@@ -551,6 +551,36 @@
}
}
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error
+ */
+ public void setSatellitePlmnResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
+ }
+
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error
+ */
+ public void setSatelliteEnabledForCarrierResponse(RadioResponseInfo responseInfo) {
+ RadioResponse.responseVoid(HAL_SERVICE_NETWORK, mRil, responseInfo);
+ }
+
+ /**
+ * @param responseInfo Response info struct containing response type, serial no. and error.
+ * @param isEnabled Indicates whether satellite is enabled for carrier or not.
+ */
+ public void isSatelliteEnabledForCarrierResponse(RadioResponseInfo responseInfo,
+ boolean isEnabled) {
+ RILRequest rr = mRil.processResponse(HAL_SERVICE_NETWORK, responseInfo);
+
+ if (rr != null) {
+ if (responseInfo.error == RadioError.NONE) {
+ RadioResponse.sendMessageResponse(rr.mResult, isEnabled);
+ }
+ mRil.processResponseDone(rr, responseInfo, isEnabled);
+ }
+ }
+
@Override
public String getInterfaceHash() {
return IRadioNetworkResponse.HASH;
diff --git a/src/java/com/android/internal/telephony/PhoneSubInfoController.java b/src/java/com/android/internal/telephony/PhoneSubInfoController.java
index c40193e..9801542 100644
--- a/src/java/com/android/internal/telephony/PhoneSubInfoController.java
+++ b/src/java/com/android/internal/telephony/PhoneSubInfoController.java
@@ -659,6 +659,20 @@
});
}
+ /**
+ * Return GroupIdLevel2 for the subscriber
+ */
+ public String getGroupIdLevel2ForSubscriber(int subId, String callingPackage,
+ String callingFeatureId) {
+ return callPhoneMethodForSubIdWithPrivilegedCheck(subId,
+ "getGroupIdLevel2", (phone)-> {
+ enforceTelephonyFeatureWithException(callingPackage,
+ PackageManager.FEATURE_TELEPHONY_SUBSCRIPTION,
+ "getGroupIdLevel2ForSubscriber");
+ return phone.getGroupIdLevel2();
+ });
+ }
+
/** Below are utility methods that abstracts the flow that many public methods use:
* 1. Check permission: pass, throw exception, or fails (returns false).
* 2. clearCallingIdentity.
diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java
index 34ac832..1bb9984 100644
--- a/src/java/com/android/internal/telephony/RIL.java
+++ b/src/java/com/android/internal/telephony/RIL.java
@@ -181,6 +181,9 @@
/** @hide */
public static final HalVersion RADIO_HAL_VERSION_2_3 = new HalVersion(2, 3);
+ /** @hide */
+ public static final HalVersion RADIO_HAL_VERSION_2_4 = new HalVersion(2, 4);
+
// Hal version
private final Map<Integer, HalVersion> mHalVersion = new HashMap<>();
@@ -5352,6 +5355,102 @@
});
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSatellitePlmn(int simSlot, @NonNull List<String> carrierPlmnList,
+ @NonNull List<String> allSatellitePlmnList, Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "setSatellitePlmn",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_4)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_PLMN, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " simSlot=" + simSlot + " carrierPlmnList=" + carrierPlmnList
+ + " allSatellitePlmnList=" + allSatellitePlmnList);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK,
+ rr,
+ "setSatellitePlmn",
+ () -> {
+ networkProxy.setSatellitePlmn(rr.mSerial, simSlot, carrierPlmnList,
+ allSatellitePlmnList);
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setSatelliteEnabledForCarrier(int simSlot, boolean satelliteEnabled,
+ Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "setSatelliteEnabledForCarrier",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_4)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " simSlot=" + simSlot + " satelliteEnabled=" + satelliteEnabled);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK,
+ rr,
+ "setSatelliteEnabledForCarrier",
+ () -> {
+ networkProxy.setSatelliteEnabledForCarrier(rr.mSerial, simSlot,
+ satelliteEnabled);
+ });
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void isSatelliteEnabledForCarrier(int simSlot, Message result) {
+ RadioNetworkProxy networkProxy = getRadioServiceProxy(RadioNetworkProxy.class);
+ if (!canMakeRequest(
+ "isSatelliteEnabledForCarrier",
+ networkProxy,
+ result,
+ RADIO_HAL_VERSION_2_4)) {
+ return;
+ }
+
+ RILRequest rr = obtainRequest(RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER, result,
+ mRILDefaultWorkSource);
+
+ if (RILJ_LOGD) {
+ riljLog(rr.serialString() + "> " + RILUtils.requestToString(rr.mRequest)
+ + " simSlot=" + simSlot);
+ }
+
+ radioServiceInvokeHelper(
+ HAL_SERVICE_NETWORK, rr, "isSatelliteEnabledForCarrier", () -> {
+ networkProxy.isSatelliteEnabledForCarrier(rr.mSerial, simSlot);
+ });
+ }
+
+
//***** Private Methods
/**
* This is a helper function to be called when an indication callback is called for any radio
@@ -6216,6 +6315,7 @@
case 2: return RADIO_HAL_VERSION_2_1;
case 3: return RADIO_HAL_VERSION_2_2;
case 4: return RADIO_HAL_VERSION_2_3;
+ case 5: return RADIO_HAL_VERSION_2_4;
default: return RADIO_HAL_VERSION_UNKNOWN;
}
}
diff --git a/src/java/com/android/internal/telephony/RILUtils.java b/src/java/com/android/internal/telephony/RILUtils.java
index cbf2330..e39e135 100644
--- a/src/java/com/android/internal/telephony/RILUtils.java
+++ b/src/java/com/android/internal/telephony/RILUtils.java
@@ -121,6 +121,7 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_N1_MODE_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_NR_DUAL_CONNECTIVITY_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_NULL_CIPHER_AND_INTEGRITY_ENABLED;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_SECURITY_ALGORITHMS_UPDATED_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_IS_VONR_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_LAST_CALL_FAIL_CAUSE;
@@ -180,6 +181,8 @@
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_DATA_MODEM;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_RADIO_CAPABILITY;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER;
+import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SATELLITE_PLMN;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SECURITY_ALGORITHMS_UPDATED_ENABLED;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIGNAL_STRENGTH_REPORTING_CRITERIA;
import static com.android.internal.telephony.RILConstants.RIL_REQUEST_SET_SIM_CARD_POWER;
@@ -5288,6 +5291,12 @@
return "IS_SECURITY_ALGORITHMS_UPDATED_ENABLED";
case RIL_REQUEST_GET_SIMULTANEOUS_CALLING_SUPPORT:
return "GET_SIMULTANEOUS_CALLING_SUPPORT";
+ case RIL_REQUEST_SET_SATELLITE_PLMN:
+ return "SET_SATELLITE_PLMN";
+ case RIL_REQUEST_SET_SATELLITE_ENABLED_FOR_CARRIER:
+ return "SET_SATELLITE_ENABLED_FOR_CARRIER";
+ case RIL_REQUEST_IS_SATELLITE_ENABLED_FOR_CARRIER:
+ return "IS_SATELLITE_ENABLED_FOR_CARRIER";
default:
return "<unknown request " + request + ">";
}
diff --git a/src/java/com/android/internal/telephony/RadioNetworkProxy.java b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
index 4acc71a..12e6c90 100644
--- a/src/java/com/android/internal/telephony/RadioNetworkProxy.java
+++ b/src/java/com/android/internal/telephony/RadioNetworkProxy.java
@@ -979,4 +979,60 @@
}
// Only supported on AIDL.
}
+
+ /**
+ * Set the non-terrestrial PLMN with lower priority than terrestrial networks.
+ *
+ * @param serial Serial number of request.
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param carrierPlmnList The list of roaming PLMN used for connecting to satellite networks
+ * supported by user subscription.
+ * @param allSatellitePlmnList Modem should use the allSatellitePlmnList to identify satellite
+ * PLMNs that are not supported by the carrier and make sure not to
+ * attach to them.
+ */
+ public void setSatellitePlmn(int serial, int simSlot, List<String> carrierPlmnList,
+ List<String> allSatellitePlmnList) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ String[] carrierPlmnArray = carrierPlmnList.toArray(new String[0]);
+ String[] allSatellitePlmnArray = allSatellitePlmnList.toArray(new String[0]);
+ mNetworkProxy.setSatellitePlmn(serial, simSlot, carrierPlmnArray,
+ allSatellitePlmnArray);
+ }
+ // Only supported on AIDL.
+ }
+
+ /**
+ * Enable or disable satellite in the cellular modem associated with a carrier.
+ *
+ * @param serial Serial number of request.
+ * @param simSlot Indicates the SIM slot to which this API will be applied. The modem will use
+ * this information to determine the relevant carrier.
+ * @param satelliteEnabled {@code true} to enable satellite, {@code false} to disable satellite.
+ */
+ public void setSatelliteEnabledForCarrier(int serial, int simSlot,
+ boolean satelliteEnabled) throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mNetworkProxy.setSatelliteEnabledForCarrier(serial, simSlot, satelliteEnabled);
+ }
+ // Only supported on AIDL.
+ }
+
+ /**
+ * Check whether satellite is enabled in the cellular modem associated with a carrier.
+ *
+ * @param serial Serial number of request.
+ * @param simSlot Indicates the SIM slot to which this API will be applied.
+ */
+ public void isSatelliteEnabledForCarrier(int serial, int simSlot)
+ throws RemoteException {
+ if (isEmpty()) return;
+ if (isAidl()) {
+ mNetworkProxy.isSatelliteEnabledForCarrier(serial, simSlot);
+ }
+ // Only supported on AIDL.
+ }
}
diff --git a/src/java/com/android/internal/telephony/SmsDispatchersController.java b/src/java/com/android/internal/telephony/SmsDispatchersController.java
index dd738c0..91aac26 100644
--- a/src/java/com/android/internal/telephony/SmsDispatchersController.java
+++ b/src/java/com/android/internal/telephony/SmsDispatchersController.java
@@ -1235,7 +1235,7 @@
notifySmsSentToEmergencyStateTracker(tracker.mDestAddress,
tracker.mMessageId, isOverIms, isLastSmsPart, success);
notifySmsSentToDatagramDispatcher(tracker.mUniqueMessageId,
- tracker.isSinglePartOrLastPart(), !tracker.isAnyPartFailed());
+ tracker.isSinglePartOrLastPart(), success && !tracker.isAnyPartFailed());
}
/**
diff --git a/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java b/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java
index 9f74890..fdd0c0a 100644
--- a/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java
+++ b/src/java/com/android/internal/telephony/metrics/PersistAtomsStorage.java
@@ -177,7 +177,6 @@
/** Maximum number of Satellite relevant stats to store between pulls. */
private final int mMaxNumSatelliteStats;
- private final int mMaxNumSatelliteControllerStats = 1;
private final int mMaxNumCarrierRoamingSatelliteSessionStats = 1;
/** Maximum number of data network validation to store during pulls. */
@@ -710,76 +709,75 @@
/** Adds a new {@link SatelliteController} to the storage. */
public synchronized void addSatelliteControllerStats(SatelliteController stats) {
- // SatelliteController is a single data point
- SatelliteController[] atomArray = mAtoms.satelliteController;
- if (atomArray == null || atomArray.length == 0) {
- atomArray = new SatelliteController[] {new SatelliteController()};
+ // find existing satellite controller atom with same carrier ID.
+ SatelliteController existingStats = find(stats);
+ if (existingStats != null) {
+ existingStats.countOfSatelliteServiceEnablementsSuccess
+ += stats.countOfSatelliteServiceEnablementsSuccess;
+ existingStats.countOfSatelliteServiceEnablementsFail
+ += stats.countOfSatelliteServiceEnablementsFail;
+ existingStats.countOfOutgoingDatagramSuccess
+ += stats.countOfOutgoingDatagramSuccess;
+ existingStats.countOfOutgoingDatagramFail
+ += stats.countOfOutgoingDatagramFail;
+ existingStats.countOfIncomingDatagramSuccess
+ += stats.countOfIncomingDatagramSuccess;
+ existingStats.countOfIncomingDatagramFail
+ += stats.countOfIncomingDatagramFail;
+ existingStats.countOfDatagramTypeSosSmsSuccess
+ += stats.countOfDatagramTypeSosSmsSuccess;
+ existingStats.countOfDatagramTypeSosSmsFail
+ += stats.countOfDatagramTypeSosSmsFail;
+ existingStats.countOfDatagramTypeLocationSharingSuccess
+ += stats.countOfDatagramTypeLocationSharingSuccess;
+ existingStats.countOfDatagramTypeLocationSharingFail
+ += stats.countOfDatagramTypeLocationSharingFail;
+ existingStats.countOfProvisionSuccess
+ += stats.countOfProvisionSuccess;
+ existingStats.countOfProvisionFail
+ += stats.countOfProvisionFail;
+ existingStats.countOfDeprovisionSuccess
+ += stats.countOfDeprovisionSuccess;
+ existingStats.countOfDeprovisionFail
+ += stats.countOfDeprovisionFail;
+ existingStats.totalServiceUptimeSec
+ += stats.totalServiceUptimeSec;
+ existingStats.totalBatteryConsumptionPercent
+ += stats.totalBatteryConsumptionPercent;
+ existingStats.totalBatteryChargedTimeSec
+ += stats.totalBatteryChargedTimeSec;
+ existingStats.countOfDemoModeSatelliteServiceEnablementsSuccess
+ += stats.countOfDemoModeSatelliteServiceEnablementsSuccess;
+ existingStats.countOfDemoModeSatelliteServiceEnablementsFail
+ += stats.countOfDemoModeSatelliteServiceEnablementsFail;
+ existingStats.countOfDemoModeOutgoingDatagramSuccess
+ += stats.countOfDemoModeOutgoingDatagramSuccess;
+ existingStats.countOfDemoModeOutgoingDatagramFail
+ += stats.countOfDemoModeOutgoingDatagramFail;
+ existingStats.countOfDemoModeIncomingDatagramSuccess
+ += stats.countOfDemoModeIncomingDatagramSuccess;
+ existingStats.countOfDemoModeIncomingDatagramFail
+ += stats.countOfDemoModeIncomingDatagramFail;
+ existingStats.countOfDatagramTypeKeepAliveSuccess
+ += stats.countOfDatagramTypeKeepAliveSuccess;
+ existingStats.countOfDatagramTypeKeepAliveFail
+ += stats.countOfDatagramTypeKeepAliveFail;
+ existingStats.countOfAllowedSatelliteAccess += stats.countOfAllowedSatelliteAccess;
+ existingStats.countOfDisallowedSatelliteAccess
+ += stats.countOfDisallowedSatelliteAccess;
+ existingStats.countOfSatelliteAccessCheckFail += stats.countOfSatelliteAccessCheckFail;
+
+ existingStats.isProvisioned = stats.isProvisioned;
+
+ existingStats.countOfSatelliteAllowedStateChangedEvents
+ += stats.countOfSatelliteAllowedStateChangedEvents;
+ existingStats.countOfSuccessfulLocationQueries +=
+ stats.countOfSuccessfulLocationQueries;
+ existingStats.countOfFailedLocationQueries += stats.countOfFailedLocationQueries;
+ } else {
+ mAtoms.satelliteController = insertAtRandomPlace(mAtoms.satelliteController, stats,
+ mMaxNumSatelliteStats);
}
-
- SatelliteController atom = atomArray[0];
- atom.countOfSatelliteServiceEnablementsSuccess
- += stats.countOfSatelliteServiceEnablementsSuccess;
- atom.countOfSatelliteServiceEnablementsFail
- += stats.countOfSatelliteServiceEnablementsFail;
- atom.countOfOutgoingDatagramSuccess
- += stats.countOfOutgoingDatagramSuccess;
- atom.countOfOutgoingDatagramFail
- += stats.countOfOutgoingDatagramFail;
- atom.countOfIncomingDatagramSuccess
- += stats.countOfIncomingDatagramSuccess;
- atom.countOfIncomingDatagramFail
- += stats.countOfIncomingDatagramFail;
- atom.countOfDatagramTypeSosSmsSuccess
- += stats.countOfDatagramTypeSosSmsSuccess;
- atom.countOfDatagramTypeSosSmsFail
- += stats.countOfDatagramTypeSosSmsFail;
- atom.countOfDatagramTypeLocationSharingSuccess
- += stats.countOfDatagramTypeLocationSharingSuccess;
- atom.countOfDatagramTypeLocationSharingFail
- += stats.countOfDatagramTypeLocationSharingFail;
- atom.countOfProvisionSuccess
- += stats.countOfProvisionSuccess;
- atom.countOfProvisionFail
- += stats.countOfProvisionFail;
- atom.countOfDeprovisionSuccess
- += stats.countOfDeprovisionSuccess;
- atom.countOfDeprovisionFail
- += stats.countOfDeprovisionFail;
- atom.totalServiceUptimeSec
- += stats.totalServiceUptimeSec;
- atom.totalBatteryConsumptionPercent
- += stats.totalBatteryConsumptionPercent;
- atom.totalBatteryChargedTimeSec
- += stats.totalBatteryChargedTimeSec;
- atom.countOfDemoModeSatelliteServiceEnablementsSuccess
- += stats.countOfDemoModeSatelliteServiceEnablementsSuccess;
- atom.countOfDemoModeSatelliteServiceEnablementsFail
- += stats.countOfDemoModeSatelliteServiceEnablementsFail;
- atom.countOfDemoModeOutgoingDatagramSuccess
- += stats.countOfDemoModeOutgoingDatagramSuccess;
- atom.countOfDemoModeOutgoingDatagramFail
- += stats.countOfDemoModeOutgoingDatagramFail;
- atom.countOfDemoModeIncomingDatagramSuccess
- += stats.countOfDemoModeIncomingDatagramSuccess;
- atom.countOfDemoModeIncomingDatagramFail
- += stats.countOfDemoModeIncomingDatagramFail;
- atom.countOfDatagramTypeKeepAliveSuccess
- += stats.countOfDatagramTypeKeepAliveSuccess;
- atom.countOfDatagramTypeKeepAliveFail
- += stats.countOfDatagramTypeKeepAliveFail;
- atom.countOfAllowedSatelliteAccess += stats.countOfAllowedSatelliteAccess;
- atom.countOfDisallowedSatelliteAccess += stats.countOfDisallowedSatelliteAccess;
- atom.countOfSatelliteAccessCheckFail += stats.countOfSatelliteAccessCheckFail;
-
- atom.isProvisioned = stats.isProvisioned;
- atom.carrierId = stats.carrierId;
-
- atom.countOfSatelliteAllowedStateChangedEvents
- += stats.countOfSatelliteAllowedStateChangedEvents;
- atom.countOfSuccessfulLocationQueries += stats.countOfSuccessfulLocationQueries;
- atom.countOfFailedLocationQueries += stats.countOfFailedLocationQueries;
-
- mAtoms.satelliteController = atomArray;
saveAtomsToFile(SAVE_TO_FILE_DELAY_FOR_UPDATE_MILLIS);
}
@@ -1825,7 +1823,7 @@
atoms.outgoingShortCodeSms = sanitizeAtoms(atoms.outgoingShortCodeSms,
OutgoingShortCodeSms.class, mMaxOutgoingShortCodeSms);
atoms.satelliteController = sanitizeAtoms(atoms.satelliteController,
- SatelliteController.class, mMaxNumSatelliteControllerStats);
+ SatelliteController.class, mMaxNumSatelliteStats);
atoms.satelliteSession = sanitizeAtoms(atoms.satelliteSession,
SatelliteSession.class, mMaxNumSatelliteStats);
atoms.satelliteIncomingDatagram = sanitizeAtoms(atoms.satelliteIncomingDatagram,
@@ -1848,7 +1846,7 @@
mMaxNumSatelliteStats);
atoms.carrierRoamingSatelliteControllerStats = sanitizeAtoms(
atoms.carrierRoamingSatelliteControllerStats,
- CarrierRoamingSatelliteControllerStats.class, mMaxNumSatelliteControllerStats);
+ CarrierRoamingSatelliteControllerStats.class, mMaxNumSatelliteStats);
atoms.satelliteEntitlement = sanitizeAtoms(atoms.satelliteEntitlement,
SatelliteEntitlement.class, mMaxNumSatelliteStats);
atoms.satelliteConfigUpdater = sanitizeAtoms(atoms.satelliteConfigUpdater,
@@ -2390,6 +2388,19 @@
}
/**
+ * Returns SatelliteController atom that has same carrier_id value or
+ * {@code null} if does not exist.
+ */
+ private @Nullable SatelliteController find(SatelliteController key) {
+ for (SatelliteController stats : mAtoms.satelliteController) {
+ if (stats.carrierId == key.carrierId) {
+ return stats;
+ }
+ }
+ return null;
+ }
+
+ /**
* Returns CarrierRoamingSatelliteControllerStats atom that has same carrier_id value or
* {@code null} if does not exist.
*/
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramController.java b/src/java/com/android/internal/telephony/satellite/DatagramController.java
index 9f6edf2..acd3fd1 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramController.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramController.java
@@ -16,6 +16,7 @@
package com.android.internal.telephony.satellite;
+import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_UNKNOWN;
import static android.telephony.satellite.SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE;
@@ -419,6 +420,15 @@
&& mSatelltieModemState == SATELLITE_MODEM_STATE_NOT_CONNECTED) {
return false;
}
+ boolean allowCheckMessageInNotConnected =
+ mContext.getResources().getBoolean(
+ R.bool.config_satellite_allow_check_message_in_not_connected);
+ if (datagramType == DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS
+ && mSatelltieModemState == SATELLITE_MODEM_STATE_NOT_CONNECTED
+ && allowCheckMessageInNotConnected
+ && mFeatureFlags.carrierRoamingNbIotNtn()) {
+ return false;
+ }
if (mSatelltieModemState != SATELLITE_MODEM_STATE_CONNECTED
&& mSatelltieModemState != SATELLITE_MODEM_STATE_DATAGRAM_TRANSFERRING) {
return true;
diff --git a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
index e62fa1d..113c3ee 100644
--- a/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
+++ b/src/java/com/android/internal/telephony/satellite/DatagramDispatcher.java
@@ -753,6 +753,8 @@
private void reportSendDatagramCompleted(@NonNull SendSatelliteDatagramArgument argument,
@NonNull @SatelliteManager.SatelliteResult int resultCode) {
+ long datagramTransmissionTime = argument.datagramStartTime > 0
+ ? (System.currentTimeMillis() - argument.datagramStartTime) : 0;
SatelliteStats.getInstance().onSatelliteOutgoingDatagramMetrics(
new SatelliteStats.SatelliteOutgoingDatagramParams.Builder()
.setDatagramType(argument.datagramType)
@@ -760,15 +762,15 @@
.setDatagramSizeBytes(argument.getDatagramRoundedSizeBytes())
/* In case pending datagram has not been attempted to send to modem
interface. transfer time will be 0. */
- .setDatagramTransferTimeMillis(argument.datagramStartTime > 0
- ? (System.currentTimeMillis() - argument.datagramStartTime) : 0)
+ .setDatagramTransferTimeMillis(datagramTransmissionTime)
.setIsDemoMode(mIsDemoMode)
.setCarrierId(SatelliteController.getInstance().getSatelliteCarrierId())
.build());
if (resultCode == SatelliteManager.SATELLITE_RESULT_SUCCESS) {
mControllerMetricsStats.reportOutgoingDatagramSuccessCount(argument.datagramType,
mIsDemoMode);
- mSessionMetricsStats.addCountOfSuccessfulOutgoingDatagram(argument.datagramType);
+ mSessionMetricsStats.addCountOfSuccessfulOutgoingDatagram(argument.datagramType,
+ datagramTransmissionTime);
} else {
mControllerMetricsStats.reportOutgoingDatagramFailCount(argument.datagramType,
mIsDemoMode);
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteController.java b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
index b9e6490..55980ea 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
@@ -33,6 +33,7 @@
import static android.telephony.CarrierConfigManager.KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT;
+import static android.telephony.CarrierConfigManager.KEY_SATELLITE_DATA_SUPPORT_MODE_INT;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ESOS_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_NIDD_APN_NAME_STRING;
@@ -436,9 +437,9 @@
private final ConcurrentHashMap<IBinder, ISelectedNbIotSatelliteSubscriptionCallback>
mSelectedNbIotSatelliteSubscriptionChangedListeners = new ConcurrentHashMap<>();
- private final Object mIsSatelliteSupportedLock = new Object();
+ protected final Object mIsSatelliteSupportedLock = new Object();
@GuardedBy("mIsSatelliteSupportedLock")
- private Boolean mIsSatelliteSupported = null;
+ protected Boolean mIsSatelliteSupported = null;
private boolean mIsDemoModeEnabled = false;
private boolean mIsEmergency = false;
private final Object mIsSatelliteEnabledLock = new Object();
@@ -577,6 +578,21 @@
* carrierPlmnList. */
@GuardedBy("mSupportedSatelliteServicesLock")
private final SparseArray<List<String>> mMergedPlmnListPerCarrier = new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related data plan. */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, Integer>> mEntitlementDataPlanMapPerCarrier = new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related service type. */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, List<Integer>>> mEntitlementServiceTypeMapPerCarrier =
+ new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related service policy for data service */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, Integer>> mEntitlementDataServicePolicyMapPerCarrier =
+ new SparseArray<>();
+ /** Key Subscription ID, value : map to plmn info with related service policy for voice service */
+ @GuardedBy("mSupportedSatelliteServicesLock")
+ SparseArray<Map<String, Integer>> mEntitlementVoiceServicePolicyMapPerCarrier =
+ new SparseArray<>();
private static AtomicLong sNextSatelliteEnableRequestId = new AtomicLong(0);
// key : subscriberId, value : provisioned or not.
@GuardedBy("mSatelliteTokenProvisionedLock")
@@ -662,6 +678,10 @@
@GuardedBy("mSatelliteModemStateLock")
@SatelliteManager.SatelliteModemState
private int mSatelliteModemState = SatelliteManager.SATELLITE_MODEM_STATE_UNKNOWN;
+
+ // Data Plan types at entitlement for the plmn allowed
+ public static final int SATELLITE_DATA_PLAN_METERED = 0;
+ public static final int SATELLITE_DATA_PLAN_UNMETERED = 1;
private BroadcastReceiver
mDefaultSmsSubscriptionChangedBroadcastReceiver = new BroadcastReceiver() {
@Override
@@ -3814,6 +3834,14 @@
return new ArrayList<>();
}
synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, List<Integer>> allowedServicesList
+ = mEntitlementServiceTypeMapPerCarrier.get(subId);
+ if (allowedServicesList != null && allowedServicesList.containsKey(plmn)) {
+ List<Integer> allowedServiceValues = allowedServicesList.get(plmn);
+ if (allowedServiceValues != null && !allowedServiceValues.isEmpty()) {
+ return allowedServiceValues;
+ }
+ }
if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {
Map<String, Set<Integer>> supportedServices =
mSatelliteServicesSupportedByCarriers.get(subId);
@@ -4198,10 +4226,18 @@
* @param entitlementEnabled {@code true} Satellite service enabled
* @param allowedPlmnList plmn allowed list to use the satellite service
* @param barredPlmnList plmn barred list to pass the modem
+ * @param plmnDataPlanMap data plan map for the plmn
+ * @param plmnServiceTypeMap available services map for the plmn
+ * @param plmnDataServicePolicyMap data service policy map for the plmn
+ * @param plmnVoiceServicePolicyMap voice service policy map for the plmn
* @param callback callback for accept
*/
public void onSatelliteEntitlementStatusUpdated(int subId, boolean entitlementEnabled,
@Nullable List<String> allowedPlmnList, @Nullable List<String> barredPlmnList,
+ @Nullable Map<String,Integer> plmnDataPlanMap,
+ @Nullable Map<String,List<Integer>> plmnServiceTypeMap,
+ @Nullable Map<String,Integer> plmnDataServicePolicyMap,
+ @Nullable Map<String,Integer> plmnVoiceServicePolicyMap,
@Nullable IIntegerConsumer callback) {
if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
logd("onSatelliteEntitlementStatusUpdated: carrierEnabledSatelliteFlag is not enabled");
@@ -4222,6 +4258,18 @@
if (barredPlmnList == null) {
barredPlmnList = new ArrayList<>();
}
+ if (plmnDataPlanMap == null) {
+ plmnDataPlanMap = new HashMap<>();
+ }
+ if (plmnServiceTypeMap == null) {
+ plmnServiceTypeMap = new HashMap<>();
+ }
+ if (plmnDataServicePolicyMap == null) {
+ plmnDataServicePolicyMap = new HashMap<>();
+ }
+ if (plmnVoiceServicePolicyMap == null) {
+ plmnVoiceServicePolicyMap = new HashMap<>();
+ }
logd("onSatelliteEntitlementStatusUpdated subId=" + subId + ", entitlementEnabled="
+ entitlementEnabled + ", allowedPlmnList=["
+ String.join(",", allowedPlmnList) + "]" + ", barredPlmnList=["
@@ -4250,6 +4298,10 @@
mMergedPlmnListPerCarrier.remove(subId);
mEntitlementPlmnListPerCarrier.put(subId, allowedPlmnList);
mEntitlementBarredPlmnListPerCarrier.put(subId, barredPlmnList);
+ mEntitlementDataPlanMapPerCarrier.put(subId, plmnDataPlanMap);
+ mEntitlementServiceTypeMapPerCarrier.put(subId, plmnServiceTypeMap);
+ mEntitlementDataServicePolicyMapPerCarrier.put(subId, plmnDataServicePolicyMap);
+ mEntitlementVoiceServicePolicyMapPerCarrier.put(subId, plmnVoiceServicePolicyMap);
updatePlmnListPerCarrier(subId);
configureSatellitePlmnForCarrier(subId);
mSubscriptionManagerService.setSatelliteEntitlementPlmnList(subId, allowedPlmnList);
@@ -5369,7 +5421,8 @@
KEY_SATELLITE_ROAMING_ESOS_INACTIVITY_TIMEOUT_SEC_INT,
KEY_SATELLITE_SOS_MAX_DATAGRAM_SIZE,
KEY_SATELLITE_SUPPORTED_MSG_APPS_STRING_ARRAY,
- KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE
+ KEY_REGIONAL_SATELLITE_EARFCN_BUNDLE,
+ KEY_SATELLITE_DATA_SUPPORT_MODE_INT
);
} catch (Exception e) {
logw("getConfigForSubId: " + e);
@@ -5488,7 +5541,7 @@
/** If the provision state per subscriberId for the cached is not exist, check the database for
* the corresponding value and use it. */
- private void updateSatelliteProvisionedStatePerSubscriberId() {
+ protected void updateSatelliteProvisionedStatePerSubscriberId() {
if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
return;
}
@@ -5566,7 +5619,7 @@
KEY_SATELLITE_ROAMING_TURN_OFF_SESSION_FOR_EMERGENCY_CALL_BOOL);
}
- private int getCarrierRoamingNtnConnectType(int subId) {
+ public int getCarrierRoamingNtnConnectType(int subId) {
return getConfigForSubId(subId).getInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT);
}
@@ -5575,6 +5628,11 @@
KEY_CARRIER_ROAMING_NTN_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_INT);
}
+ @CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE
+ private int getCarrierSatelliteDataSupportedMode(int subId) {
+ return getConfigForSubId(subId).getInt(KEY_SATELLITE_DATA_SUPPORT_MODE_INT);
+ }
+
/**
* Check if satellite attach is enabled by user for the carrier associated with the
* {@code subId}.
@@ -6479,6 +6537,23 @@
updateSatelliteSystemNotification(-1, -1,/*visible*/ false);
}
+ public boolean isSatelliteSystemNotificationsEnabled(int carrierRoamingNtnConnectType) {
+ if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
+ return false;
+ }
+ if (carrierRoamingNtnConnectType
+ != CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL) {
+ return true;
+ }
+ boolean notifySatelliteAvailabilityEnabled =
+ mContext.getResources().getBoolean(R.bool.config_satellite_should_notify_availability);
+ Boolean isSatelliteSupported = getIsSatelliteSupported();
+ if(isSatelliteSupported == null) {
+ return false;
+ }
+ return notifySatelliteAvailabilityEnabled && isSatelliteSupported;
+ }
+
/**
* Update the system notification to reflect the current satellite status, that's either already
* connected OR needs to be manually enabled. The device should only display one notification
@@ -6492,9 +6567,7 @@
*/
private void updateSatelliteSystemNotification(int subId,
@CARRIER_ROAMING_NTN_CONNECT_TYPE int carrierRoamingNtnConnectType, boolean visible) {
- boolean notifySatelliteAvailabilityEnabled =
- mContext.getResources().getBoolean(R.bool.config_satellite_should_notify_availability);
- if (!mFeatureFlags.carrierRoamingNbIotNtn() || !notifySatelliteAvailabilityEnabled) {
+ if (!isSatelliteSystemNotificationsEnabled(carrierRoamingNtnConnectType)) {
plogd("updateSatelliteSystemNotification: satellite notifications are not enabled.");
return;
}
@@ -7213,7 +7286,7 @@
+ ", provisioned=" + provisioned);
list.add(new SatelliteSubscriberProvisionStatus.Builder()
.setSatelliteSubscriberInfo(satelliteSubscriberInfo)
- .setProvisionStatus(provisioned).build());
+ .setProvisioned(provisioned).build());
mSubscriberIdPerSub.put(subscriberId, info.getSubscriptionId());
}
}
@@ -7269,7 +7342,7 @@
// TODO: need to check if satellite is allowed at current location for the subscription
int subId = getSubIdFromSubscriberId(
status.getSatelliteSubscriberInfo().getSubscriberId());
- if (status.getProvisionStatus() && isActiveSubId(subId)) {
+ if (status.isProvisioned() && isActiveSubId(subId)) {
selectedSubId = subId;
break;
}
@@ -8263,4 +8336,80 @@
return mWifiStateEnabled;
}
}
+
+ /**
+ * Method to return the current data plan for the registered plmn based on entitlement
+ * provisioning information. Note: If no information at
+ * provisioning is supported this is overridden with operator carrier config information.
+ *
+ * @param subId current subscription id
+ * @param plmn current registered plmn information
+ *
+ * @return Data supported modes {@link SatelliteController#SATELLITE_DATA_PLAN_METERED}
+ */
+ public int getSatelliteDataPlanForPlmn(int subId, String plmn) {
+ if (plmn != null) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, Integer> dataplanMap = mEntitlementDataPlanMapPerCarrier.get(subId);
+ logd("data plan available for sub id:" + dataplanMap);
+ if (dataplanMap != null && dataplanMap.containsKey(plmn)) {
+ return dataplanMap.get(plmn);
+ }
+ }
+ }
+ // TODO (Override with carrier config value when configuration defined)
+ return SATELLITE_DATA_PLAN_METERED;
+ }
+
+ /**
+ * Method to return the current satellite data service policy supported mode for the registered
+ * plmn based on entitlement provisioning information. Note: If no information at
+ * provisioning is supported this is overridden with operator carrier config information.
+ *
+ * @param subId current subscription id
+ * @param plmn current registered plmn information
+ *
+ * @return Supported modes {@link CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE}
+ */
+ public int getSatelliteDataServicePolicyForPlmn(int subId, String plmn) {
+ if (plmn != null) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, Integer> dataServicePolicy =
+ mEntitlementDataServicePolicyMapPerCarrier.get(
+ subId);
+ logd("data policy available for sub id:" + dataServicePolicy);
+ if (dataServicePolicy != null && dataServicePolicy.containsKey(plmn)) {
+ return dataServicePolicy.get(plmn);
+ }
+ }
+ }
+ return getCarrierSatelliteDataSupportedMode(subId);
+ }
+
+ /**
+ * Method to return the current satellite voice service policy supported mode for the registered
+ * plmn based on entitlement provisioning information. Note: If no information at
+ * provisioning is supported this is overridden with operator carrier config information.
+ *
+ * @param subId current subscription id
+ * @param plmn current registered plmn information
+ *
+ * @return Supported modes {@link CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE}
+ */
+ public int getSatelliteVoiceServicePolicyForPlmn(int subId, String plmn) {
+ if (plmn != null) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ Map<String, Integer> voiceServicePolicy =
+ mEntitlementVoiceServicePolicyMapPerCarrier.get(
+ subId);
+ logd("voice policy available for sub id:" + voiceServicePolicy);
+ if (voiceServicePolicy != null && voiceServicePolicy.containsKey(plmn)) {
+ return voiceServicePolicy.get(plmn);
+ }
+ }
+ }
+ // TODO (Replace below code with related enum value, when voice service policy support mode
+ // is added)
+ return 0; // Restricted
+ }
}
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java b/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java
index 7db9195..f101f18 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteNetworkInfo.java
@@ -16,6 +16,9 @@
package com.android.internal.telephony.satellite;
+import java.util.HashMap;
+import java.util.Map;
+
/**
* Data class of the satellite configuration received from the entitlement server.
*/
@@ -28,9 +31,21 @@
* 2. "metered"
* 3. empty string. */
public String mDataPlanType;
+ /** Stored the Allowed Services Info. with key as service type and value as service
+ * policy for the plmn
+ * Possible Service Type values: "data" and "voice".
+ * Possible Service Policy values: "constrained" and "unconstrained".
+ */
+ public Map<String,String> mAllowedServicesInfo;
- public SatelliteNetworkInfo(String plmn, String dataPlanType) {
+ public SatelliteNetworkInfo(String plmn, String dataPlanType,
+ Map<String,String> allowedServicesInfo) {
mPlmn = plmn;
mDataPlanType = dataPlanType;
+ if (allowedServicesInfo != null) {
+ mAllowedServicesInfo = new HashMap<>(allowedServicesInfo);
+ } else {
+ mAllowedServicesInfo = new HashMap<>();
+ }
}
}
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java b/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
index 182f667..64bd2b7 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommender.java
@@ -24,6 +24,9 @@
import static android.telephony.TelephonyManager.EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT;
import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS;
import static android.telephony.satellite.SatelliteManager.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911;
+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.flags.Flags.satellitePersistentLogging;
import static com.android.internal.telephony.satellite.SatelliteController.INVALID_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE;
@@ -262,6 +265,26 @@
return SmsApplication.getDefaultSendToApplication(mContext, false);
}
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
+ protected boolean updateAndGetProvisionState() {
+ mSatelliteController.updateSatelliteProvisionedStatePerSubscriberId();
+ return isDeviceProvisioned();
+ }
+
+ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
+ protected boolean isSatelliteAllowedByReasons() {
+ SatelliteManager satelliteManager = mContext.getSystemService(SatelliteManager.class);
+ List<Integer> disallowedReasons = satelliteManager.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))) {
+ plogd("isAllowedForDefaultMessageApp:false, disallowedReasons=" + disallowedReasons);
+ return false;
+ }
+ return true;
+ }
+
private void handleEmergencyCallStartedEvent(@NonNull Connection connection) {
plogd("handleEmergencyCallStartedEvent: connection=" + connection);
mSatelliteController.setLastEmergencyCallTime();
@@ -284,7 +307,8 @@
}
private void handleSatelliteProvisionStateChangedEvent(boolean provisioned) {
- if (!provisioned) {
+ if (!provisioned
+ && !isSatelliteConnectedViaCarrierWithinHysteresisTime()) {
cleanUpResources(false);
}
}
@@ -310,6 +334,8 @@
return;
}
+ updateAndGetProvisionState();
+
/*
* The device might be connected to satellite after the emergency call started. Thus, we
* need to do this check again so that we will have higher chance of sending the event
@@ -321,7 +347,7 @@
boolean isCellularAvailable = SatelliteServiceUtils.isCellularAvailable();
if (!isCellularAvailable
&& isSatelliteAllowed()
- && (isDeviceProvisioned()
+ && ((isDeviceProvisioned() && isSatelliteAllowedByReasons())
|| isSatelliteConnectedViaCarrierWithinHysteresisTime())
&& shouldTrackCall(mEmergencyConnection.getState())) {
plogd("handleTimeoutEvent: Sent EVENT_DISPLAY_EMERGENCY_MESSAGE to Dialer");
@@ -737,7 +763,9 @@
@VisibleForTesting(visibility = VisibleForTesting.Visibility.PRIVATE)
public int getEmergencyCallToSatelliteHandoverType() {
- if (Flags.carrierRoamingNbIotNtn() && isDeviceProvisioned()
+ if (Flags.carrierRoamingNbIotNtn()
+ && isDeviceProvisioned()
+ && isSatelliteAllowedByReasons()
&& isSatelliteConnectedViaCarrierWithinHysteresisTime()) {
int satelliteSubId = mSatelliteController.getSelectedSatelliteSubId();
return mSatelliteController.getCarrierRoamingNtnEmergencyCallToSatelliteHandoverType(
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java b/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
index 7aaf936..b55c622 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteServiceUtils.java
@@ -553,10 +553,10 @@
new android.telephony.satellite.stub.SystemSelectionSpecifier();
convertedSpecifier.mMccMnc = systemSelectionSpecifier.getMccMnc();
- convertedSpecifier.mBands = systemSelectionSpecifier.getBands().toArray();
- convertedSpecifier.mEarfcs = systemSelectionSpecifier.getEarfcns().toArray();
-
- SatelliteInfo[] satelliteInfos = systemSelectionSpecifier.getSatelliteInfos();
+ convertedSpecifier.mBands = systemSelectionSpecifier.getBands();
+ convertedSpecifier.mEarfcs = systemSelectionSpecifier.getEarfcns();
+ SatelliteInfo[] satelliteInfos = systemSelectionSpecifier.getSatelliteInfos()
+ .toArray(new SatelliteInfo[0]);
android.telephony.satellite.stub.SatelliteInfo[] halSatelliteInfos =
new android.telephony.satellite.stub.SatelliteInfo[satelliteInfos.length];
for (int i = 0; i < satelliteInfos.length; i++) {
@@ -591,8 +591,7 @@
}
}
convertedSpecifier.satelliteInfos = halSatelliteInfos;
-
- convertedSpecifier.tagIds = systemSelectionSpecifier.getTagIds().toArray();
+ convertedSpecifier.tagIds = systemSelectionSpecifier.getTagIds();
return convertedSpecifier;
}
diff --git a/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java b/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java
index 2ae8f9d..0a82b99 100644
--- a/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java
+++ b/src/java/com/android/internal/telephony/satellite/metrics/SessionMetricsStats.java
@@ -18,6 +18,7 @@
import static android.telephony.TelephonyManager.UNKNOWN_CARRIER_ID;
import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_NONE;
+import static android.telephony.satellite.SatelliteManager.KEY_SESSION_STATS_V2;
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;
import android.annotation.NonNull;
@@ -61,9 +62,11 @@
private int mCountOfSatelliteNotificationDisplayed;
private int mCountOfAutoExitDueToScreenOff;
private int mCountOfAutoExitDueToTnNetwork;
+ private SatelliteSessionStats datagramStats;
private SessionMetricsStats() {
initializeSessionMetricsParam();
+ datagramStats = new SatelliteSessionStats();
}
/**
@@ -128,7 +131,9 @@
/** Increase the count of successful outgoing datagram transmission. */
public SessionMetricsStats addCountOfSuccessfulOutgoingDatagram(
- @NonNull @SatelliteManager.DatagramType int datagramType) {
+ @NonNull @SatelliteManager.DatagramType int datagramType,
+ long datagramTransmissionTime) {
+ datagramStats.recordSuccessfulOutgoingDatagramStats(datagramType, datagramTransmissionTime);
if (datagramType == SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE) {
// Ignore KEEP_ALIVE messages
return this;
@@ -145,6 +150,7 @@
public SessionMetricsStats addCountOfFailedOutgoingDatagram(
@NonNull @SatelliteManager.DatagramType int datagramType,
@NonNull @SatelliteManager.SatelliteResult int resultCode) {
+ datagramStats.addCountOfUnsuccessfulUserMessages(datagramType, resultCode);
if (datagramType == SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE) {
// Ignore KEEP_ALIVE messages
return this;
@@ -284,6 +290,7 @@
/** Returns {@link SatelliteSessionStats} of the satellite service. */
public void requestSatelliteSessionStats(int subId, @NonNull ResultReceiver result) {
+ Log.i(TAG, "requestSatelliteSessionStats called");
Bundle bundle = new Bundle();
SatelliteSessionStats sessionStats = new SatelliteSessionStats.Builder()
.setCountOfSuccessfulUserMessages(mShadowCountOfSuccessfulOutgoingDatagram)
@@ -296,6 +303,10 @@
DatagramDispatcher.getInstance().getPendingUserMessagesCount())
.build();
bundle.putParcelable(SatelliteManager.KEY_SESSION_STATS, sessionStats);
+
+ // TODO b/381007377 should retrieve MessagesInQueueToBeSent count per messageType and add
+ // to datagramStats
+ bundle.putParcelable(KEY_SESSION_STATS_V2, datagramStats);
result.send(SATELLITE_RESULT_SUCCESS, bundle);
}
@@ -310,9 +321,9 @@
}
private void initializeSessionMetricsParam() {
- mInitializationResult = SatelliteManager.SATELLITE_RESULT_SUCCESS;
+ mInitializationResult = SATELLITE_RESULT_SUCCESS;
mRadioTechnology = SatelliteManager.NT_RADIO_TECHNOLOGY_UNKNOWN;
- mTerminationResult = SatelliteManager.SATELLITE_RESULT_SUCCESS;
+ mTerminationResult = SATELLITE_RESULT_SUCCESS;
mInitializationProcessingTimeMillis = 0;
mTerminationProcessingTimeMillis = 0;
mSessionDurationSec = 0;
@@ -336,6 +347,7 @@
mShadowCountOfFailedOutgoingDatagram = 0;
mShadowCountOfTimedOutUserMessagesWaitingForConnection = 0;
mShadowCountOfTimedOutUserMessagesWaitingForAck = 0;
+ datagramStats.clear();
}
private static void logd(@NonNull String log) {
diff --git a/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
index 5dc4719..f934371 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/TelephonyRegistryTest.java
@@ -138,7 +138,7 @@
private long mCallbackModeDurationMillis;
private boolean mCarrierRoamingNtnMode;
private boolean mCarrierRoamingNtnEligible;
- private List<Integer> mCarrierRoamingNtnAvailableServices;
+ private int[] mCarrierRoamingNtnAvailableServices;
private NtnSignalStrength mCarrierRoamingNtnSignalStrength;
private boolean mIsSatelliteEnabled;
@@ -354,7 +354,7 @@
}
@Override
- public void onCarrierRoamingNtnAvailableServicesChanged(List<Integer> services) {
+ public void onCarrierRoamingNtnAvailableServicesChanged(int[] services) {
invocationCount.incrementAndGet();
mCarrierRoamingNtnAvailableServices = services;
}
@@ -1768,9 +1768,7 @@
int[] services = {3, 6};
mTelephonyRegistry.notifyCarrierRoamingNtnAvailableServicesChanged(subId, services);
processAllMessages();
- int[] carrierServices = mCarrierRoamingNtnAvailableServices.stream()
- .mapToInt(Integer::intValue).toArray();
- assertTrue(Arrays.equals(carrierServices, services));
+ assertTrue(Arrays.equals(mCarrierRoamingNtnAvailableServices, services));
}
@Test
diff --git a/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java b/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java
index 110dade..e6e4c30 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/metrics/PersistAtomsStorageTest.java
@@ -4370,94 +4370,95 @@
public void addSatelliteControllerStats_withExistingEntries() throws Exception {
createEmptyTestFile();
mPersistAtomsStorage = new TestablePersistAtomsStorage(mContext);
- mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController1);
- mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController2);
+ mPersistAtomsStorage.addSatelliteControllerStats(copyOf(mSatelliteController1));
+ mPersistAtomsStorage.addSatelliteControllerStats(copyOf(mSatelliteController1));
mPersistAtomsStorage.incTimeMillis(100L);
SatelliteController expected = new SatelliteController();
expected.countOfSatelliteServiceEnablementsSuccess =
- mSatelliteController1.countOfSatelliteServiceEnablementsSuccess
- + mSatelliteController2.countOfSatelliteServiceEnablementsSuccess;
+ mSatelliteController1.countOfSatelliteServiceEnablementsSuccess * 2;
expected.countOfSatelliteServiceEnablementsFail =
- mSatelliteController1.countOfSatelliteServiceEnablementsFail
- + mSatelliteController2.countOfSatelliteServiceEnablementsFail;
+ mSatelliteController1.countOfSatelliteServiceEnablementsFail * 2;
expected.countOfOutgoingDatagramSuccess =
- mSatelliteController1.countOfOutgoingDatagramSuccess
- + mSatelliteController2.countOfOutgoingDatagramSuccess;
+ mSatelliteController1.countOfOutgoingDatagramSuccess * 2;
expected.countOfOutgoingDatagramFail =
- mSatelliteController1.countOfOutgoingDatagramFail
- + mSatelliteController2.countOfOutgoingDatagramFail;
+ mSatelliteController1.countOfOutgoingDatagramFail * 2;
expected.countOfIncomingDatagramSuccess =
- mSatelliteController1.countOfIncomingDatagramSuccess
- + mSatelliteController2.countOfIncomingDatagramSuccess;
+ mSatelliteController1.countOfIncomingDatagramSuccess * 2;
expected.countOfIncomingDatagramFail =
- mSatelliteController1.countOfIncomingDatagramFail
- + mSatelliteController2.countOfIncomingDatagramFail;
+ mSatelliteController1.countOfIncomingDatagramFail * 2;
expected.countOfDatagramTypeSosSmsSuccess =
- mSatelliteController1.countOfDatagramTypeSosSmsSuccess
- + mSatelliteController2.countOfDatagramTypeSosSmsSuccess;
+ mSatelliteController1.countOfDatagramTypeSosSmsSuccess * 2;
expected.countOfDatagramTypeSosSmsFail =
- mSatelliteController1.countOfDatagramTypeSosSmsFail
- + mSatelliteController2.countOfDatagramTypeSosSmsFail;
+ mSatelliteController1.countOfDatagramTypeSosSmsFail * 2;
expected.countOfDatagramTypeLocationSharingSuccess =
- mSatelliteController1.countOfDatagramTypeLocationSharingSuccess
- + mSatelliteController2.countOfDatagramTypeLocationSharingSuccess;
+ mSatelliteController1.countOfDatagramTypeLocationSharingSuccess * 2;
expected.countOfDatagramTypeLocationSharingFail =
- mSatelliteController1.countOfDatagramTypeLocationSharingFail
- + mSatelliteController2.countOfDatagramTypeLocationSharingFail;
+ mSatelliteController1.countOfDatagramTypeLocationSharingFail * 2;
expected.countOfProvisionSuccess =
- mSatelliteController1.countOfProvisionSuccess
- + mSatelliteController2.countOfProvisionSuccess;
+ mSatelliteController1.countOfProvisionSuccess * 2;
expected.countOfProvisionFail =
- mSatelliteController1.countOfProvisionFail
- + mSatelliteController2.countOfProvisionFail;
+ mSatelliteController1.countOfProvisionFail * 2;
expected.countOfDeprovisionSuccess =
- mSatelliteController1.countOfDeprovisionSuccess
- + mSatelliteController2.countOfDeprovisionSuccess;
+ mSatelliteController1.countOfDeprovisionSuccess * 2;
expected.countOfDeprovisionFail =
- mSatelliteController1.countOfDeprovisionFail
- + mSatelliteController2.countOfDeprovisionFail;
+ mSatelliteController1.countOfDeprovisionFail * 2;
expected.totalServiceUptimeSec =
- mSatelliteController1.totalServiceUptimeSec
- + mSatelliteController2.totalServiceUptimeSec;
+ mSatelliteController1.totalServiceUptimeSec * 2;
expected.totalBatteryConsumptionPercent =
- mSatelliteController1.totalBatteryConsumptionPercent
- + mSatelliteController2.totalBatteryConsumptionPercent;
+ mSatelliteController1.totalBatteryConsumptionPercent * 2;
expected.totalBatteryChargedTimeSec =
- mSatelliteController1.totalBatteryChargedTimeSec
- + mSatelliteController2.totalBatteryChargedTimeSec;
+ mSatelliteController1.totalBatteryChargedTimeSec * 2;
expected.countOfDemoModeSatelliteServiceEnablementsSuccess =
- mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsSuccess
- + mSatelliteController2.countOfDemoModeSatelliteServiceEnablementsSuccess;
+ mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsSuccess * 2;
expected.countOfDemoModeSatelliteServiceEnablementsFail =
- mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsFail
- + mSatelliteController2.countOfDemoModeSatelliteServiceEnablementsFail;
+ mSatelliteController1.countOfDemoModeSatelliteServiceEnablementsFail * 2;
expected.countOfDemoModeOutgoingDatagramSuccess =
- mSatelliteController1.countOfDemoModeOutgoingDatagramSuccess
- + mSatelliteController2.countOfDemoModeOutgoingDatagramSuccess;
+ mSatelliteController1.countOfDemoModeOutgoingDatagramSuccess * 2;
expected.countOfDemoModeOutgoingDatagramFail =
- mSatelliteController1.countOfDemoModeOutgoingDatagramFail
- + mSatelliteController2.countOfDemoModeOutgoingDatagramFail;
+ mSatelliteController1.countOfDemoModeOutgoingDatagramFail * 2;
expected.countOfDemoModeIncomingDatagramSuccess =
- mSatelliteController1.countOfDemoModeIncomingDatagramSuccess
- + mSatelliteController2.countOfDemoModeIncomingDatagramSuccess;
+ mSatelliteController1.countOfDemoModeIncomingDatagramSuccess * 2;
expected.countOfDemoModeIncomingDatagramFail =
- mSatelliteController1.countOfDemoModeIncomingDatagramFail
- + mSatelliteController2.countOfDemoModeIncomingDatagramFail;
+ mSatelliteController1.countOfDemoModeIncomingDatagramFail * 2;
expected.countOfDatagramTypeKeepAliveSuccess =
- mSatelliteController1.countOfDatagramTypeKeepAliveSuccess
- + mSatelliteController2.countOfDatagramTypeKeepAliveSuccess;
+ mSatelliteController1.countOfDatagramTypeKeepAliveSuccess * 2;
expected.countOfDatagramTypeKeepAliveFail =
- mSatelliteController1.countOfDatagramTypeKeepAliveFail
- + mSatelliteController2.countOfDatagramTypeKeepAliveFail;
- expected.isProvisioned = mSatelliteController2.isProvisioned;
- expected.carrierId = mSatelliteController2.carrierId;
+ mSatelliteController1.countOfDatagramTypeKeepAliveFail * 2;
+ expected.isProvisioned = mSatelliteController1.isProvisioned;
+ expected.carrierId = mSatelliteController1.carrierId;
+ expected.countOfSatelliteAllowedStateChangedEvents =
+ mSatelliteController1.countOfSatelliteAllowedStateChangedEvents * 2;
+ expected.countOfSuccessfulLocationQueries =
+ mSatelliteController1.countOfSuccessfulLocationQueries * 2;
+ expected.countOfFailedLocationQueries =
+ mSatelliteController1.countOfFailedLocationQueries * 2;
// Service state and service switch should be added successfully
verifyCurrentStateSavedToFileOnce();
SatelliteController[] output =
mPersistAtomsStorage.getSatelliteControllerStats(0L);
- assertHasStats(output, expected);
+ assertHasStats(output, expected, 1);
+ }
+
+ @Test
+ public void addSatelliteControllerStats_addNewCarrierId() throws Exception {
+ createEmptyTestFile();
+ mPersistAtomsStorage = new TestablePersistAtomsStorage(mContext);
+ mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController1);
+ mPersistAtomsStorage.addSatelliteControllerStats(mSatelliteController2);
+ mPersistAtomsStorage.incTimeMillis(100L);
+
+ SatelliteController expected1 = mSatelliteController1;
+ SatelliteController expected2 = mSatelliteController2;
+
+ // Service state and service switch should be added successfully
+ verifyCurrentStateSavedToFileOnce();
+ SatelliteController[] output =
+ mPersistAtomsStorage.getSatelliteControllerStats(0L);
+
+ assertHasStats(output, expected1, 1);
+ assertHasStats(output, expected2, 1);
}
@Test
@@ -5829,60 +5830,71 @@
assertEquals(expectedCount, actualCount);
}
- private static void assertHasStats(
- SatelliteController[] tested,
- @Nullable SatelliteController expectedStats) {
+ private static void assertHasStats(SatelliteController[] tested,
+ @Nullable SatelliteController expectedStats, int expectedCount) {
assertNotNull(tested);
- assertEquals(tested[0].countOfSatelliteServiceEnablementsSuccess,
- expectedStats.countOfSatelliteServiceEnablementsSuccess);
- assertEquals(tested[0].countOfSatelliteServiceEnablementsFail,
- expectedStats.countOfSatelliteServiceEnablementsFail);
- assertEquals(tested[0].countOfOutgoingDatagramSuccess,
- expectedStats.countOfOutgoingDatagramSuccess);
- assertEquals(tested[0].countOfOutgoingDatagramFail,
- expectedStats.countOfOutgoingDatagramFail);
- assertEquals(tested[0].countOfIncomingDatagramSuccess,
- expectedStats.countOfIncomingDatagramSuccess);
- assertEquals(tested[0].countOfIncomingDatagramFail,
- expectedStats.countOfIncomingDatagramFail);
- assertEquals(tested[0].countOfDatagramTypeSosSmsSuccess,
- expectedStats.countOfDatagramTypeSosSmsSuccess);
- assertEquals(tested[0].countOfDatagramTypeSosSmsFail,
- expectedStats.countOfDatagramTypeSosSmsFail);
- assertEquals(tested[0].countOfDatagramTypeLocationSharingSuccess,
- expectedStats.countOfDatagramTypeLocationSharingSuccess);
- assertEquals(tested[0].countOfDatagramTypeLocationSharingFail,
- expectedStats.countOfDatagramTypeLocationSharingFail);
- assertEquals(tested[0].totalServiceUptimeSec,
- expectedStats.totalServiceUptimeSec);
- assertEquals(tested[0].totalBatteryConsumptionPercent,
- expectedStats.totalBatteryConsumptionPercent);
- assertEquals(tested[0].totalBatteryChargedTimeSec,
- expectedStats.totalBatteryChargedTimeSec);
- assertEquals(tested[0].countOfDemoModeSatelliteServiceEnablementsSuccess,
- expectedStats.countOfDemoModeSatelliteServiceEnablementsSuccess);
- assertEquals(tested[0].countOfDemoModeSatelliteServiceEnablementsFail,
- expectedStats.countOfDemoModeSatelliteServiceEnablementsFail);
- assertEquals(tested[0].countOfDemoModeOutgoingDatagramSuccess,
- expectedStats.countOfDemoModeOutgoingDatagramSuccess);
- assertEquals(tested[0].countOfDemoModeOutgoingDatagramFail,
- expectedStats.countOfDemoModeOutgoingDatagramFail);
- assertEquals(tested[0].countOfDemoModeIncomingDatagramSuccess,
- expectedStats.countOfDemoModeIncomingDatagramSuccess);
- assertEquals(tested[0].countOfDemoModeIncomingDatagramFail,
- expectedStats.countOfDemoModeIncomingDatagramFail);
- assertEquals(tested[0].countOfDatagramTypeKeepAliveSuccess,
- expectedStats.countOfDatagramTypeKeepAliveSuccess);
- assertEquals(tested[0].countOfDatagramTypeKeepAliveFail,
- expectedStats.countOfDatagramTypeKeepAliveFail);
- assertEquals(tested[0].countOfAllowedSatelliteAccess,
- expectedStats.countOfAllowedSatelliteAccess);
- assertEquals(tested[0].countOfDisallowedSatelliteAccess,
- expectedStats.countOfDisallowedSatelliteAccess);
- assertEquals(tested[0].countOfSatelliteAccessCheckFail,
- expectedStats.countOfSatelliteAccessCheckFail);
- assertEquals(tested[0].isProvisioned, expectedStats.isProvisioned);
- assertEquals(tested[0].carrierId, expectedStats.carrierId);
+ int actualCount = 0;
+ int i = 0;
+ for (SatelliteController stats : tested) {
+ if (expectedStats.carrierId == stats.carrierId) {
+ assertEquals(expectedStats.countOfSatelliteServiceEnablementsSuccess,
+ stats.countOfSatelliteServiceEnablementsSuccess);
+ assertEquals(expectedStats.countOfSatelliteServiceEnablementsFail,
+ stats.countOfSatelliteServiceEnablementsFail);
+ assertEquals(expectedStats.countOfOutgoingDatagramSuccess,
+ stats.countOfOutgoingDatagramSuccess);
+ assertEquals(expectedStats.countOfOutgoingDatagramFail,
+ stats.countOfOutgoingDatagramFail);
+ assertEquals(expectedStats.countOfIncomingDatagramSuccess,
+ stats.countOfIncomingDatagramSuccess);
+ assertEquals(expectedStats.countOfIncomingDatagramFail,
+ stats.countOfIncomingDatagramFail);
+ assertEquals(expectedStats.countOfDatagramTypeSosSmsSuccess,
+ stats.countOfDatagramTypeSosSmsSuccess);
+ assertEquals(expectedStats.countOfDatagramTypeSosSmsFail,
+ stats.countOfDatagramTypeSosSmsFail);
+ assertEquals(expectedStats.countOfDatagramTypeLocationSharingSuccess,
+ stats.countOfDatagramTypeLocationSharingSuccess);
+ assertEquals(expectedStats.countOfDatagramTypeLocationSharingFail,
+ stats.countOfDatagramTypeLocationSharingFail);
+ assertEquals(expectedStats.totalServiceUptimeSec, stats.totalServiceUptimeSec);
+ assertEquals(expectedStats.totalBatteryConsumptionPercent,
+ stats.totalBatteryConsumptionPercent);
+ assertEquals(expectedStats.totalBatteryChargedTimeSec,
+ stats.totalBatteryChargedTimeSec);
+ assertEquals(expectedStats.countOfDemoModeSatelliteServiceEnablementsSuccess,
+ stats.countOfDemoModeSatelliteServiceEnablementsSuccess);
+ assertEquals(expectedStats.countOfDemoModeSatelliteServiceEnablementsFail,
+ stats.countOfDemoModeSatelliteServiceEnablementsFail);
+ assertEquals(expectedStats.countOfDemoModeOutgoingDatagramSuccess,
+ stats.countOfDemoModeOutgoingDatagramSuccess);
+ assertEquals(expectedStats.countOfDemoModeOutgoingDatagramFail,
+ stats.countOfDemoModeOutgoingDatagramFail);
+ assertEquals(expectedStats.countOfDemoModeIncomingDatagramSuccess,
+ stats.countOfDemoModeIncomingDatagramSuccess);
+ assertEquals(expectedStats.countOfDemoModeIncomingDatagramFail,
+ stats.countOfDemoModeIncomingDatagramFail);
+ assertEquals(expectedStats.countOfDatagramTypeKeepAliveSuccess,
+ stats.countOfDatagramTypeKeepAliveSuccess);
+ assertEquals(expectedStats.countOfDatagramTypeKeepAliveFail,
+ stats.countOfDatagramTypeKeepAliveFail);
+ assertEquals(expectedStats.countOfAllowedSatelliteAccess,
+ stats.countOfAllowedSatelliteAccess);
+ assertEquals(expectedStats.countOfDisallowedSatelliteAccess,
+ stats.countOfDisallowedSatelliteAccess);
+ assertEquals(expectedStats.countOfSatelliteAccessCheckFail,
+ stats.countOfSatelliteAccessCheckFail);
+ assertEquals(expectedStats.isProvisioned, stats.isProvisioned);
+ assertEquals(expectedStats.countOfSatelliteAllowedStateChangedEvents,
+ stats.countOfSatelliteAllowedStateChangedEvents);
+ assertEquals(expectedStats.countOfSuccessfulLocationQueries,
+ stats.countOfSuccessfulLocationQueries);
+ assertEquals(expectedStats.countOfFailedLocationQueries,
+ stats.countOfFailedLocationQueries);
+ actualCount++;
+ }
+ }
+ assertEquals(expectedCount, actualCount);
}
private static void assertHasStatsAndCount(
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java
index 21731f0..271e0ad 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramControllerTest.java
@@ -16,10 +16,12 @@
package com.android.internal.telephony.satellite;
+import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_KEEP_ALIVE;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_LAST_SOS_MESSAGE_NO_HELP_NEEDED;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_LAST_SOS_MESSAGE_STILL_NEED_HELP;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_LOCATION_SHARING;
+import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_SMS;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_SOS_MESSAGE;
import static android.telephony.satellite.SatelliteManager.DATAGRAM_TYPE_UNKNOWN;
import static android.telephony.satellite.SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE;
@@ -44,6 +46,7 @@
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
+import com.android.internal.R;
import com.android.internal.telephony.TelephonyTest;
import org.junit.After;
@@ -187,6 +190,76 @@
}
}
+ @Test
+ public void testNeedsWaitingForSatelliteConnected_checkMessageInNotConnected_returnsFalse()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, true);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS);
+
+ assertFalse(result);
+ }
+
+ @Test
+ public void testNeedsWaitingForSatelliteConnected_regularSmsInNotConnected_returnsTrue()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, true);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_SMS);
+
+ assertTrue(result);
+ }
+
+ @Test
+ public void
+ testNeedsWaitingForSatelliteConnected_checkMessageInNotConnected_allowCheckMessageFalse_returnsTrue()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(true);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, false);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS);
+
+ assertTrue(result);
+ }
+
+ @Test
+ public void
+ testNeedsWaitingForSatelliteConnected_checkMessageInNotConnected_carrierRoamingNbIotNtnFalse_returnsTrue()
+ throws Exception {
+ when(mMockSatelliteController.isSatelliteAttachRequired()).thenReturn(true);
+ when(mFeatureFlags.carrierRoamingNbIotNtn()).thenReturn(false);
+ mContextFixture.putBooleanResource(
+ R.bool.config_satellite_allow_check_message_in_not_connected, true);
+ mDatagramControllerUT.onSatelliteModemStateChanged(
+ SatelliteManager.SATELLITE_MODEM_STATE_NOT_CONNECTED);
+
+ boolean result =
+ mDatagramControllerUT.needsWaitingForSatelliteConnected(
+ DATAGRAM_TYPE_CHECK_PENDING_INCOMING_SMS);
+
+ assertTrue(result);
+ }
+
private void testUpdateSendStatus(boolean isDemoMode, int datagramType, int sendState) {
mDatagramControllerUT.setDemoMode(isDemoMode);
clearAllInvocations();
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
index d964d88..dc973af 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/DatagramDispatcherTest.java
@@ -31,6 +31,7 @@
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.clearInvocations;
import static org.mockito.Mockito.doAnswer;
@@ -257,7 +258,7 @@
eq(SATELLITE_RESULT_SUCCESS));
verifyNoMoreInteractions(mMockDatagramController);
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramType));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramType), anyLong());
verify(mMockSatelliteModemInterface, times(1)).sendSatelliteDatagram(
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertFalse(mDatagramDispatcherUT.isDatagramWaitForConnectedStateTimerStarted());
@@ -398,7 +399,7 @@
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertThat(mResultListener.peek()).isEqualTo(SATELLITE_RESULT_SUCCESS);
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(anyInt());
+ .addCountOfSuccessfulOutgoingDatagram(anyInt(), anyLong());
clearInvocations(mMockSatelliteModemInterface);
clearInvocations(mMockDatagramController);
clearInvocations(mMockSessionMetricsStats);
@@ -523,7 +524,7 @@
eq(SATELLITE_RESULT_SUCCESS));
assertThat(mResultListener.peek()).isEqualTo(SATELLITE_RESULT_SUCCESS);
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramType));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramType), anyLong());
mDatagramDispatcherUT.setDemoMode(false);
mDatagramDispatcherUT.setDeviceAlignedWithSatellite(false);
}
@@ -618,7 +619,7 @@
eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), eq(0),
eq(SATELLITE_RESULT_SUCCESS));
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(DATAGRAM_TYPE2));
+ .addCountOfSuccessfulOutgoingDatagram(eq(DATAGRAM_TYPE2), anyLong());
mDatagramDispatcherUT.setDemoMode(false);
mDatagramDispatcherUT.setDeviceAlignedWithSatellite(false);
@@ -731,7 +732,7 @@
anyInt(), any(SatelliteDatagram.class));
verify(mMockDatagramController).pollPendingSatelliteDatagrams(anyInt(), any());
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(anyInt());
+ .addCountOfSuccessfulOutgoingDatagram(anyInt(), anyLong());
// Test when overlay config config_send_satellite_datagram_to_modem_in_demo_mode is
// false
@@ -1041,7 +1042,7 @@
eq(1),
eq(SATELLITE_RESULT_SUCCESS));
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos), anyLong());
verify(mMockSatelliteModemInterface, times(1)).sendSatelliteDatagram(
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertFalse(mDatagramDispatcherUT.isDatagramWaitForConnectedStateTimerStarted());
@@ -1133,7 +1134,7 @@
eq(SatelliteManager.SATELLITE_DATAGRAM_TRANSFER_STATE_IDLE), eq(0),
eq(SATELLITE_RESULT_SUCCESS));
verify(mMockSessionMetricsStats, times(1))
- .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos));
+ .addCountOfSuccessfulOutgoingDatagram(eq(datagramTypeSos), anyLong());
verify(mMockSatelliteModemInterface, times(1)).sendSatelliteDatagram(
any(SatelliteDatagram.class), anyBoolean(), anyBoolean(), any(Message.class));
assertFalse(mDatagramDispatcherUT.isDatagramWaitForConnectedStateTimerStarted());
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
index 4a2a963..6f716b5 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteControllerTest.java
@@ -22,6 +22,7 @@
import static android.hardware.devicestate.DeviceState.PROPERTY_FOLDABLE_HARDWARE_CONFIGURATION_FOLD_IN_OPEN;
import static android.hardware.devicestate.feature.flags.Flags.FLAG_DEVICE_STATE_PROPERTY_MIGRATION;
import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_AUTOMATIC;
+import static android.telephony.CarrierConfigManager.CARRIER_ROAMING_NTN_CONNECT_MANUAL;
import static android.telephony.CarrierConfigManager.KEY_CARRIER_CONFIG_APPLIED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT;
import static android.telephony.CarrierConfigManager.KEY_CARRIER_SUPPORTED_SATELLITE_NOTIFICATION_HYSTERESIS_SEC_INT;
@@ -32,7 +33,12 @@
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_NIDD_APN_NAME_STRING;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ROAMING_TURN_OFF_SESSION_FOR_EMERGENCY_CALL_BOOL;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ALL;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED;
+import static android.telephony.CarrierConfigManager.SATELLITE_DATA_SUPPORT_ONLY_RESTRICTED;
import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_DATA;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_SMS;
+import static android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_VOICE;
import static android.telephony.SubscriptionManager.SATELLITE_ENTITLEMENT_STATUS;
import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GOOD;
import static android.telephony.satellite.NtnSignalStrength.NTN_SIGNAL_STRENGTH_GREAT;
@@ -81,6 +87,8 @@
import static android.telephony.satellite.SatelliteManager.SATELLITE_RESULT_SUCCESS;
import static com.android.internal.telephony.satellite.SatelliteController.DEFAULT_CARRIER_EMERGENCY_CALL_WAIT_FOR_CONNECTION_TIMEOUT_MILLIS;
+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.internal.telephony.satellite.SatelliteController.SATELLITE_MODE_ENABLED_FALSE;
import static com.android.internal.telephony.satellite.SatelliteController.SATELLITE_MODE_ENABLED_TRUE;
@@ -218,7 +226,6 @@
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
-import java.util.stream.IntStream;
@RunWith(AndroidTestingRunner.class)
@TestableLooper.RunWithLooper
@@ -3166,7 +3173,8 @@
// Verify call the requestSetSatelliteEnabledForCarrier to enable the satellite when
// satellite service is enabled by entitlement server.
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -3186,7 +3194,8 @@
.when(mMockSatelliteModemInterface).isSatelliteServiceSupported();
setUpResponseForRequestSetSatelliteEnabledForCarrier(false, SATELLITE_RESULT_SUCCESS);
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), mIIntegerConsumer);
processAllMessages();
assertTrue(waitForIIntegerConsumerResult(1));
@@ -3217,7 +3226,8 @@
List<String> entitlementPlmnList = new ArrayList<>();
List<String> barredPlmnList = new ArrayList<>();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3275,7 +3285,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", ""}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3283,7 +3294,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "123456789"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3291,7 +3303,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "12"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
@@ -3299,7 +3312,8 @@
reset(mMockSatelliteModemInterface);
entitlementPlmnList = Arrays.stream(new String[]{"00101", "00102", "1234"}).toList();
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
verify(mMockSatelliteModemInterface, never()).requestSatelliteEnabled(
any(SatelliteModemEnableRequestAttributes.class), any(Message.class));
}
@@ -3308,7 +3322,8 @@
List<String> mergedPlmnList, List<String> overlayConfigPlmnList,
List<String> barredPlmnList) {
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
- entitlementPlmnList, barredPlmnList, mIIntegerConsumer);
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
List<String> plmnListPerCarrier = mSatelliteControllerUT.getSatellitePlmnsForCarrier(
SUB_ID);
@@ -3530,21 +3545,24 @@
// Change SUB_ID's EntitlementStatus to true
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, true, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID));
assertEquals(false, satelliteEnabledPerCarrier.get(SUB_ID1));
// Change SUB_ID1's EntitlementStatus to true
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID1, true, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), mIIntegerConsumer);
assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID));
assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID1));
// Change SUB_ID's EntitlementStatus to false
mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false, new ArrayList<>(),
- new ArrayList<>(), mIIntegerConsumer);
+ new ArrayList<>(), new HashMap<>(), new HashMap<>(), new HashMap<>(),
+ new HashMap<>(), mIIntegerConsumer);
assertEquals(false, satelliteEnabledPerCarrier.get(SUB_ID));
assertEquals(true, satelliteEnabledPerCarrier.get(SUB_ID1));
@@ -3687,6 +3705,7 @@
// Do nothing when the satellite is not connected
doReturn(false).when(mServiceState).isUsingNonTerrestrialNetwork();
sendServiceStateChangedEvent();
+ setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
processAllMessages();
assertFalse(mSharedPreferences.getBoolean(SATELLITE_SYSTEM_NOTIFICATION_DONE_KEY, false));
verify(mMockNotificationManager, never()).notifyAsUser(anyString(), anyInt(), any(), any());
@@ -4271,8 +4290,10 @@
when(mServiceState2.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);
when(mServiceState.getState()).thenReturn(ServiceState.STATE_OUT_OF_SERVICE);
mSatelliteControllerUT.mIsApplicationSupportsP2P = true;
+ mSatelliteControllerUT.setIsSatelliteSupported(true);
mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, true);
- mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT, 1);
+ mCarrierConfigBundle.putInt(KEY_CARRIER_ROAMING_NTN_CONNECT_TYPE_INT,
+ CARRIER_ROAMING_NTN_CONNECT_MANUAL);
mCarrierConfigBundle.putInt(
KEY_CARRIER_SUPPORTED_SATELLITE_NOTIFICATION_HYSTERESIS_SEC_INT, 1 * 60);
mCarrierConfigBundle.putBoolean(KEY_SATELLITE_ROAMING_P2P_SMS_SUPPORTED_BOOL, true);
@@ -4294,6 +4315,7 @@
}
mSatelliteControllerUT.setSatellitePhone(1);
mSatelliteControllerUT.isSatelliteAllowedCallback = null;
+ setUpResponseForRequestIsSatelliteSupported(true, SATELLITE_RESULT_SUCCESS);
processAllMessages();
mSatelliteControllerUT.elapsedRealtime = 0;
assertTrue(mSatelliteControllerUT.isCarrierRoamingNtnEligible(mPhone));
@@ -4721,7 +4743,7 @@
any());
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertTrue(resultArray[0].getProvisionStatus());
+ assertTrue(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
// Request provisioning with SatelliteSubscriberInfo that has not been provisioned
@@ -4732,7 +4754,7 @@
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertTrue(resultArray[1].getProvisionStatus());
+ assertTrue(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
// Request provisioning with the same SatelliteSubscriberInfo that was previously
@@ -4747,9 +4769,9 @@
verifyDeprovisionSatellite(inputList);
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertFalse(resultArray[1].getProvisionStatus());
+ assertFalse(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
- assertTrue(resultArray[0].getProvisionStatus());
+ assertTrue(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
// Request deprovision for subscriberID 1, verify that subscriberID 1 is set to deprovision.
@@ -4758,9 +4780,9 @@
verifyDeprovisionSatellite(inputList);
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertFalse(resultArray[1].getProvisionStatus());
+ assertFalse(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
- assertFalse(resultArray[0].getProvisionStatus());
+ assertFalse(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
// Request provision for subscriberID 2, verify that subscriberID 2 is set to provision.
@@ -4770,9 +4792,9 @@
assertTrue(waitForForEvents(
semaphore, 1, "testRegisterForSatelliteSubscriptionProvisionStateChanged"));
- assertTrue(resultArray[1].getProvisionStatus());
+ assertTrue(resultArray[1].isProvisioned());
assertEquals(mSubscriberId2, resultArray[1].getSatelliteSubscriberInfo().getSubscriberId());
- assertFalse(resultArray[0].getProvisionStatus());
+ assertFalse(resultArray[0].isProvisioned());
assertEquals(mSubscriberId, resultArray[0].getSatelliteSubscriberInfo().getSubscriberId());
}
@@ -5198,18 +5220,13 @@
SystemSelectionSpecifier systemSelectionSpecifier = capturedList.getFirst();
assertEquals(mccmnc, systemSelectionSpecifier.getMccMnc());
- int[] actualBandsArray = IntStream.range(0, systemSelectionSpecifier.getBands().size()).map(
- systemSelectionSpecifier.getBands()::get).toArray();
+ int[] actualBandsArray = systemSelectionSpecifier.getBands();
assertArrayEquals(bands1, actualBandsArray);
- int[] actualEarfcnsArray = IntStream.range(0,
- systemSelectionSpecifier.getEarfcns().size()).map(
- systemSelectionSpecifier.getEarfcns()::get).toArray();
+ int[] actualEarfcnsArray = systemSelectionSpecifier.getEarfcns();
assertArrayEquals(earfcns1, actualEarfcnsArray);
assertArrayEquals(new SatelliteInfo[]{satelliteInfo1},
- systemSelectionSpecifier.getSatelliteInfos());
- int[] actualTagIdArray = IntStream.range(0,
- systemSelectionSpecifier.getTagIds().size()).map(
- systemSelectionSpecifier.getTagIds()::get).toArray();
+ systemSelectionSpecifier.getSatelliteInfos().toArray(new SatelliteInfo[0]));
+ int[] actualTagIdArray = systemSelectionSpecifier.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
// Verify whether SatelliteModemInterface API was invoked and data is valid, when list
@@ -5251,36 +5268,26 @@
// Verify first SystemSelectionSpecifier
assertEquals(mccmnc, systemSelectionSpecifier.getMccMnc());
- actualBandsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier1.getBands().size()).map(
- capturedSystemSelectionSpecifier1.getBands()::get).toArray();
+ actualBandsArray = capturedSystemSelectionSpecifier1.getBands();
assertArrayEquals(bands1, actualBandsArray);
- actualEarfcnsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier1.getEarfcns().size()).map(
- capturedSystemSelectionSpecifier1.getEarfcns()::get).toArray();
+ actualEarfcnsArray = capturedSystemSelectionSpecifier1.getEarfcns();
assertArrayEquals(earfcns1, actualEarfcnsArray);
assertArrayEquals(new SatelliteInfo[]{satelliteInfo1},
- capturedSystemSelectionSpecifier1.getSatelliteInfos());
- actualTagIdArray = IntStream.range(0,
- capturedSystemSelectionSpecifier1.getTagIds().size()).map(
- capturedSystemSelectionSpecifier1.getTagIds()::get).toArray();
+ capturedSystemSelectionSpecifier1.getSatelliteInfos().toArray(
+ new SatelliteInfo[0]));
+ actualTagIdArray = capturedSystemSelectionSpecifier1.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
// Verify second SystemSelectionSpecifier
assertEquals(mccmnc, systemSelectionSpecifier.getMccMnc());
- actualBandsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier2.getBands().size()).map(
- capturedSystemSelectionSpecifier2.getBands()::get).toArray();
+ actualBandsArray = capturedSystemSelectionSpecifier2.getBands();
assertArrayEquals(bands2, actualBandsArray);
- actualEarfcnsArray = IntStream.range(0,
- capturedSystemSelectionSpecifier2.getEarfcns().size()).map(
- capturedSystemSelectionSpecifier2.getEarfcns()::get).toArray();
+ actualEarfcnsArray = capturedSystemSelectionSpecifier2.getEarfcns();
assertArrayEquals(earfcns2, actualEarfcnsArray);
assertArrayEquals(new SatelliteInfo[]{satelliteInfo2},
- capturedSystemSelectionSpecifier2.getSatelliteInfos());
- actualTagIdArray = IntStream.range(0,
- capturedSystemSelectionSpecifier2.getTagIds().size()).map(
- capturedSystemSelectionSpecifier2.getTagIds()::get).toArray();
+ capturedSystemSelectionSpecifier2.getSatelliteInfos().toArray(
+ new SatelliteInfo[0]));
+ actualTagIdArray = capturedSystemSelectionSpecifier2.getTagIds();
assertArrayEquals(tagIds, actualTagIdArray);
}
@@ -5304,7 +5311,7 @@
assertEquals(SATELLITE_RESULT_SUCCESS,
mRequestSatelliteSubscriberProvisionStatusResultCode);
assertEquals(provision,
- mRequestSatelliteSubscriberProvisionStatusResultList.get(0).getProvisionStatus());
+ mRequestSatelliteSubscriberProvisionStatusResultList.get(0).isProvisioned());
}
private void setComponentName() {
@@ -6212,6 +6219,12 @@
}
}
+ void setIsSatelliteSupported(@Nullable Boolean isSatelliteSupported) {
+ synchronized (mIsSatelliteSupportedLock) {
+ mIsSatelliteSupported = isSatelliteSupported;
+ }
+ }
+
public boolean isRadioOn() {
synchronized (mIsRadioOnLock) {
return mIsRadioOn;
@@ -6352,4 +6365,226 @@
return isProvisioned != null ? isProvisioned : false;
}
}
+
+ @Test
+ public void testGetSatelliteDataPlanForPlmn_WithEntitlement() throws Exception {
+ logd("testGetSatelliteDataPlanForPlmn_WithEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataPlanListMap = Map.of(
+ "00101", SATELLITE_DATA_PLAN_METERED,
+ "00103", SATELLITE_DATA_PLAN_UNMETERED);
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, dataPlanListMap, new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ int dataPlanForPlmn;
+ dataPlanForPlmn = mSatelliteControllerUT.getSatelliteDataPlanForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_PLAN_METERED, dataPlanForPlmn);
+
+ dataPlanForPlmn = mSatelliteControllerUT.getSatelliteDataPlanForPlmn(SUB_ID, "00103");
+ assertEquals(SATELLITE_DATA_PLAN_UNMETERED, dataPlanForPlmn);
+ }
+
+ @Test
+ public void testGetSatelliteDataPlanForPlmn_WithoutEntitlement() throws Exception {
+ logd("testGetSatelliteDataPlanForPlmn_WithoutEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataPlanListMap = new HashMap<>();
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, dataPlanListMap, new HashMap<>(),
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ int dataPlanForPlmn = mSatelliteControllerUT.getSatelliteDataPlanForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_PLAN_METERED, dataPlanForPlmn);
+ }
+
+ @Test
+ public void TestGetSupportedSatelliteServicesForPlmn_WithEntitlement() throws Exception {
+ logd("TestGetSupportedSatelliteServicesForPlmn_WithEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, List<Integer>> serviceTypeListMap = Map.of(
+ "00101", List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_SMS),
+ "00102", List.of(SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS),
+ "00103", List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS));
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), serviceTypeListMap,
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ List<Integer> allowedServiceForPlmn;
+ allowedServiceForPlmn = mSatelliteControllerUT
+ .getSupportedSatelliteServicesForPlmn(SUB_ID, "00101");
+ assertEquals(List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_SMS), allowedServiceForPlmn);
+
+ allowedServiceForPlmn = mSatelliteControllerUT
+ .getSupportedSatelliteServicesForPlmn(SUB_ID, "00102");
+ assertEquals(List.of(SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS), allowedServiceForPlmn);
+
+ allowedServiceForPlmn = mSatelliteControllerUT
+ .getSupportedSatelliteServicesForPlmn(SUB_ID, "00103");
+ assertEquals(List.of(SERVICE_TYPE_DATA, SERVICE_TYPE_VOICE, SERVICE_TYPE_SMS),
+ allowedServiceForPlmn);
+ }
+
+ @Test
+ public void TestGetSupportedSatelliteServicesForPlmn_WithoutEntitlement() throws Exception {
+ logd("TestGetSupportedSatelliteServicesForPlmn_WithoutAllowedServices");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataPlanListMap = new HashMap<>();
+ Map<String, List<Integer>> allowedServiceListMap = new HashMap<>();
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, dataPlanListMap, allowedServiceListMap,
+ new HashMap<>(), new HashMap<>(), mIIntegerConsumer);
+
+ // Verify whether the carrier config plmn list is returned with conditions below
+ // the config data plmn list : empty
+ // the carrier config plmn list : exist with services {{2}}
+ setConfigData(new ArrayList<>());
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+ PersistableBundle carrierSupportedSatelliteServicesPerProvider =
+ new PersistableBundle();
+ List<String> carrierConfigPlmnList = List.of("00101");
+ carrierSupportedSatelliteServicesPerProvider.putIntArray(
+ carrierConfigPlmnList.get(0), new int[]{2});
+ mCarrierConfigBundle.putPersistableBundle(CarrierConfigManager
+ .KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE,
+ carrierSupportedSatelliteServicesPerProvider);
+ invokeCarrierConfigChanged();
+
+ List<Integer> servicesPerPlmn;
+ servicesPerPlmn = mSatelliteControllerUT.getSupportedSatelliteServicesForPlmn(
+ SUB_ID, "00101");
+ assertEquals(Arrays.asList(2).stream().sorted().toList(),
+ servicesPerPlmn.stream().sorted().toList());
+ }
+
+ @Test
+ public void testGetSupportedSatelliteDataModeForPlmn_WithEntitlement() throws Exception {
+ logd("testGetSupportedSatelliteDataModeForPlmn_WithEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataServicePolicyMap = Map.of(
+ "00101", SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED,
+ "00102", SATELLITE_DATA_SUPPORT_ALL
+ );
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ dataServicePolicyMap, new HashMap<>(), mIIntegerConsumer);
+
+ int dataSupportModeForPlmn;
+ dataSupportModeForPlmn = mSatelliteControllerUT
+ .getSatelliteDataServicePolicyForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED, dataSupportModeForPlmn);
+
+ dataSupportModeForPlmn = mSatelliteControllerUT
+ .getSatelliteDataServicePolicyForPlmn(SUB_ID, "00102");
+ assertEquals(SATELLITE_DATA_SUPPORT_ALL, dataSupportModeForPlmn);
+
+ }
+
+ @Test
+ public void testGetSupportedSatelliteDataModeForPlmn_WithoutEntitlement() throws Exception {
+ logd("testGetSupportedSatelliteDataModeForPlmn_WithoutEntitlement");
+ when(mFeatureFlags.carrierEnabledSatelliteFlag()).thenReturn(true);
+
+ replaceInstance(SatelliteController.class, "mMergedPlmnListPerCarrier",
+ mSatelliteControllerUT, new SparseArray<>());
+ List<String> overlayConfigPlmnList = new ArrayList<>();
+ replaceInstance(SatelliteController.class, "mSatellitePlmnListFromOverlayConfig",
+ mSatelliteControllerUT, overlayConfigPlmnList);
+ mCarrierConfigBundle.putBoolean(
+ CarrierConfigManager.KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL, true);
+ mCarrierConfigBundle.putBoolean(CarrierConfigManager.KEY_SATELLITE_ATTACH_SUPPORTED_BOOL,
+ true);
+
+ List<String> entitlementPlmnList =
+ Arrays.stream(new String[]{"00101", "00102", "00103", "00104"})
+ .toList();
+ List<String> barredPlmnList = new ArrayList<>();
+ Map<String, Integer> dataServicePolicyMap = new HashMap<>();
+ mSatelliteControllerUT.onSatelliteEntitlementStatusUpdated(SUB_ID, false,
+ entitlementPlmnList, barredPlmnList, new HashMap<>(), new HashMap<>(),
+ dataServicePolicyMap, new HashMap<>(), mIIntegerConsumer);
+
+ mCarrierConfigBundle.putInt(
+ CarrierConfigManager.KEY_SATELLITE_DATA_SUPPORT_MODE_INT,
+ SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED);
+ int dataSupportModeForPlmn = mSatelliteControllerUT
+ .getSatelliteDataServicePolicyForPlmn(SUB_ID, "00101");
+ assertEquals(SATELLITE_DATA_SUPPORT_BANDWIDTH_CONSTRAINED, dataSupportModeForPlmn);
+ }
}
diff --git a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
index 56d5731..529088b 100644
--- a/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
+++ b/tests/telephonytests/src/com/android/internal/telephony/satellite/SatelliteSOSMessageRecommenderTest.java
@@ -373,6 +373,7 @@
@Test
public void testSatelliteProvisionStateChangedBeforeTimeout() {
+ mTestSatelliteController.setSatelliteConnectedViaCarrierWithinHysteresisTime(false);
mTestSOSMessageRecommender.onEmergencyCallStarted(mTestConnection, false);
processAllMessages();
@@ -393,6 +394,7 @@
assertFalse(mTestSOSMessageRecommender.isDialerNotified());
reset(mMockSatelliteStats);
+ mTestSatelliteController.setSatelliteConnectedViaCarrierWithinHysteresisTime(true);
mTestSOSMessageRecommender.onEmergencyCallStarted(mTestConnection, false);
processAllMessages();
assertTrue(mTestSOSMessageRecommender.isTimerStarted());
@@ -983,6 +985,8 @@
private ComponentName mSmsAppComponent = new ComponentName(
DEFAULT_SATELLITE_MESSAGING_PACKAGE, DEFAULT_SATELLITE_MESSAGING_CLASS);
private boolean mIsDialerNotified;
+ private boolean mProvisionState = true;
+ private boolean mSatelliteAllowedByReasons = true;
/**
* Create an instance of SatelliteSOSMessageRecommender.
@@ -1017,6 +1021,16 @@
mIsDialerNotified = isDialerNotified;
}
+ @Override
+ protected boolean updateAndGetProvisionState() {
+ return mProvisionState;
+ }
+
+ @Override
+ protected boolean isSatelliteAllowedByReasons() {
+ return mSatelliteAllowedByReasons;
+ }
+
public boolean isTimerStarted() {
return hasMessages(EVENT_TIME_OUT);
}