diff options
author | Yorke Lee <yorkelee@google.com> | 2015-03-19 23:42:42 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-03-19 23:42:42 +0000 |
commit | 6737f31a89e7a3eb52db3ecf281646d9074bde23 (patch) | |
tree | 04fbf8d6ad0ab0bfdd93511e5cbab14ded571aae | |
parent | 7983a6d9e680162c1f2c620ca25f04f094866ad0 (diff) | |
parent | 89baf1b48481690f3d5f1a9449d7d55dd8d2aff4 (diff) | |
download | android_packages_apps_ContactsCommon-6737f31a89e7a3eb52db3ecf281646d9074bde23.tar.gz android_packages_apps_ContactsCommon-6737f31a89e7a3eb52db3ecf281646d9074bde23.tar.bz2 android_packages_apps_ContactsCommon-6737f31a89e7a3eb52db3ecf281646d9074bde23.zip |
Merge "Revert "Revert "Enable video telephony support. (2/4)"""
-rw-r--r-- | src/com/android/contacts/common/CallUtil.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/com/android/contacts/common/CallUtil.java b/src/com/android/contacts/common/CallUtil.java index 48b717c4..b99436e3 100644 --- a/src/com/android/contacts/common/CallUtil.java +++ b/src/com/android/contacts/common/CallUtil.java @@ -28,6 +28,8 @@ import android.telecom.TelecomManager; import android.telecom.VideoProfile; import android.text.TextUtils; +import java.util.List; + /** * Utilities related to calls that can be used by non system apps. These * use {@link Intent#ACTION_CALL} instead of ACTION_CALL_PRIVILEGED. @@ -74,8 +76,15 @@ public class CallUtil { return Uri.fromParts(PhoneAccount.SCHEME_SIP, number, null); } return Uri.fromParts(PhoneAccount.SCHEME_TEL, number, null); - } + } + /** + * Determines if one of the call capable phone accounts defined supports video calling. + * + * @param context The context. + * @return {@code true} if one of the call capable phone accounts supports video calling, + * {@code false} otherwise. + */ public static boolean isVideoEnabled(Context context) { TelecomManager telecommMgr = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); @@ -83,8 +92,13 @@ public class CallUtil { return false; } - // TODO: Check telecommManager for value instead. - // return telecommMgr.isVideoEnabled(); + List<PhoneAccountHandle> accountHandles = telecommMgr.getCallCapablePhoneAccounts(); + for (PhoneAccountHandle accountHandle : accountHandles) { + PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle); + if (account.hasCapabilities(PhoneAccount.CAPABILITY_VIDEO_CALLING)) { + return true; + } + } return false; } } |