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

Commit ebac7511 authored by Akash Garg's avatar Akash Garg Committed by Nagendra Prasad Nagarle Basavaraju
Browse files

logic for api getSatelliteDataMode

Bug: 401043401
Flag: com.android.internal.telephony.flags.satellite_25q4_apis
Test: cts verified
Change-Id: I721b4107b9f63331e5a4636b838dfd03cf07fdce
parent 73c4f11c
Loading
Loading
Loading
Loading
+61 −29
Original line number Diff line number Diff line
@@ -3893,6 +3893,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 =
@@ -3900,18 +3901,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);
@@ -3931,18 +3934,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)
@@ -3952,6 +3964,7 @@ public class SatelliteController extends Handler {
                        return allowedServiceValues;
                    }
                }
            }

            return getSatelliteSupportedServicesFromConfig(subId, plmn);
        }
@@ -8996,7 +9009,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(
@@ -9059,4 +9072,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, "");
    }
}