Add CarrierConfig option for removing Hold during Ims Calls
This change introduces a carrier config option that removes the
CAPABILITY_HOLD and CAPABILITY_SUPPORT_HOLD capabilities from Ims
Connections for incoming and outgoing voice calls if it is set.
Bug: 30195356
Change-Id: I8e68564758cfbc1dad54a23c1d2193d387e630b4
diff --git a/src/com/android/services/telephony/GsmConnection.java b/src/com/android/services/telephony/GsmConnection.java
index dd47e8d..eec0951 100644
--- a/src/com/android/services/telephony/GsmConnection.java
+++ b/src/com/android/services/telephony/GsmConnection.java
@@ -60,6 +60,9 @@
protected int buildConnectionCapabilities() {
int capabilities = super.buildConnectionCapabilities();
capabilities |= CAPABILITY_MUTE;
+ // Overwrites TelephonyConnection.buildConnectionCapabilities() and resets the hold options
+ // because all GSM calls should hold, even if the carrier config option is set to not show
+ // hold for IMS calls.
if (!shouldTreatAsEmergencyCall()) {
capabilities |= CAPABILITY_SUPPORT_HOLD;
if (getState() == STATE_ACTIVE || getState() == STATE_HOLDING) {
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index d2035cc..1e4feca 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -660,12 +660,10 @@
if (mOriginalConnection != null && mOriginalConnection.isIncoming()) {
callCapabilities |= CAPABILITY_SPEED_UP_MT_AUDIO;
}
- if (isImsConnection()) {
- if (!shouldTreatAsEmergencyCall()) {
- callCapabilities |= CAPABILITY_SUPPORT_HOLD;
- if (getState() == STATE_ACTIVE || getState() == STATE_HOLDING) {
- callCapabilities |= CAPABILITY_HOLD;
- }
+ if (!shouldTreatAsEmergencyCall() && isImsConnection() && canHoldImsCalls()) {
+ callCapabilities |= CAPABILITY_SUPPORT_HOLD;
+ if (getState() == STATE_ACTIVE || getState() == STATE_HOLDING) {
+ callCapabilities |= CAPABILITY_HOLD;
}
}
@@ -896,6 +894,12 @@
return true;
}
+ private boolean canHoldImsCalls() {
+ PersistableBundle b = getCarrierConfig();
+ // Return true if the CarrierConfig is unavailable
+ return b == null || b.getBoolean(CarrierConfigManager.KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL);
+ }
+
private PersistableBundle getCarrierConfig() {
Phone phone = getPhone();
if (phone == null) {