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

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

Merge "Using the ACTION_SATELLITE_SUBSCRIBER_ID_LIST_CHANGED intent instead of...

Merge "Using the ACTION_SATELLITE_SUBSCRIBER_ID_LIST_CHANGED intent instead of App intent." into main
parents e85adb1b 8d9817ef
Loading
Loading
Loading
Loading
+78 −7
Original line number Diff line number Diff line
@@ -547,6 +547,11 @@ public class SatelliteController extends Handler {
    @GuardedBy("mIsWifiConnectedLock")
    private boolean mIsWifiConnected = false;
    private boolean mHasSentBroadcast = false;
    // For satellite CTS test which to configure intent component with the necessary values.
    private boolean mChangeIntentComponent = false;
    private String mConfigSatelliteGatewayServicePackage = "";
    private String mConfigSatelliteCarrierRoamingEsosProvisionedClass = "";

    private BroadcastReceiver
            mDefaultSmsSubscriptionChangedBroadcastReceiver = new BroadcastReceiver() {
                @Override
@@ -6043,7 +6048,7 @@ public class SatelliteController extends Handler {
        for (Map.Entry<Integer, List<SubscriptionInfo>> entry : currentMap.entrySet()) {
            List<SubscriptionInfo> currentList = entry.getValue();
            List<SubscriptionInfo> newList = newMap.get(entry.getKey());
            if (currentList == null || currentList.size() != newList.size()) {
            if (newList == null || currentList == null || currentList.size() != newList.size()) {
                return true;
            }
            for (int i = 0; i < currentList.size(); i++) {
@@ -6058,13 +6063,11 @@ public class SatelliteController extends Handler {
    }

    private void sendBroadCastForProvisionedESOSSubs() {
        String packageName = getStringFromOverlayConfig(
                R.string.config_satellite_gateway_service_package);
        String className = getStringFromOverlayConfig(
                R.string.config_satellite_carrier_roaming_esos_provisioned_class);
        String packageName = getConfigSatelliteGatewayServicePackage();
        String className = getConfigSatelliteCarrierRoamingEsosProvisionedClass();
        if (packageName == null || className == null || packageName.isEmpty()
                || className.isEmpty()) {
            logd("sendBroadCaseToProvisionedESOSSubs: packageName or className is null or empty.");
            logd("sendBroadCastForProvisionedESOSSubs: packageName or className is null or empty.");
            return;
        }
        String action = SatelliteManager.ACTION_SATELLITE_SUBSCRIBER_ID_LIST_CHANGED;
@@ -6072,7 +6075,7 @@ public class SatelliteController extends Handler {
        Intent intent = new Intent(action);
        intent.setComponent(new ComponentName(packageName, className));
        mContext.sendBroadcast(intent);
        logd("sendBroadCaseToProvisionedESOSSubs" + intent);
        logd("sendBroadCastForProvisionedESOSSubs" + intent);
    }

    @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE)
@@ -6394,6 +6397,74 @@ public class SatelliteController extends Handler {
        }
    }

    /**
     * This API can be used by only CTS to override the cached value for the device overlay config
     * value :
     * config_satellite_gateway_service_package and
     * config_satellite_carrier_roaming_esos_provisioned_class.
     * These values are set before sending an intent to broadcast there are any change to list of
     * subscriber informations.
     *
     * @param name the name is one of the following that constitute an intent.
     *             component package name, or component class name.
     * @return {@code true} if the setting is successful, {@code false} otherwise.
     */
    public boolean setSatelliteSubscriberIdListChangedIntentComponent(String name) {
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            logd("setSatelliteSubscriberIdListChangedIntentComponent: carrierRoamingNbIotNtn is "
                    + "disabled");
            return false;
        }
        if (!isMockModemAllowed()) {
            logd("setSatelliteSubscriberIdListChangedIntentComponent: mock modem is not allowed");
            return false;
        }
        logd("setSatelliteSubscriberIdListChangedIntentComponent:" + name);

        if (name.contains("/")) {
            mChangeIntentComponent = true;
        } else {
            mChangeIntentComponent = false;
            return true;
        }
        boolean result = true;
        String[] cmdPart = name.split("/");
        switch (cmdPart[0]) {
            case "-p": {
                mConfigSatelliteGatewayServicePackage = cmdPart[1];
                break;
            }
            case "-c": {
                mConfigSatelliteCarrierRoamingEsosProvisionedClass = cmdPart[1];
                break;
            }
            default:
                logd("setSatelliteSubscriberIdListChangedIntentComponent: invalid name " + name);
                result = false;
                break;
        }
        return result;
    }

    private String getConfigSatelliteGatewayServicePackage() {
        if (!mChangeIntentComponent) {
            return getStringFromOverlayConfig(
                    R.string.config_satellite_gateway_service_package);
        }
        logd("getConfigSatelliteGatewayServicePackage: " + mConfigSatelliteGatewayServicePackage);
        return mConfigSatelliteGatewayServicePackage;
    }

    private String getConfigSatelliteCarrierRoamingEsosProvisionedClass() {
        if (!mChangeIntentComponent) {
            return getStringFromOverlayConfig(
                    R.string.config_satellite_carrier_roaming_esos_provisioned_class);
        }
        logd("getConfigSatelliteCarrierRoamingEsosProvisionedClass: "
                + mConfigSatelliteCarrierRoamingEsosProvisionedClass);
        return mConfigSatelliteCarrierRoamingEsosProvisionedClass;
    }

    private void registerDefaultSmsSubscriptionChangedBroadcastReceiver() {
        if (!mFeatureFlags.carrierRoamingNbIotNtn()) {
            plogd("registerDefaultSmsSubscriptionChangedBroadcastReceiver: Flag "