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

Commit caf6fca2 authored by Hall Liu's avatar Hall Liu Committed by Automerger Merge Worker
Browse files

Merge "Enable RTT in the IMS stack when there's no SIM" am: 52e5b0f1 am: 2e8293a5

Change-Id: Ied67438d2db2f0d78185dbd0d9d7f5f135294219
parents e6b1bfa5 2e8293a5
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -2049,8 +2049,14 @@ public class ImsManager implements IFeatureConnector {
    }

    public boolean updateRttConfigValue() {
        // If there's no active sub anywhere on the device, enable RTT on the modem so that
        // the device can make an emergency call.

        boolean isActiveSubscriptionPresent = isActiveSubscriptionPresent();
        boolean isCarrierSupported =
                getBooleanCarrierConfig(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL);
                getBooleanCarrierConfig(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL)
                || !isActiveSubscriptionPresent;

        boolean isRttUiSettingEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.RTT_CALLING_MODE, 0) != 0;
        boolean isRttAlwaysOnCarrierConfig = getBooleanCarrierConfig(
@@ -2058,7 +2064,8 @@ public class ImsManager implements IFeatureConnector {

        boolean shouldImsRttBeOn = isRttUiSettingEnabled || isRttAlwaysOnCarrierConfig;
        logi("update RTT: settings value: " + isRttUiSettingEnabled + " always-on carrierconfig: "
                + isRttAlwaysOnCarrierConfig);
                + isRttAlwaysOnCarrierConfig
                + "isActiveSubscriptionPresent: " + isActiveSubscriptionPresent);

        if (isCarrierSupported) {
            setRttConfig(shouldImsRttBeOn);
@@ -2744,6 +2751,12 @@ public class ImsManager implements IFeatureConnector {
                subId != SubscriptionManager.DEFAULT_SUBSCRIPTION_ID;
    }

    private boolean isActiveSubscriptionPresent() {
        SubscriptionManager sm = (SubscriptionManager) mContext.getSystemService(
                Context.TELEPHONY_SUBSCRIPTION_SERVICE);
        return sm.getActiveSubscriptionIdList().length > 0;
    }

    private void updateImsCarrierConfigs(PersistableBundle configs) throws ImsException {
        checkAndThrowExceptionIfServiceUnavailable();