Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1502c485 authored by Sooraj Sasindran's avatar Sooraj Sasindran Committed by Android (Google) Code Review
Browse files

Merge "logic for api getSatelliteDataMode" into main

parents 0877124a ebac7511
Loading
Loading
Loading
Loading
+61 −29
Original line number Diff line number Diff line
@@ -3955,6 +3955,7 @@ 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) {
        if (plmn != null && !plmn.isEmpty()) {
            synchronized (mSupportedSatelliteServicesLock) {
                if (mSatelliteServicesSupportedByCarriersFromConfig.containsKey(subId)) {
                    Map<String, Set<Integer>> supportedServices =
@@ -3962,18 +3963,20 @@ public class SatelliteController extends Handler {
                    if (supportedServices != null && supportedServices.containsKey(plmn)) {
                        return new ArrayList<>(supportedServices.get(plmn));
                    } else {
                    loge("getSupportedSatelliteServices: subId=" + subId + ", supportedServices "
                        loge("getSupportedSatelliteServices: subId=" + subId
                                + ", supportedServices "
                                + "does not contain key plmn=" + plmn);
                    }
                } else {
                    loge("getSupportedSatelliteServices: "
                        + "mSatelliteServicesSupportedByCarriersFromConfig does not contain key "
                        + "subId=" + subId);
                            + "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,18 +3996,27 @@ 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 (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));
                    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");
                            logd("getSupportedSatelliteServices: data service added to satellite"
                                    + " plmn");
                            allowedServiceValues.add(NetworkRegistrationInfo.SERVICE_TYPE_DATA);
                        }
                        if (allowedServiceValues.contains(NetworkRegistrationInfo.SERVICE_TYPE_DATA)
@@ -4014,6 +4026,7 @@ public class SatelliteController extends Handler {
                        return allowedServiceValues;
                    }
                }
            }

            return getSatelliteSupportedServicesFromConfig(subId, plmn);
        }
@@ -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, "");
    }
}