Add device config check for "allow hold" carrier config.
In addition to carrier config check, check to see if the device is
going to respoect the value of the "allow hold" carrier config.
Bug: 30449352
Change-Id: I466f8fd493790628e240b6484154702549808e93
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index 3810699..7ad37b0 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -973,7 +973,8 @@
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);
+ return !doesDeviceRespectHoldCarrierConfig() || b == null ||
+ b.getBoolean(CarrierConfigManager.KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL);
}
private PersistableBundle getCarrierConfig() {
@@ -985,6 +986,23 @@
}
/**
+ * Determines if the device will respect the value of the
+ * {@link CarrierConfigManager#KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL} configuration option.
+ *
+ * @return {@code false} if the device always supports holding IMS calls, {@code true} if it
+ * will use {@link CarrierConfigManager#KEY_ALLOW_HOLD_IN_IMS_CALL_BOOL} to determine if
+ * hold is supported.
+ */
+ private boolean doesDeviceRespectHoldCarrierConfig() {
+ Phone phone = getPhone();
+ if (phone == null) {
+ return true;
+ }
+ return phone.getContext().getResources().getBoolean(
+ com.android.internal.R.bool.config_device_respects_hold_carrier_config);
+ }
+
+ /**
* Whether the connection should be treated as an emergency.
* @return {@code true} if the connection should be treated as an emergency call based
* on the number dialed, {@code false} otherwise.