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

Commit 18180f35 authored by Hyosun Kim's avatar Hyosun Kim Committed by Android (Google) Code Review
Browse files

Merge "Support NTN-Capable Subscription API" into main

parents 5520e3e9 95d24b09
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import static android.telephony.CarrierConfigManager.KEY_EMERGENCY_MESSAGING_SUP
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_ENTITLEMENT_SUPPORTED_BOOL;
import static android.telephony.CarrierConfigManager.KEY_SATELLITE_ESOS_SUPPORTED_BOOL;
import static android.telephony.SubscriptionManager.SATELLITE_ATTACH_ENABLED_FOR_CARRIER;
import static android.telephony.SubscriptionManager.SATELLITE_ENTITLEMENT_STATUS;
import static android.telephony.SubscriptionManager.isValidSubscriptionId;
@@ -3961,7 +3962,8 @@ public class SatelliteController extends Handler {
                KEY_SATELLITE_ENTITLEMENT_SUPPORTED_BOOL,
                KEY_CARRIER_ROAMING_SATELLITE_DEFAULT_SERVICES_INT_ARRAY,
                KEY_EMERGENCY_MESSAGING_SUPPORTED_BOOL,
                KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT);
                KEY_EMERGENCY_CALL_TO_SATELLITE_T911_HANDOVER_TIMEOUT_MILLIS_INT,
                KEY_SATELLITE_ESOS_SUPPORTED_BOOL);
        if (config == null || config.isEmpty()) {
            config = CarrierConfigManager.getDefaultConfig();
        }
@@ -3978,6 +3980,7 @@ public class SatelliteController extends Handler {
        }

        updateCarrierConfig(subId);
        updateSatelliteESOSSupported(subId);
        updateEntitlementPlmnListPerCarrier(subId);
        updateSupportedSatelliteServicesForActiveSubscriptions();
        processNewCarrierConfigData(subId);
@@ -4041,6 +4044,26 @@ public class SatelliteController extends Handler {
        }
    }

    /**
     * Update the value of SimInfo.COLUMN_SATELLITE_ESOS_SUPPORTED stored in the database based
     * on the value in the carrier config.
     */
    private void updateSatelliteESOSSupported(int subId) {
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            return;
        }

        boolean isSatelliteESosSupportedFromDB =
                mSubscriptionManagerService.getSatelliteESOSSupported(subId);
        boolean isSatelliteESosSupportedFromCarrierConfig = getConfigForSubId(subId).getBoolean(
                KEY_SATELLITE_ESOS_SUPPORTED_BOOL, false);
        if (isSatelliteESosSupportedFromDB != isSatelliteESosSupportedFromCarrierConfig) {
            mSubscriptionManagerService.setSatelliteESOSSupported(subId,
                    isSatelliteESosSupportedFromCarrierConfig);
            logd("updateSatelliteESOSSupported: " + isSatelliteESosSupportedFromCarrierConfig);
        }
    }

    @NonNull
    private String[] readStringArrayFromOverlayConfig(@ArrayRes int id) {
        String[] strArray = null;
+33 −6
Original line number Diff line number Diff line
@@ -280,7 +280,7 @@ public class SubscriptionDatabaseManager extends Handler {
                    SimInfo.COLUMN_SATELLITE_ATTACH_ENABLED_FOR_CARRIER,
                    SubscriptionInfoInternal::getSatelliteAttachEnabledForCarrier),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_IS_NTN,
                    SimInfo.COLUMN_IS_ONLY_NTN,
                    SubscriptionInfoInternal::getOnlyNonTerrestrialNetwork),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SERVICE_CAPABILITIES,
@@ -293,7 +293,10 @@ public class SubscriptionDatabaseManager extends Handler {
                    SubscriptionInfoInternal::getSatelliteEntitlementStatus),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SATELLITE_ENTITLEMENT_PLMNS,
                    SubscriptionInfoInternal::getSatelliteEntitlementPlmns)
                    SubscriptionInfoInternal::getSatelliteEntitlementPlmns),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SATELLITE_ESOS_SUPPORTED,
                    SubscriptionInfoInternal::getSatelliteESOSSupported)
    );

    /**
@@ -423,7 +426,7 @@ public class SubscriptionDatabaseManager extends Handler {
                    SimInfo.COLUMN_SATELLITE_ATTACH_ENABLED_FOR_CARRIER,
                    SubscriptionDatabaseManager::setSatelliteAttachEnabledForCarrier),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_IS_NTN,
                    SimInfo.COLUMN_IS_ONLY_NTN,
                    SubscriptionDatabaseManager::setNtn),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SERVICE_CAPABILITIES,
@@ -433,7 +436,10 @@ public class SubscriptionDatabaseManager extends Handler {
                    SubscriptionDatabaseManager::setTransferStatus),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SATELLITE_ENTITLEMENT_STATUS,
                    SubscriptionDatabaseManager::setSatelliteEntitlementStatus)
                    SubscriptionDatabaseManager::setSatelliteEntitlementStatus),
            new AbstractMap.SimpleImmutableEntry<>(
                    SimInfo.COLUMN_SATELLITE_ESOS_SUPPORTED,
                    SubscriptionDatabaseManager::setSatelliteESOSSupported)
    );

    /**
@@ -2063,7 +2069,7 @@ public class SubscriptionDatabaseManager extends Handler {
        if (!mFeatureFlags.oemEnabledSatelliteFlag()) {
            return;
        }
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_IS_NTN, isNtn,
        writeDatabaseAndCacheHelper(subId, SimInfo.COLUMN_IS_ONLY_NTN, isNtn,
                SubscriptionInfoInternal.Builder::setOnlyNonTerrestrialNetwork);
    }

@@ -2161,6 +2167,23 @@ public class SubscriptionDatabaseManager extends Handler {
        setSatelliteEntitlementPlmns(subId, satelliteEntitlementPlmns);
    }

    /**
     * Set whether the carrier roaming to satellite is using ESOS for emergency messaging.
     *
     * @param subId Subscription id.
     * @param isSatelliteESOSSupported whether the carrier roaming to satellite is using ESOS for
     * emergency messaging.
     * @throws IllegalArgumentException if the subscription does not exist.
     */
    public void setSatelliteESOSSupported(int subId, int isSatelliteESOSSupported) {
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            return;
        }
        writeDatabaseAndCacheHelper(subId,
                SimInfo.COLUMN_SATELLITE_ESOS_SUPPORTED, isSatelliteESOSSupported,
                SubscriptionInfoInternal.Builder::setSatelliteESOSSupported);
    }

    /**
     * Reload the database from content provider to the cache. This must be a synchronous operation
     * to prevent cache/database out-of-sync. Callers should be cautious to call this method because
@@ -2402,12 +2425,16 @@ public class SubscriptionDatabaseManager extends Handler {
                                SimInfo.COLUMN_SATELLITE_ENTITLEMENT_PLMNS)));
        if (mFeatureFlags.oemEnabledSatelliteFlag()) {
            builder.setOnlyNonTerrestrialNetwork(cursor.getInt(cursor.getColumnIndexOrThrow(
                    SimInfo.COLUMN_IS_NTN)));
                    SimInfo.COLUMN_IS_ONLY_NTN)));
        }
        if (mFeatureFlags.supportPsimToEsimConversion()) {
            builder.setTransferStatus(cursor.getInt(cursor.getColumnIndexOrThrow(
                    SimInfo.COLUMN_TRANSFER_STATUS)));
        }
        if (mFeatureFlags.carrierRoamingNbIotNtn()) {
            builder.setSatelliteESOSSupported(cursor.getInt(
                    cursor.getColumnIndexOrThrow(SimInfo.COLUMN_SATELLITE_ESOS_SUPPORTED)));
        }
        return builder.build();
    }

+38 −2
Original line number Diff line number Diff line
@@ -491,6 +491,12 @@ public class SubscriptionInfoInternal {
     */
    @NonNull private final String mSatelliteEntitlementPlmns;

    /**
     * Whether the carrier roaming to satellite is using ESOS for emergency messaging.
     * By default, its disabled. It is intended to use integer to fit the database format.
     */
    private final int mIsSatelliteESOSSupported;

    /**
     * Constructor from builder.
     *
@@ -570,6 +576,7 @@ public class SubscriptionInfoInternal {
        this.mTransferStatus = builder.mTransferStatus;
        this.mIsSatelliteEntitlementStatus = builder.mIsSatelliteEntitlementStatus;
        this.mSatelliteEntitlementPlmns = builder.mSatelliteEntitlementPlmns;
        this.mIsSatelliteESOSSupported = builder.mIsSatelliteESOSSupported;
    }

    /**
@@ -1266,6 +1273,13 @@ public class SubscriptionInfoInternal {
        return mSatelliteEntitlementPlmns;
    }

    /**
     * @return {@code 1} if the carrier roaming to satellite is using ESOS for emergency messaging.
     */
    public int getSatelliteESOSSupported() {
        return mIsSatelliteESOSSupported;
    }

    /** @return converted {@link SubscriptionInfo}. */
    @NonNull
    public SubscriptionInfo toSubscriptionInfo() {
@@ -1305,6 +1319,7 @@ public class SubscriptionInfoInternal {
                .setServiceCapabilities(
                        SubscriptionManager.getServiceCapabilitiesSet(mServiceCapabilities))
                .setTransferStatus(mTransferStatus)
                .setSatelliteESOSSupported(mIsSatelliteESOSSupported == 1)
                .build();
    }

@@ -1368,6 +1383,7 @@ public class SubscriptionInfoInternal {
                + " transferStatus=" + mTransferStatus
                + " satelliteEntitlementStatus=" + mIsSatelliteEntitlementStatus
                + " satelliteEntitlementPlmns=" + mSatelliteEntitlementPlmns
                + " isSatelliteESOSSupported=" + mIsSatelliteESOSSupported
                + "]";
    }

@@ -1430,7 +1446,8 @@ public class SubscriptionInfoInternal {
                && mServiceCapabilities == that.mServiceCapabilities
                && mTransferStatus == that.mTransferStatus
                && mIsSatelliteEntitlementStatus == that.mIsSatelliteEntitlementStatus
                && mSatelliteEntitlementPlmns.equals(that.mSatelliteEntitlementPlmns);
                && mSatelliteEntitlementPlmns.equals(that.mSatelliteEntitlementPlmns)
                && mIsSatelliteESOSSupported == that.mIsSatelliteESOSSupported;
    }

    @Override
@@ -1463,7 +1480,7 @@ public class SubscriptionInfoInternal {
                mIsSatelliteEnabled, mCardId, mIsGroupDisabled,
                mIsSatelliteAttachEnabledForCarrier, mIsOnlyNonTerrestrialNetwork,
                mServiceCapabilities, mTransferStatus, mIsSatelliteEntitlementStatus,
                mSatelliteEntitlementPlmns);
                mSatelliteEntitlementPlmns, mIsSatelliteESOSSupported);
        result = 31 * result + Arrays.hashCode(mNativeAccessRules);
        result = 31 * result + Arrays.hashCode(mCarrierConfigAccessRules);
        result = 31 * result + Arrays.hashCode(mRcsConfig);
@@ -1871,6 +1888,11 @@ public class SubscriptionInfoInternal {
        @NonNull
        private String mSatelliteEntitlementPlmns = "";

        /**
         * Whether the carrier roaming to satellite is using ESOS for emergency messaging.
         */
        private int mIsSatelliteESOSSupported = 0;

        /**
         * Default constructor.
         */
@@ -1953,6 +1975,7 @@ public class SubscriptionInfoInternal {
            mTransferStatus = info.mTransferStatus;
            mIsSatelliteEntitlementStatus = info.mIsSatelliteEntitlementStatus;
            mSatelliteEntitlementPlmns = info.mSatelliteEntitlementPlmns;
            mIsSatelliteESOSSupported = info.mIsSatelliteESOSSupported;
        }

        /**
@@ -2922,6 +2945,19 @@ public class SubscriptionInfoInternal {
            return this;
        }

        /**
         * Set whether the carrier roaming to satellite is using ESOS for emergency messaging.
         *
         * @param isSatelliteESOSSupported {@code 1} if the carrier roaming to satellite is using
         * ESOS for emergency messaging.
         * @return The builder
         */
        @NonNull
        public Builder setSatelliteESOSSupported(int isSatelliteESOSSupported) {
            mIsSatelliteESOSSupported = isSatelliteESOSSupported;
            return this;
        }

        /**
         * Build the {@link SubscriptionInfoInternal}.
         *
+40 −2
Original line number Diff line number Diff line
@@ -193,9 +193,10 @@ public class SubscriptionManagerService extends ISub.Stub {
            SimInfo.COLUMN_NR_ADVANCED_CALLING_ENABLED,
            SimInfo.COLUMN_SATELLITE_ENABLED,
            SimInfo.COLUMN_SATELLITE_ATTACH_ENABLED_FOR_CARRIER,
            SimInfo.COLUMN_IS_NTN,
            SimInfo.COLUMN_IS_ONLY_NTN,
            SimInfo.COLUMN_SATELLITE_ENTITLEMENT_STATUS,
            SimInfo.COLUMN_SATELLITE_ENTITLEMENT_PLMNS
            SimInfo.COLUMN_SATELLITE_ENTITLEMENT_PLMNS,
            SimInfo.COLUMN_SATELLITE_ESOS_SUPPORTED
    );

    /**
@@ -4593,6 +4594,43 @@ public class SubscriptionManagerService extends ISub.Stub {
                .orElse(new ArrayList<>());
    }

    /**
     * Set the satellite ESOS supported value in the subscription database.
     *
     * @param subId subscription id.
     * @param isSatelliteESOSSupported {@code true} satellite ESOS supported true.
     */
    public void setSatelliteESOSSupported(int subId, @NonNull boolean isSatelliteESOSSupported) {
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            return;
        }
        try {
            mSubscriptionDatabaseManager.setSatelliteESOSSupported(subId,
                    isSatelliteESOSSupported ? 1 : 0);
        } catch (IllegalArgumentException e) {
            loge("setSatelliteESOSSupported: invalid subId=" + subId);
        }
    }

    /**
     * Get the satellite ESOS supported value in the subscription database.
     *
     * @param subId subscription id.
     * @return the satellite ESOS supported true or false.
     */
    public boolean getSatelliteESOSSupported(int subId) {
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            return false;
        }
        SubscriptionInfoInternal subInfo = mSubscriptionDatabaseManager.getSubscriptionInfoInternal(
                subId);
        if (subInfo == null) {
            return false;
        }

        return subInfo.getSatelliteESOSSupported() == 1;
    }

    /**
     * checks whether esim bootstrap is activated for any of the available active subscription info
     * list.
+3 −2
Original line number Diff line number Diff line
@@ -131,11 +131,12 @@ public class FakeTelephonyProvider extends MockContentProvider {
                    + Telephony.SimInfo.COLUMN_SATELLITE_ENABLED + " INTEGER DEFAULT 0,"
                    + Telephony.SimInfo.COLUMN_SATELLITE_ATTACH_ENABLED_FOR_CARRIER
                    + " INTEGER DEFAULT 1, "
                    + Telephony.SimInfo.COLUMN_IS_NTN + " INTEGER DEFAULT 0,"
                    + Telephony.SimInfo.COLUMN_IS_ONLY_NTN + " INTEGER DEFAULT 0,"
                    + Telephony.SimInfo.COLUMN_SERVICE_CAPABILITIES + " INTEGER DEFAULT 7,"
                    + Telephony.SimInfo.COLUMN_TRANSFER_STATUS + " INTEGER DEFAULT 0,"
                    + Telephony.SimInfo.COLUMN_SATELLITE_ENTITLEMENT_STATUS + " INTEGER DEFAULT 0,"
                    + Telephony.SimInfo.COLUMN_SATELLITE_ENTITLEMENT_PLMNS + " TEXT"
                    + Telephony.SimInfo.COLUMN_SATELLITE_ENTITLEMENT_PLMNS + " TEXT,"
                    + Telephony.SimInfo.COLUMN_SATELLITE_ESOS_SUPPORTED + " INTEGER DEFAULT 0"
                    + ");";
        }

Loading