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

Commit 753f37f9 authored by Nagendra Prasad Nagarle Basavaraju's avatar Nagendra Prasad Nagarle Basavaraju
Browse files

Allowed Services info changes to support Data Service check

- Add Data Service info when data service is part of configuration,
  data supported mode is restricted mode and allowed service
  info field doesnt included data service type.
- Add mms service info when allowed service info field doesnt
  include mms service type and data service is included when
  data supported mode is restricted mode.

Flag: EXEMPT Bug fix
Bug: 393246911
Test: m and atest
Test: Device test at b/393053859
Change-Id: Ib5f382b414025d2e7afa2814950c1bf669c0b9da
parent 2fbe2ddd
Loading
Loading
Loading
Loading
+112 −40
Original line number Diff line number Diff line
@@ -479,7 +479,7 @@ public class SatelliteController extends Handler {
     */
    @GuardedBy("mSupportedSatelliteServicesLock")
    @NonNull private final Map<Integer, Map<String, Set<Integer>>>
            mSatelliteServicesSupportedByCarriers = new HashMap<>();
            mSatelliteServicesSupportedByCarriersFromConfig = new HashMap<>();
    @NonNull private final Object mSupportedSatelliteServicesLock = new Object();
    @NonNull private final List<String> mSatellitePlmnListFromOverlayConfig;
    @NonNull private final CarrierConfigManager mCarrierConfigManager;
@@ -3861,29 +3861,61 @@ 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}.
     */
    @NonNull
    public List<Integer> getSupportedSatelliteServicesForPlmn(int subId, String plmn) {
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            logd("getSupportedSatelliteServices: carrierEnabledSatelliteFlag is disabled");
            return new ArrayList<>();
     *  checks if data service is allowed, to add part of list of services supported by satellite
     *  plmn, when data supported mode
     *  {@link CarrierConfigManager#KEY_SATELLITE_DATA_SUPPORT_MODE_INT} is restricted mode and no
     *  data service is included at allowed service info at the entitlement and when allowed service
     *  info field is present at the entitlement.
     *
     * @param subId subscription id
     * @param plmn  The satellite plmn
     * @param allowedServiceValues allowed services info supported by entitlement
     * @return {@code true} is supports data service else {@code false}
     */
    private boolean isDataServiceUpdateRequired(int subId, String plmn,
            List<Integer> allowedServiceValues) {
        if (!allowedServiceValues.contains(NetworkRegistrationInfo.SERVICE_TYPE_DATA)
                && getCarrierSatelliteDataSupportedModeFromConfig(subId)
                == CarrierConfigManager.SATELLITE_DATA_SUPPORT_ONLY_RESTRICTED) {
            return getSatelliteSupportedServicesFromConfig(subId, plmn)
                    .contains(NetworkRegistrationInfo.SERVICE_TYPE_DATA);
        }
        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;
        return false;
    }

    /**
     *  checks if mms service is allowed, to add part of list of services supported by satellite
     *  plmn, when no mms service is included at allowed services
     *
     * @param subId subscription id
     * @param plmn  The satellite plmn
     * @param allowedServiceValues allowed services info supported by entitlement
     * @return {@code true} is supports data service else {@code false}
     */
    private boolean isMmsServiceUpdateRequired(int subId, String plmn,
            List<Integer> allowedServiceValues) {
        if (!allowedServiceValues.contains(NetworkRegistrationInfo.SERVICE_TYPE_MMS)) {
            return getSatelliteSupportedServicesFromConfig(subId, plmn)
                    .contains(NetworkRegistrationInfo.SERVICE_TYPE_MMS);
        }
        return false;
    }
            if (mSatelliteServicesSupportedByCarriers.containsKey(subId)) {

    /**
     * Gives the list of satellite services associated with
     * {@link CarrierConfigManager#KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE}.
     * Note: If this config not found, fallback to
     * {@link CarrierConfigManager#KEY_CARRIER_ROAMING_SATELLITE_DEFAULT_SERVICES_INT_ARRAY}.
     *
     * @param subId subsctiption id
     * @param plmn The satellite plmn
     * @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 =
                        mSatelliteServicesSupportedByCarriers.get(subId);
                        mSatelliteServicesSupportedByCarriersFromConfig.get(subId);
                if (supportedServices != null && supportedServices.containsKey(plmn)) {
                    return new ArrayList<>(supportedServices.get(plmn));
                } else {
@@ -3891,8 +3923,10 @@ public class SatelliteController extends Handler {
                            + "does not contain key plmn=" + plmn);
                }
            } else {
                loge("getSupportedSatelliteServices: mSatelliteServicesSupportedByCarriers does "
                        + "not contain key subId=" + subId);
                loge("getSupportedSatelliteServices: "
                        + "mSatelliteServicesSupportedByCarriersFromConfig does not contain key "
                        + "subId=" + subId);
            }
        }

            /* Returns default capabilities when carrier config does not contain service
@@ -3911,6 +3945,40 @@ public class SatelliteController extends Handler {
                + ", return default values " + capabilitiesList);
        return capabilitiesList;
    }

    /**
     * @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}.
     */
    @NonNull
    public List<Integer> getSupportedSatelliteServicesForPlmn(int subId, String plmn) {
        if (!mFeatureFlags.carrierEnabledSatelliteFlag()) {
            logd("getSupportedSatelliteServices: carrierEnabledSatelliteFlag is disabled");
            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);
                    }
                    return allowedServiceValues;
                }
            }

            return getSatelliteSupportedServicesFromConfig(subId, plmn);
        }

    }

    /**
@@ -5336,7 +5404,7 @@ public class SatelliteController extends Handler {
        }

        synchronized (mSupportedSatelliteServicesLock) {
            mSatelliteServicesSupportedByCarriers.clear();
            mSatelliteServicesSupportedByCarriersFromConfig.clear();
            mMergedPlmnListPerCarrier.clear();
            int[] activeSubIds = mSubscriptionManagerService.getActiveSubIdList(true);
            if (activeSubIds != null) {
@@ -5390,10 +5458,11 @@ public class SatelliteController extends Handler {
                }
            }

            if (mSatelliteServicesSupportedByCarriers.containsKey(subId)
                    && mSatelliteServicesSupportedByCarriers.get(subId) != null) {
            if (mSatelliteServicesSupportedByCarriersFromConfig.containsKey(subId)
                    && mSatelliteServicesSupportedByCarriersFromConfig.get(subId) != null) {
                carrierPlmnList =
                        mSatelliteServicesSupportedByCarriers.get(subId).keySet().stream().toList();
                        mSatelliteServicesSupportedByCarriersFromConfig.get(subId).keySet()
                                .stream().toList();
                plogd("mMergedPlmnListPerCarrier is updated by carrier config: "
                        + String.join(",", carrierPlmnList));
                mCarrierRoamingSatelliteControllerStats.reportConfigDataSource(
@@ -5418,7 +5487,8 @@ public class SatelliteController extends Handler {
                Map<String, Set<Integer>> supportedServicesPerPlmn =
                        satelliteConfig.getSupportedSatelliteServices(carrierId);
                if (!supportedServicesPerPlmn.isEmpty()) {
                    mSatelliteServicesSupportedByCarriers.put(subId, supportedServicesPerPlmn);
                    mSatelliteServicesSupportedByCarriersFromConfig.put(subId,
                            supportedServicesPerPlmn);
                    plogd("updateSupportedSatelliteServices using ConfigUpdater, "
                            + "supportedServicesPerPlmn = " + supportedServicesPerPlmn.size());
                    updatePlmnListPerCarrier(subId);
@@ -5428,7 +5498,7 @@ public class SatelliteController extends Handler {
                }
            }

            mSatelliteServicesSupportedByCarriers.put(
            mSatelliteServicesSupportedByCarriersFromConfig.put(
                    subId, readSupportedSatelliteServicesFromCarrierConfig(subId));
            updatePlmnListPerCarrier(subId);
            plogd("updateSupportedSatelliteServices using carrier config");
@@ -5695,7 +5765,7 @@ public class SatelliteController extends Handler {
    }

    @CarrierConfigManager.SATELLITE_DATA_SUPPORT_MODE
    private int getCarrierSatelliteDataSupportedMode(int subId) {
    private int getCarrierSatelliteDataSupportedModeFromConfig(int subId) {
        return getConfigForSubId(subId).getInt(KEY_SATELLITE_DATA_SUPPORT_MODE_INT);
    }

@@ -8707,12 +8777,13 @@ public class SatelliteController extends Handler {
                        mEntitlementDataServicePolicyMapPerCarrier.get(
                        subId);
                logd("data policy available for sub id:" + dataServicePolicy);
                if (dataServicePolicy != null && dataServicePolicy.containsKey(plmn)) {
                if (dataServicePolicy != null && dataServicePolicy.containsKey(plmn)
                        && !plmn.isEmpty()) {
                    return dataServicePolicy.get(plmn);
                }
            }
        }
        return getCarrierSatelliteDataSupportedMode(subId);
        return getCarrierSatelliteDataSupportedModeFromConfig(subId);
    }

    /**
@@ -8732,7 +8803,8 @@ public class SatelliteController extends Handler {
                        mEntitlementVoiceServicePolicyMapPerCarrier.get(
                                subId);
                logd("voice policy available for sub id:" + voiceServicePolicy);
                if (voiceServicePolicy != null && voiceServicePolicy.containsKey(plmn)) {
                if (voiceServicePolicy != null && voiceServicePolicy.containsKey(plmn)
                        && !plmn.isEmpty()) {
                    return voiceServicePolicy.get(plmn);
                }
            }
+2 −5
Original line number Diff line number Diff line
@@ -42,10 +42,7 @@ public class SatelliteNetworkInfo {
            Map<String,String> allowedServicesInfo) {
        mPlmn = plmn;
        mDataPlanType = dataPlanType;
        if (allowedServicesInfo != null) {
            mAllowedServicesInfo = new HashMap<>(allowedServicesInfo);
        } else {
            mAllowedServicesInfo = new HashMap<>();
        }
        mAllowedServicesInfo = allowedServicesInfo != null
                ? new HashMap<>(allowedServicesInfo) : null;
    }
}
+215 −12

File changed.

Preview size limit exceeded, changes collapsed.