Snap for 5820048 from 6c7f75db5bf45e6914b871239db09a892941303a to qt-c2f2-release
Change-Id: Ie4ac59f5f6403ee1a34423bc115b94d1654cbedb
diff --git a/src/com/android/server/telecom/CallsManager.java b/src/com/android/server/telecom/CallsManager.java
index d6bd975..1be879d 100644
--- a/src/com/android/server/telecom/CallsManager.java
+++ b/src/com/android/server/telecom/CallsManager.java
@@ -35,6 +35,7 @@
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;
@@ -1099,9 +1100,11 @@
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.
@@ -1531,11 +1534,12 @@
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
@@ -2318,9 +2322,22 @@
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) {
diff --git a/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java b/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java
index 5b1971e..291fef8 100644
--- a/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java
+++ b/src/com/android/server/telecom/callfiltering/CallScreeningServiceController.java
@@ -253,7 +253,7 @@
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;
diff --git a/tests/src/com/android/server/telecom/tests/ComponentContextFixture.java b/tests/src/com/android/server/telecom/tests/ComponentContextFixture.java
index 86bbadb..19278a5 100644
--- a/tests/src/com/android/server/telecom/tests/ComponentContextFixture.java
+++ b/tests/src/com/android/server/telecom/tests/ComponentContextFixture.java
@@ -51,6 +51,7 @@
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 @@
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 @@
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),