summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author Sooraj Sasindran <sasindran@google.com> 2025-03-18 15:53:56 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2025-03-18 15:53:56 -0700
commit1502c485db8beb0955cc2f781eab2c801ad453aa (patch)
treec69390f989012a7076f73061ef69b1a2be87961c /src
parent0877124a371b8f2cd5abc085a3624742ac5c43d3 (diff)
parentebac75111ecf41826c2c5fdb033945518a1fe9d2 (diff)
Merge "logic for api getSatelliteDataMode" into main
Diffstat (limited to 'src')
-rw-r--r--src/java/com/android/internal/telephony/satellite/SatelliteController.java90
1 files changed, 61 insertions, 29 deletions
diff --git a/src/java/com/android/internal/telephony/satellite/SatelliteController.java b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
index 93d222b512..f82c0c1db4 100644
--- a/src/java/com/android/internal/telephony/satellite/SatelliteController.java
+++ b/src/java/com/android/internal/telephony/satellite/SatelliteController.java
@@ -3955,25 +3955,28 @@ public class SatelliteController extends Handler {
* @return The list of services supported by the carrier associated with the
*/
private List<Integer> getSatelliteSupportedServicesFromConfig(int subId, String plmn) {
- synchronized (mSupportedSatelliteServicesLock) {
- if (mSatelliteServicesSupportedByCarriersFromConfig.containsKey(subId)) {
- Map<String, Set<Integer>> supportedServices =
- mSatelliteServicesSupportedByCarriersFromConfig.get(subId);
- if (supportedServices != null && supportedServices.containsKey(plmn)) {
- return new ArrayList<>(supportedServices.get(plmn));
+ if (plmn != null && !plmn.isEmpty()) {
+ synchronized (mSupportedSatelliteServicesLock) {
+ if (mSatelliteServicesSupportedByCarriersFromConfig.containsKey(subId)) {
+ Map<String, Set<Integer>> supportedServices =
+ mSatelliteServicesSupportedByCarriersFromConfig.get(subId);
+ if (supportedServices != null && supportedServices.containsKey(plmn)) {
+ return new ArrayList<>(supportedServices.get(plmn));
+ } else {
+ loge("getSupportedSatelliteServices: subId=" + subId
+ + ", supportedServices "
+ + "does not contain key plmn=" + plmn);
+ }
} else {
- loge("getSupportedSatelliteServices: subId=" + subId + ", supportedServices "
- + "does not contain key plmn=" + plmn);
+ loge("getSupportedSatelliteServices: "
+ + "mSatelliteServicesSupportedByCarriersFromConfig does not contain"
+ + " key subId=" + subId);
}
- } else {
- loge("getSupportedSatelliteServices: "
- + "mSatelliteServicesSupportedByCarriersFromConfig does not contain key "
- + "subId=" + subId);
}
}
- /* Returns default capabilities when carrier config does not contain service
- capabilities for the given plmn */
+ /* Returns default capabilities when carrier config does not contain service capabilities
+ for the given plmn */
PersistableBundle config = getPersistableBundle(subId);
int [] defaultCapabilities = config.getIntArray(
KEY_CARRIER_ROAMING_SATELLITE_DEFAULT_SERVICES_INT_ARRAY);
@@ -3993,25 +3996,35 @@ public class SatelliteController extends Handler {
* @param subId Subscription ID.
* @param plmn The satellite plmn.
* @return The list of services supported by the carrier associated with the {@code subId} for
- * the satellite network {@code plmn}.
+ * the satellite network {@code plmn}. Returns empty list at invalid sub id.
+ *
*/
@NonNull
public List<Integer> getSupportedSatelliteServicesForPlmn(int subId, String plmn) {
+
+ if (!isValidSubscriptionId(subId)) {
+ logd("getSupportedSatelliteServices: invalid sub id");
+ return new ArrayList<>();
+ }
synchronized (mSupportedSatelliteServicesLock) {
- Map<String, List<Integer>> allowedServicesList
- = mEntitlementServiceTypeMapPerCarrier.get(subId);
- if (allowedServicesList != null && allowedServicesList.containsKey(plmn)) {
- List<Integer> allowedServiceValues = new ArrayList<>(allowedServicesList.get(plmn));
- if (allowedServiceValues != null && !allowedServiceValues.isEmpty()) {
- if (isDataServiceUpdateRequired(subId, plmn, allowedServiceValues)) {
- logd("getSupportedSatelliteServices: data service added to satellite plmn");
- allowedServiceValues.add(NetworkRegistrationInfo.SERVICE_TYPE_DATA);
- }
- if (allowedServiceValues.contains(NetworkRegistrationInfo.SERVICE_TYPE_DATA)
- && isMmsServiceUpdateRequired(subId, plmn, allowedServiceValues)) {
- allowedServiceValues.add(NetworkRegistrationInfo.SERVICE_TYPE_MMS);
+ if (plmn != null && !plmn.isEmpty()) {
+ Map<String, List<Integer>> allowedServicesList =
+ mEntitlementServiceTypeMapPerCarrier.get(subId);
+ if (allowedServicesList != null && allowedServicesList.containsKey(plmn)) {
+ List<Integer> allowedServiceValues = new ArrayList<>(
+ allowedServicesList.get(plmn));
+ if (allowedServiceValues != null && !allowedServiceValues.isEmpty()) {
+ if (isDataServiceUpdateRequired(subId, plmn, allowedServiceValues)) {
+ logd("getSupportedSatelliteServices: data service added to satellite"
+ + " plmn");
+ allowedServiceValues.add(NetworkRegistrationInfo.SERVICE_TYPE_DATA);
+ }
+ if (allowedServiceValues.contains(NetworkRegistrationInfo.SERVICE_TYPE_DATA)
+ && isMmsServiceUpdateRequired(subId, plmn, allowedServiceValues)) {
+ allowedServiceValues.add(NetworkRegistrationInfo.SERVICE_TYPE_MMS);
+ }
+ return allowedServiceValues;
}
- return allowedServiceValues;
}
}
@@ -9141,7 +9154,7 @@ public class SatelliteController extends Handler {
* @return Supported modes {@link CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE}
*/
public int getSatelliteDataServicePolicyForPlmn(int subId, String plmn) {
- if (plmn != null) {
+ if (plmn != null && isValidSubscriptionId(subId)) {
synchronized (mSupportedSatelliteServicesLock) {
Map<String, Integer> dataServicePolicy =
mEntitlementDataServicePolicyMapPerCarrier.get(
@@ -9204,4 +9217,23 @@ public class SatelliteController extends Handler {
return new ArrayList<>();
}
}
+
+ /**
+ * Method to return the current satellite data service policy supported mode for the
+ * subscription id based on carrier config.
+ *
+ * @param subId current subscription id.
+ *
+ * @return Supported modes {@link SatelliteManager#SatelliteDataSupportMode}
+ *
+ * @hide
+ */
+ @SatelliteManager.SatelliteDataSupportMode
+ public int getSatelliteDataSupportMode(int subId) {
+ if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
+ return SatelliteManager.SATELLITE_DATA_SUPPORT_RESTRICTED;
+ }
+
+ return getSatelliteDataServicePolicyForPlmn(subId, "");
+ }
}