summaryrefslogtreecommitdiffstats
path: root/telecomm
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-10-14 16:55:26 -0700
committerAndrew Lee <anwlee@google.com>2014-10-14 16:56:11 -0700
commit52d65739adcf5a64f5050f699003f056f6af4e7c (patch)
treef3d7bcff5fba1a10462cc334ccbfe88f46b797a6 /telecomm
parent63360780f2bf21f55ba6f58c3624f19c7d52626b (diff)
downloadframeworks_base-52d65739adcf5a64f5050f699003f056f6af4e7c.zip
frameworks_base-52d65739adcf5a64f5050f699003f056f6af4e7c.tar.gz
frameworks_base-52d65739adcf5a64f5050f699003f056f6af4e7c.tar.bz2
Add helper method for checking phone capabilities.
I'm figuring this can help standardize phone capability checks when need to do all over the place. Bug: 17429707 Change-Id: I97327fd08158de3c18d186b6092597a1d4abcf14
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/PhoneCapabilities.java35
1 files changed, 23 insertions, 12 deletions
diff --git a/telecomm/java/android/telecom/PhoneCapabilities.java b/telecomm/java/android/telecom/PhoneCapabilities.java
index e73dfe2..c7d9014 100644
--- a/telecomm/java/android/telecom/PhoneCapabilities.java
+++ b/telecomm/java/android/telecom/PhoneCapabilities.java
@@ -92,43 +92,54 @@ public final class PhoneCapabilities {
| ADD_CALL | RESPOND_VIA_TEXT | MUTE | MANAGE_CONFERENCE | SEPARATE_FROM_CONFERENCE
| DISCONNECT_FROM_CONFERENCE;
+ /**
+ * Whether this set of capabilities supports the specified capability.
+ * @param capabilities The set of capabilities.
+ * @param capability The capability to check capabilities for.
+ * @return Whether the specified capability is supported.
+ * @hide
+ */
+ public static boolean can(int capabilities, int capability) {
+ return (capabilities & capability) != 0;
+ }
+
public static String toString(int capabilities) {
StringBuilder builder = new StringBuilder();
builder.append("[Capabilities:");
- if ((capabilities & HOLD) != 0) {
+ if (can(capabilities, HOLD)) {
builder.append(" HOLD");
}
- if ((capabilities & SUPPORT_HOLD) != 0) {
+ if (can(capabilities, SUPPORT_HOLD)) {
builder.append(" SUPPORT_HOLD");
}
- if ((capabilities & MERGE_CONFERENCE) != 0) {
+ if (can(capabilities, MERGE_CONFERENCE)) {
builder.append(" MERGE_CONFERENCE");
}
- if ((capabilities & SWAP_CONFERENCE) != 0) {
+ if (can(capabilities, SWAP_CONFERENCE)) {
builder.append(" SWAP_CONFERENCE");
}
- if ((capabilities & ADD_CALL) != 0) {
+ if (can(capabilities, ADD_CALL)) {
builder.append(" ADD_CALL");
}
- if ((capabilities & RESPOND_VIA_TEXT) != 0) {
+ if (can(capabilities, RESPOND_VIA_TEXT)) {
builder.append(" RESPOND_VIA_TEXT");
}
- if ((capabilities & MUTE) != 0) {
+ if (can(capabilities, MUTE)) {
builder.append(" MUTE");
}
- if ((capabilities & MANAGE_CONFERENCE) != 0) {
+ if (can(capabilities, MANAGE_CONFERENCE)) {
builder.append(" MANAGE_CONFERENCE");
}
- if ((capabilities & SUPPORTS_VT_LOCAL) != 0) {
+ if (can(capabilities, SUPPORTS_VT_LOCAL)) {
builder.append(" SUPPORTS_VT_LOCAL");
}
- if ((capabilities & SUPPORTS_VT_REMOTE) != 0) {
+ if (can(capabilities, SUPPORTS_VT_REMOTE)) {
builder.append(" SUPPORTS_VT_REMOTE");
}
- if ((capabilities & VoLTE) != 0) {
+ if (can(capabilities, VoLTE)) {
builder.append(" VoLTE");
}
- if ((capabilities & VoWIFI) != 0) {
+ if (can(capabilities, VoWIFI)) {
builder.append(" VoWIFI");
}
builder.append("]");