diff options
author | Garik Badalyan <garikb@codeaurora.org> | 2014-09-26 16:08:44 -0700 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2014-11-04 08:54:04 -0700 |
commit | 704df5781b585da8feb6a8a1ab41fbb65b6f7345 (patch) | |
tree | 8138391c04892f1804e4ede49b4ae9272012c976 | |
parent | bbd0eadd05369daf6f0700c40089a4f329ab568a (diff) | |
download | android_packages_apps_ContactsCommon-704df5781b585da8feb6a8a1ab41fbb65b6f7345.tar.gz android_packages_apps_ContactsCommon-704df5781b585da8feb6a8a1ab41fbb65b6f7345.tar.bz2 android_packages_apps_ContactsCommon-704df5781b585da8feb6a8a1ab41fbb65b6f7345.zip |
IMS-VT: Dynamically enable/disable video call button.
Enable/disable Make Video Call button based on Phone's
local capabilities.
Change-Id: I94ef798bc7f21d38ee7ef5a8ad807cab4c95244c
-rw-r--r-- | src/com/android/contacts/common/CallUtil.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java index 38c514de..bbfbeb5d 100644 --- a/src/com/android/contacts/common/CallUtil.java +++ b/src/com/android/contacts/common/CallUtil.java @@ -27,6 +27,8 @@ import android.telecom.VideoProfile; import com.android.contacts.common.util.PhoneNumberHelper; import com.android.phone.common.PhoneConstants; +import java.util.List; + /** * Utilities related to calls. */ @@ -145,14 +147,24 @@ public class CallUtil { return Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null); } + private static boolean hasCapability(PhoneAccount phoneAccount, int capability) { + return (phoneAccount != null) && + ((phoneAccount.getCapabilities() & capability) == capability); + } + public static boolean isVideoEnabled(Context context) { TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); if (telecommMgr == null) { return false; } - - // TODO: Check telecommManager for value instead. - return true; + List<PhoneAccountHandle> phoneAccountHandles = telecommMgr.getCallCapablePhoneAccounts(); + for (PhoneAccountHandle handle : phoneAccountHandles) { + final PhoneAccount phoneAccount = telecommMgr.getPhoneAccount(handle); + if (hasCapability(phoneAccount, PhoneAccount.CAPABILITY_VIDEO_CALLING)) { + return true; + } + } + return false; } } |