| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014, The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 18 | |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 19 | /** |
| 20 | * Defines capabilities a phone call can support, such as conference calling and video telephony. |
| 21 | * Also defines properties of a phone call, such as whether it is using VoLTE technology. |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 22 | */ |
| 23 | public final class PhoneCapabilities { |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 24 | /** Call can currently be put on hold or unheld. */ |
| 25 | public static final int HOLD = 0x00000001; |
| 26 | |
| 27 | /** Call supports the hold feature. */ |
| 28 | public static final int SUPPORT_HOLD = 0x00000002; |
| 29 | |
| Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 30 | /** |
| 31 | * Calls within a conference can be merged. Some connection services create a conference call |
| 32 | * only after two calls have been merged. However, a conference call can also be added the |
| 33 | * moment there are more than one call. CDMA calls are implemented in this way because the call |
| 34 | * actions are more limited when more than one call exists. This flag allows merge to be exposed |
| 35 | * as a capability on the conference call instead of individual calls. |
| 36 | */ |
| 37 | public static final int MERGE_CONFERENCE = 0x00000004; |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 38 | |
| Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 39 | /** Calls withing a conference can be swapped between foreground and background. */ |
| 40 | public static final int SWAP_CONFERENCE = 0x00000008; |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 41 | |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 42 | /** Call currently supports adding another call to this one. */ |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 43 | public static final int ADD_CALL = 0x00000010; |
| 44 | |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 45 | /** Call supports responding via text option. */ |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 46 | public static final int RESPOND_VIA_TEXT = 0x00000020; |
| 47 | |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 48 | /** Call can be muted. */ |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 49 | public static final int MUTE = 0x00000040; |
| 50 | |
| Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 51 | /** |
| 52 | * Call supports conference call management. This capability only applies to conference calls |
| 53 | * which can have other calls as children. |
| 54 | */ |
| 55 | public static final int MANAGE_CONFERENCE = 0x00000080; |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 56 | |
| Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 57 | /** |
| 58 | * Local device supports video telephony. |
| 59 | * @hide |
| 60 | */ |
| Tyler Gunn | 2db72ad | 2014-07-10 14:34:51 -0700 | [diff] [blame] | 61 | public static final int SUPPORTS_VT_LOCAL = 0x00000100; |
| 62 | |
| Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 63 | /** |
| 64 | * Remote device supports video telephony. |
| 65 | * @hide |
| 66 | */ |
| Tyler Gunn | 2db72ad | 2014-07-10 14:34:51 -0700 | [diff] [blame] | 67 | public static final int SUPPORTS_VT_REMOTE = 0x00000200; |
| 68 | |
| Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 69 | /** |
| 70 | * Call is using voice over LTE. |
| 71 | * @hide |
| 72 | */ |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 73 | public static final int VoLTE = 0x00000400; |
| 74 | |
| Tyler Gunn | be74de0 | 2014-08-29 14:51:48 -0700 | [diff] [blame] | 75 | /** |
| 76 | * Call is using voice over WIFI. |
| 77 | * @hide |
| 78 | */ |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 79 | public static final int VoWIFI = 0x00000800; |
| 80 | |
| Ihab Awad | 2ef34be | 2014-09-11 08:49:02 -0700 | [diff] [blame] | 81 | /** |
| 82 | * Call is able to be separated from its parent {@code Conference}, if any. |
| 83 | */ |
| 84 | public static final int SEPARATE_FROM_CONFERENCE = 0x00001000; |
| 85 | |
| 86 | /** |
| 87 | * Call is able to be individually disconnected when in a {@code Conference}. |
| 88 | */ |
| 89 | public static final int DISCONNECT_FROM_CONFERENCE = 0x00002000; |
| 90 | |
| 91 | public static final int ALL = HOLD | SUPPORT_HOLD | MERGE_CONFERENCE | SWAP_CONFERENCE |
| 92 | | ADD_CALL | RESPOND_VIA_TEXT | MUTE | MANAGE_CONFERENCE | SEPARATE_FROM_CONFERENCE |
| 93 | | DISCONNECT_FROM_CONFERENCE; |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 94 | |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 95 | /** |
| 96 | * Whether this set of capabilities supports the specified capability. |
| 97 | * @param capabilities The set of capabilities. |
| 98 | * @param capability The capability to check capabilities for. |
| 99 | * @return Whether the specified capability is supported. |
| 100 | * @hide |
| 101 | */ |
| 102 | public static boolean can(int capabilities, int capability) { |
| 103 | return (capabilities & capability) != 0; |
| 104 | } |
| 105 | |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 106 | public static String toString(int capabilities) { |
| 107 | StringBuilder builder = new StringBuilder(); |
| 108 | builder.append("[Capabilities:"); |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 109 | if (can(capabilities, HOLD)) { |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 110 | builder.append(" HOLD"); |
| 111 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 112 | if (can(capabilities, SUPPORT_HOLD)) { |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 113 | builder.append(" SUPPORT_HOLD"); |
| 114 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 115 | if (can(capabilities, MERGE_CONFERENCE)) { |
| Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 116 | builder.append(" MERGE_CONFERENCE"); |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 117 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 118 | if (can(capabilities, SWAP_CONFERENCE)) { |
| Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 119 | builder.append(" SWAP_CONFERENCE"); |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 120 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 121 | if (can(capabilities, ADD_CALL)) { |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 122 | builder.append(" ADD_CALL"); |
| 123 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 124 | if (can(capabilities, RESPOND_VIA_TEXT)) { |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 125 | builder.append(" RESPOND_VIA_TEXT"); |
| 126 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 127 | if (can(capabilities, MUTE)) { |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 128 | builder.append(" MUTE"); |
| 129 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 130 | if (can(capabilities, MANAGE_CONFERENCE)) { |
| Santos Cordon | a486804 | 2014-09-04 17:39:22 -0700 | [diff] [blame] | 131 | builder.append(" MANAGE_CONFERENCE"); |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 132 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 133 | if (can(capabilities, SUPPORTS_VT_LOCAL)) { |
| Tyler Gunn | 2db72ad | 2014-07-10 14:34:51 -0700 | [diff] [blame] | 134 | builder.append(" SUPPORTS_VT_LOCAL"); |
| 135 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 136 | if (can(capabilities, SUPPORTS_VT_REMOTE)) { |
| Tyler Gunn | 2db72ad | 2014-07-10 14:34:51 -0700 | [diff] [blame] | 137 | builder.append(" SUPPORTS_VT_REMOTE"); |
| 138 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 139 | if (can(capabilities, VoLTE)) { |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 140 | builder.append(" VoLTE"); |
| 141 | } |
| Andrew Lee | 52d6573 | 2014-10-14 16:55:26 -0700 | [diff] [blame^] | 142 | if (can(capabilities, VoWIFI)) { |
| Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 143 | builder.append(" VoWIFI"); |
| 144 | } |
| Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 145 | builder.append("]"); |
| 146 | return builder.toString(); |
| 147 | } |
| 148 | |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 149 | private PhoneCapabilities() {} |
| Sailesh Nepal | f6e9b27 | 2014-04-01 14:23:09 -0700 | [diff] [blame] | 150 | } |