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

Commit 3cf0247d authored by Hall Liu's avatar Hall Liu
Browse files

Standardize RTT behavior across carriers

Remove references to the ignore rtt setting carrier config key, and
treat it as always-on for all carriers. Also turn on RTT in the IMS
stack when there's no SIM card inserted so that emergency calls can use
RTT in that scenario.

Bug: 122250491
Bug: 130010750
Test: manual
Change-Id: Ibf9cf45041f819a28757456082a1a80176797e81
Merged-In: Ibf9cf45041f819a28757456082a1a80176797e81
parent f0c70c6d
Loading
Loading
Loading
Loading
+17 −11
Original line number Diff line number Diff line
@@ -30,7 +30,6 @@ import android.os.PersistableBundle;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Settings;
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
@@ -2028,21 +2027,22 @@ 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 isCarrierSupported =
                getBooleanCarrierConfig(CarrierConfigManager.KEY_RTT_SUPPORTED_BOOL);
        boolean isRttUiSettingEnabled = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.RTT_CALLING_MODE, 0) != 0;
        boolean isRttAlwaysOnCarrierConfig = getBooleanCarrierConfig(
                CarrierConfigManager.KEY_IGNORE_RTT_MODE_SETTING_BOOL);

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

        if (isCarrierSupported) {
            setRttConfig(shouldImsRttBeOn);
        logi("update RTT: is carrier enabled: "
                + isCarrierSupported + "; is active sub present: "
                + isActiveSubscriptionPresent);

        if (isCarrierSupported || !isActiveSubscriptionPresent) {
            setRttConfig(true);
            return true;
        }
        return isCarrierSupported && shouldImsRttBeOn;
        return false;
    }

    private void setRttConfig(boolean enabled) {
@@ -2688,6 +2688,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();