From 3e122f76f1648a1ad87f7492c6c491d5dfaf54ea Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Mon, 11 Jan 2016 19:25:00 -0800 Subject: [PATCH] Add KEY_USE_RCS_PRESENCE_BOOL carrier config option. - New carrier config option is used to determine if presence is used to determine whether a contact is capable of video calling. - Also, improve logging for PhoneAccount capabilities. Bug: 20257833 Change-Id: Ifcc7df95677eb4399f08eb8849c4004892957e90 --- api/system-current.txt | 1 + .../java/android/telecom/PhoneAccount.java | 40 ++++++++++++++++++- .../telephony/CarrierConfigManager.java | 18 +++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/api/system-current.txt b/api/system-current.txt index 430aca8f439e0..ccae4d9a07e14 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -37818,6 +37818,7 @@ package android.telephony { field public static final java.lang.String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool"; field public static final java.lang.String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool"; field public static final java.lang.String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool"; + field public static final java.lang.String KEY_USE_RCS_PRESENCE_BOOL = "use_rcs_presence_bool"; field public static final java.lang.String KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL = "voicemail_notification_persistent_bool"; field public static final java.lang.String KEY_VOICE_PRIVACY_DISABLE_UI_BOOL = "voice_privacy_disable_ui_bool"; field public static final java.lang.String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int"; diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index b18af33a3a3be..b56ce736aef60 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -687,7 +687,7 @@ public final class PhoneAccount implements Parcelable { .append("] PhoneAccount: ") .append(mAccountHandle) .append(" Capabilities: ") - .append(mCapabilities) + .append(capabilitiesToString(mCapabilities)) .append(" Schemes: "); for (String scheme : mSupportedUriSchemes) { sb.append(scheme) @@ -698,4 +698,42 @@ public final class PhoneAccount implements Parcelable { sb.append("]"); return sb.toString(); } + + /** + * Generates a string representation of a capabilities bitmask. + * + * @param capabilities The capabilities bitmask. + * @return String representation of the capabilities bitmask. + */ + private String capabilitiesToString(int capabilities) { + StringBuilder sb = new StringBuilder(); + if (hasCapabilities(CAPABILITY_VIDEO_CALLING)) { + sb.append("Video "); + } + if (hasCapabilities(CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) { + sb.append("Presence "); + } + if (hasCapabilities(CAPABILITY_CALL_PROVIDER)) { + sb.append("CallProvider "); + } + if (hasCapabilities(CAPABILITY_CALL_SUBJECT)) { + sb.append("CallSubject "); + } + if (hasCapabilities(CAPABILITY_CONNECTION_MANAGER)) { + sb.append("ConnectionMgr "); + } + if (hasCapabilities(CAPABILITY_EMERGENCY_CALLS_ONLY)) { + sb.append("EmergOnly "); + } + if (hasCapabilities(CAPABILITY_MULTI_USER)) { + sb.append("MultiUser "); + } + if (hasCapabilities(CAPABILITY_PLACE_EMERGENCY_CALLS)) { + sb.append("PlaceEmerg "); + } + if (hasCapabilities(CAPABILITY_SIM_SUBSCRIPTION)) { + sb.append("SimSub "); + } + return sb.toString(); + } } diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 6ffc026146578..1a040bb57fad4 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -553,6 +553,23 @@ public class CarrierConfigManager { public static final String BOOL_ALLOW_VIDEO_PAUSE = "bool_allow_video_pause"; + + /** + * Flag indicating whether the carrier supports RCS presence indication for video calls. When + * {@code true}, the carrier supports RCS presence indication for video calls. When presence + * is supported, the device should use the + * {@link android.provider.ContactsContract.Data#CARRIER_PRESENCE} bit mask and set the + * {@link android.provider.ContactsContract.Data#CARRIER_PRESENCE_VT_CAPABLE} bit to indicate + * whether each contact supports video calling. The UI is made aware that presence is enabled + * via {@link android.telecom.PhoneAccount#CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE} + * and can choose to hide or show the video calling icon based on whether a contact supports + * video. + * + * @hide + */ + @SystemApi + public static final String KEY_USE_RCS_PRESENCE_BOOL = "use_rcs_presence_bool"; + /** The default value for every variable. */ private final static PersistableBundle sDefaults; @@ -662,6 +679,7 @@ public class CarrierConfigManager { sDefaults.putString(KEY_MMS_UA_PROF_URL_STRING, ""); sDefaults.putString(KEY_MMS_USER_AGENT_STRING, ""); sDefaults.putBoolean(KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL, true); + sDefaults.putBoolean(KEY_USE_RCS_PRESENCE_BOOL, false); } /**