diff options
Diffstat (limited to 'telecomm/java/android/telecom/PhoneCapabilities.java')
-rw-r--r-- | telecomm/java/android/telecom/PhoneCapabilities.java | 77 |
1 files changed, 51 insertions, 26 deletions
diff --git a/telecomm/java/android/telecom/PhoneCapabilities.java b/telecomm/java/android/telecom/PhoneCapabilities.java index de2abcb..3d3c6bd 100644 --- a/telecomm/java/android/telecom/PhoneCapabilities.java +++ b/telecomm/java/android/telecom/PhoneCapabilities.java @@ -16,14 +16,10 @@ package android.telecom; -import android.annotation.SystemApi; - /** - * Defines capabilities a phone call can support, such as conference calling and video telephony. - * Also defines properties of a phone call, such as whether it is using VoLTE technology. - * @hide + * Defines capabilities for {@link Connection}s and {@link Conference}s such as hold, swap, and + * merge. */ -@SystemApi public final class PhoneCapabilities { /** Call can currently be put on hold or unheld. */ public static final int HOLD = 0x00000001; @@ -32,15 +28,22 @@ public final class PhoneCapabilities { public static final int SUPPORT_HOLD = 0x00000002; /** - * Calls within a conference can be merged. Some connection services create a conference call - * only after two calls have been merged. However, a conference call can also be added the - * moment there are more than one call. CDMA calls are implemented in this way because the call - * actions are more limited when more than one call exists. This flag allows merge to be exposed - * as a capability on the conference call instead of individual calls. + * Calls within a conference can be merged. A {@link ConnectionService} has the option to + * add a {@link Conference} call before the child {@link Connection}s are merged. This is how + * CDMA-based {@link Connection}s are implemented. For these unmerged {@link Conference}s, this + * capability allows a merge button to be shown while the conference call is in the foreground + * of the in-call UI. + * <p> + * This is only intended for use by a {@link Conference}. */ public static final int MERGE_CONFERENCE = 0x00000004; - /** Calls withing a conference can be swapped between foreground and background. */ + /** + * Calls within a conference can be swapped between foreground and background. + * See {@link #MERGE_CONFERENCE} for additional information. + * <p> + * This is only intended for use by a {@link Conference}. + */ public static final int SWAP_CONFERENCE = 0x00000008; /** Call currently supports adding another call to this one. */ @@ -53,8 +56,8 @@ public final class PhoneCapabilities { public static final int MUTE = 0x00000040; /** - * Call supports conference call management. This capability only applies to conference calls - * which can have other calls as children. + * Call supports conference call management. This capability only applies to {@link Conference} + * calls which can have {@link Connection}s as children. */ public static final int MANAGE_CONFERENCE = 0x00000080; @@ -96,43 +99,65 @@ 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; + } + + /** + * Removes the specified capability from the set of capabilities and returns the new set. + * @param capabilities The set of capabilities. + * @param capability The capability to remove from the set. + * @return The set of capabilities, with the capability removed. + * @hide + */ + public static int remove(int capabilities, int capability) { + return capabilities & ~capability; + } + 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("]"); |