Ensure hold capability is removed from ImsConference if hold not supported. am: 547c90d833 am: c1a5ae082e
am: 9524e8f1c3
Change-Id: I4003d38921f06890d5dfc36d60360fbbfd4b371e
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index 3f49c6f..e33c351 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -20,6 +20,7 @@
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
+import android.os.PersistableBundle;
import android.telecom.Conference;
import android.telecom.ConferenceParticipant;
import android.telecom.Connection.VideoProvider;
@@ -29,6 +30,7 @@
import android.telecom.PhoneAccountHandle;
import android.telecom.StatusHints;
import android.telecom.VideoProfile;
+import android.telephony.CarrierConfigManager;
import android.telephony.PhoneNumberUtils;
import android.util.Pair;
@@ -36,6 +38,7 @@
import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
+import com.android.phone.PhoneGlobals;
import com.android.phone.PhoneUtils;
import com.android.phone.R;
@@ -279,8 +282,11 @@
mTelephonyConnectionService = telephonyConnectionService;
setConferenceHost(conferenceHost);
- int capabilities = Connection.CAPABILITY_SUPPORT_HOLD | Connection.CAPABILITY_HOLD |
- Connection.CAPABILITY_MUTE | Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN;
+ int capabilities = Connection.CAPABILITY_MUTE |
+ Connection.CAPABILITY_CONFERENCE_HAS_NO_CHILDREN;
+ if (canHoldImsCalls()) {
+ capabilities |= Connection.CAPABILITY_SUPPORT_HOLD | Connection.CAPABILITY_HOLD;
+ }
capabilities = applyHostCapabilities(capabilities,
mConferenceHost.getConnectionCapabilities(),
mConferenceHost.isCarrierVideoConferencingSupported());
@@ -976,4 +982,22 @@
sb.append("]");
return sb.toString();
}
+
+ 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() {
+ if (mConferenceHost == null) {
+ return null;
+ }
+
+ Phone phone = mConferenceHost.getPhone();
+ if (phone == null) {
+ return null;
+ }
+ return PhoneGlobals.getInstance().getCarrierConfigForSubId(phone.getSubId());
+ }
}