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

Commit a4cc51ef authored by Hall Liu's avatar Hall Liu Committed by android-build-merger
Browse files

Check the ignore rtt setting carrier config am: 6c7f75db

am: 0d9cd774

Change-Id: Id0e7f1d5980af63a9dbd6f62e10b2395ece92478
parents 139129a7 0d9cd774
Loading
Loading
Loading
Loading
+23 −6
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.PersistableBundle;
import android.os.Process;
import android.os.SystemClock;
import android.os.SystemProperties;
@@ -1100,9 +1101,11 @@ public class CallsManager extends Call.ListenerBase
                call.setIsVoipAudioMode(true);
            }
        }
        if (isRttSettingOn() ||

        boolean isRttSettingOn = isRttSettingOn(phoneAccountHandle);
        if (isRttSettingOn ||
                extras.getBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT, false)) {
            Log.i(this, "Incoming call requesting RTT, rtt setting is %b", isRttSettingOn());
            Log.i(this, "Incoming call requesting RTT, rtt setting is %b", isRttSettingOn);
            call.createRttStreams();
            // Even if the phone account doesn't support RTT yet, the connection manager might
            // change that. Set this to check it later.
@@ -1533,11 +1536,12 @@ public class CallsManager extends Call.ListenerBase

                    boolean isVoicemail = isVoicemail(callToUse.getHandle(), accountToUse);

                    if (!isVoicemail && (isRttSettingOn() || (extras != null
                    boolean isRttSettingOn = isRttSettingOn(phoneAccountHandle);
                    if (!isVoicemail && (isRttSettingOn || (extras != null
                            && extras.getBoolean(TelecomManager.EXTRA_START_CALL_WITH_RTT,
                            false)))) {
                        Log.d(this, "Outgoing call requesting RTT, rtt setting is %b",
                                isRttSettingOn());
                                isRttSettingOn);
                        if (callToUse.isEmergencyCall() || (accountToUse != null
                                && accountToUse.hasCapabilities(PhoneAccount.CAPABILITY_RTT))) {
                            // If the call requested RTT and it's an emergency call, ignore the
@@ -2322,9 +2326,22 @@ public class CallsManager extends Call.ListenerBase
        mProximitySensorManager.turnOff(screenOnImmediately);
    }

    private boolean isRttSettingOn() {
        return Settings.Secure.getInt(mContext.getContentResolver(),
    private boolean isRttSettingOn(PhoneAccountHandle handle) {
        boolean isRttModeSettingOn = Settings.Secure.getInt(mContext.getContentResolver(),
                Settings.Secure.RTT_CALLING_MODE, 0) != 0;
        // If the carrier config says that we should ignore the RTT mode setting from the user,
        // assume that it's off (i.e. only make an RTT call if it's requested through the extra).
        boolean shouldIgnoreRttModeSetting = getCarrierConfigForPhoneAccount(handle)
                .getBoolean(CarrierConfigManager.KEY_IGNORE_RTT_MODE_SETTING_BOOL, false);
        return isRttModeSettingOn && !shouldIgnoreRttModeSetting;
    }

    private PersistableBundle getCarrierConfigForPhoneAccount(PhoneAccountHandle handle) {
        int subscriptionId = mPhoneAccountRegistrar.getSubscriptionIdForPhoneAccount(handle);
        CarrierConfigManager carrierConfigManager =
                mContext.getSystemService(CarrierConfigManager.class);
        PersistableBundle result = carrierConfigManager.getConfigForSubId(subscriptionId);
        return result == null ? new PersistableBundle() : result;
    }

    void phoneAccountSelected(Call call, PhoneAccountHandle account, boolean setDefault) {
+1 −1
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ public class CallScreeningServiceController implements IncomingCallFilter.CallFi
        PersistableBundle configBundle = configManager.getConfig();
        if (configBundle != null) {
            componentName = ComponentName.unflattenFromString(configBundle.getString
                    (CarrierConfigManager.KEY_CARRIER_CALL_SCREENING_APP_STRING));
                    (CarrierConfigManager.KEY_CARRIER_CALL_SCREENING_APP_STRING, ""));
        }

        return componentName != null ? componentName.getPackageName() : null;
+6 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.media.AudioManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.IInterface;
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.telecom.CallAudioState;
@@ -209,6 +210,8 @@ public class ComponentContextFixture implements TestFixture<Context> {
                return Context.AUDIO_SERVICE;
            } else if (svcClass == TelephonyManager.class) {
                return Context.TELEPHONY_SERVICE;
            } else if (svcClass == CarrierConfigManager.class) {
                return Context.CARRIER_CONFIG_SERVICE;
            }
            throw new UnsupportedOperationException();
        }
@@ -513,6 +516,9 @@ public class ComponentContextFixture implements TestFixture<Context> {

        when(mNotificationManager.matchesCallFilter(any(Bundle.class))).thenReturn(true);

        when(mCarrierConfigManager.getConfig()).thenReturn(new PersistableBundle());
        when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(new PersistableBundle());

        when(mUserManager.getSerialNumberForUser(any(UserHandle.class))).thenReturn(-1L);

        doReturn(null).when(mApplicationContextSpy).registerReceiver(any(BroadcastReceiver.class),