| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013 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 | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 18 | |
| Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 19 | import android.annotation.SdkConstant; |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 20 | import android.annotation.SystemApi; |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 21 | import android.app.Service; |
| 22 | import android.content.Intent; |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 23 | import android.hardware.camera2.CameraManager; |
| Yorke Lee | 32f2473 | 2015-05-12 16:18:03 -0700 | [diff] [blame] | 24 | import android.net.Uri; |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 25 | import android.os.Handler; |
| 26 | import android.os.IBinder; |
| 27 | import android.os.Looper; |
| 28 | import android.os.Message; |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 29 | import android.view.Surface; |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 30 | |
| Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 31 | import com.android.internal.os.SomeArgs; |
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 32 | import com.android.internal.telecom.IInCallAdapter; |
| 33 | import com.android.internal.telecom.IInCallService; |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 34 | |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 35 | import java.lang.String; |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 36 | import java.util.Collections; |
| 37 | import java.util.List; |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 38 | |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 39 | /** |
| 40 | * This service is implemented by any app that wishes to provide the user-interface for managing |
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 41 | * phone calls. Telecom binds to this service while there exists a live (active or incoming) call, |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 42 | * and uses it to notify the in-call app of any live and and recently disconnected calls. |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 43 | */ |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 44 | public abstract class InCallService extends Service { |
| Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
| 47 | * The {@link Intent} that must be declared as handled by the service. |
| 48 | */ |
| 49 | @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) |
| Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 50 | public static final String SERVICE_INTERFACE = "android.telecom.InCallService"; |
| Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 51 | |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 52 | private static final int MSG_SET_IN_CALL_ADAPTER = 1; |
| 53 | private static final int MSG_ADD_CALL = 2; |
| Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 54 | private static final int MSG_UPDATE_CALL = 3; |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 55 | private static final int MSG_SET_POST_DIAL_WAIT = 4; |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 56 | private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 5; |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 57 | private static final int MSG_BRING_TO_FOREGROUND = 6; |
| Santos Cordon | 6c912b7 | 2014-11-07 16:05:09 -0800 | [diff] [blame] | 58 | private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7; |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 59 | |
| 60 | /** Default Handler used to consolidate binder method calls onto a single thread. */ |
| 61 | private final Handler mHandler = new Handler(Looper.getMainLooper()) { |
| 62 | @Override |
| 63 | public void handleMessage(Message msg) { |
| Jay Shrauner | 5e6162d | 2014-09-22 20:47:45 -0700 | [diff] [blame] | 64 | if (mPhone == null && msg.what != MSG_SET_IN_CALL_ADAPTER) { |
| 65 | return; |
| 66 | } |
| 67 | |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 68 | switch (msg.what) { |
| 69 | case MSG_SET_IN_CALL_ADAPTER: |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 70 | mPhone = new Phone(new InCallAdapter((IInCallAdapter) msg.obj)); |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 71 | mPhone.addListener(mPhoneListener); |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 72 | onPhoneCreated(mPhone); |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 73 | break; |
| 74 | case MSG_ADD_CALL: |
| Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 75 | mPhone.internalAddCall((ParcelableCall) msg.obj); |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 76 | break; |
| Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 77 | case MSG_UPDATE_CALL: |
| Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 78 | mPhone.internalUpdateCall((ParcelableCall) msg.obj); |
| Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 79 | break; |
| Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 80 | case MSG_SET_POST_DIAL_WAIT: { |
| 81 | SomeArgs args = (SomeArgs) msg.obj; |
| 82 | try { |
| 83 | String callId = (String) args.arg1; |
| 84 | String remaining = (String) args.arg2; |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 85 | mPhone.internalSetPostDialWait(callId, remaining); |
| Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 86 | } finally { |
| 87 | args.recycle(); |
| 88 | } |
| 89 | break; |
| 90 | } |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 91 | case MSG_ON_CALL_AUDIO_STATE_CHANGED: |
| 92 | mPhone.internalCallAudioStateChanged((CallAudioState) msg.obj); |
| Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 93 | break; |
| Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 94 | case MSG_BRING_TO_FOREGROUND: |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 95 | mPhone.internalBringToForeground(msg.arg1 == 1); |
| Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 96 | break; |
| Santos Cordon | 6c912b7 | 2014-11-07 16:05:09 -0800 | [diff] [blame] | 97 | case MSG_ON_CAN_ADD_CALL_CHANGED: |
| 98 | mPhone.internalSetCanAddCall(msg.arg1 == 1); |
| 99 | break; |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 100 | default: |
| 101 | break; |
| 102 | } |
| 103 | } |
| 104 | }; |
| 105 | |
| 106 | /** Manages the binder calls so that the implementor does not need to deal with it. */ |
| 107 | private final class InCallServiceBinder extends IInCallService.Stub { |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 108 | @Override |
| 109 | public void setInCallAdapter(IInCallAdapter inCallAdapter) { |
| 110 | mHandler.obtainMessage(MSG_SET_IN_CALL_ADAPTER, inCallAdapter).sendToTarget(); |
| 111 | } |
| 112 | |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 113 | @Override |
| Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 114 | public void addCall(ParcelableCall call) { |
| Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 115 | mHandler.obtainMessage(MSG_ADD_CALL, call).sendToTarget(); |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 116 | } |
| 117 | |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 118 | @Override |
| Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 119 | public void updateCall(ParcelableCall call) { |
| Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 120 | mHandler.obtainMessage(MSG_UPDATE_CALL, call).sendToTarget(); |
| Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 121 | } |
| 122 | |
| 123 | @Override |
| 124 | public void setPostDial(String callId, String remaining) { |
| Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 125 | // TODO: Unused |
| Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | @Override |
| 129 | public void setPostDialWait(String callId, String remaining) { |
| 130 | SomeArgs args = SomeArgs.obtain(); |
| 131 | args.arg1 = callId; |
| 132 | args.arg2 = remaining; |
| 133 | mHandler.obtainMessage(MSG_SET_POST_DIAL_WAIT, args).sendToTarget(); |
| 134 | } |
| Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 135 | |
| 136 | @Override |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 137 | public void onCallAudioStateChanged(CallAudioState callAudioState) { |
| 138 | mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, callAudioState).sendToTarget(); |
| Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 139 | } |
| Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 140 | |
| Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 141 | @Override |
| 142 | public void bringToForeground(boolean showDialpad) { |
| 143 | mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget(); |
| 144 | } |
| Santos Cordon | 6c912b7 | 2014-11-07 16:05:09 -0800 | [diff] [blame] | 145 | |
| 146 | @Override |
| 147 | public void onCanAddCallChanged(boolean canAddCall) { |
| 148 | mHandler.obtainMessage(MSG_ON_CAN_ADD_CALL_CHANGED, canAddCall ? 1 : 0, 0) |
| 149 | .sendToTarget(); |
| 150 | } |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 151 | } |
| 152 | |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 153 | private Phone.Listener mPhoneListener = new Phone.Listener() { |
| 154 | /** ${inheritDoc} */ |
| 155 | @Override |
| 156 | public void onAudioStateChanged(Phone phone, AudioState audioState) { |
| 157 | InCallService.this.onAudioStateChanged(audioState); |
| 158 | } |
| 159 | |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 160 | public void onCallAudioStateChanged(Phone phone, CallAudioState callAudioState) { |
| 161 | InCallService.this.onCallAudioStateChanged(callAudioState); |
| 162 | }; |
| 163 | |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 164 | /** ${inheritDoc} */ |
| 165 | @Override |
| 166 | public void onBringToForeground(Phone phone, boolean showDialpad) { |
| 167 | InCallService.this.onBringToForeground(showDialpad); |
| 168 | } |
| 169 | |
| 170 | /** ${inheritDoc} */ |
| 171 | @Override |
| 172 | public void onCallAdded(Phone phone, Call call) { |
| 173 | InCallService.this.onCallAdded(call); |
| 174 | } |
| 175 | |
| 176 | /** ${inheritDoc} */ |
| 177 | @Override |
| 178 | public void onCallRemoved(Phone phone, Call call) { |
| 179 | InCallService.this.onCallRemoved(call); |
| 180 | } |
| 181 | |
| 182 | /** ${inheritDoc} */ |
| 183 | @Override |
| 184 | public void onCanAddCallChanged(Phone phone, boolean canAddCall) { |
| 185 | InCallService.this.onCanAddCallChanged(canAddCall); |
| 186 | } |
| 187 | |
| 188 | }; |
| 189 | |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 190 | private Phone mPhone; |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 191 | |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 192 | public InCallService() { |
| 193 | } |
| Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 194 | |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 195 | @Override |
| 196 | public IBinder onBind(Intent intent) { |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 197 | return new InCallServiceBinder(); |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 198 | } |
| 199 | |
| Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 200 | @Override |
| 201 | public boolean onUnbind(Intent intent) { |
| Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 202 | if (mPhone != null) { |
| 203 | Phone oldPhone = mPhone; |
| 204 | mPhone = null; |
| Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 205 | |
| Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 206 | oldPhone.destroy(); |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 207 | // destroy sets all the calls to disconnected if any live ones still exist. Therefore, |
| 208 | // it is important to remove the Listener *after* the call to destroy so that |
| 209 | // InCallService.on* callbacks are appropriately called. |
| 210 | oldPhone.removeListener(mPhoneListener); |
| 211 | |
| Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 212 | onPhoneDestroyed(oldPhone); |
| 213 | } |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 214 | |
| Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 215 | return false; |
| 216 | } |
| 217 | |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 218 | /** |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 219 | * Obtain the {@code Phone} associated with this {@code InCallService}. |
| 220 | * |
| 221 | * @return The {@code Phone} object associated with this {@code InCallService}, or {@code null} |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 222 | * if the {@code InCallService} is not in a state where it has an associated |
| 223 | * {@code Phone}. |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 224 | * @hide |
| Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 225 | * @deprecated Use direct methods on InCallService instead of {@link Phone}. |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 226 | */ |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 227 | @SystemApi |
| Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 228 | @Deprecated |
| 229 | public Phone getPhone() { |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 230 | return mPhone; |
| Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 231 | } |
| 232 | |
| 233 | /** |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 234 | * Obtains the current list of {@code Call}s to be displayed by this in-call experience. |
| 235 | * |
| 236 | * @return A list of the relevant {@code Call}s. |
| 237 | */ |
| 238 | public final List<Call> getCalls() { |
| 239 | return mPhone == null ? Collections.<Call>emptyList() : mPhone.getCalls(); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Returns if the device can support additional calls. |
| 244 | * |
| 245 | * @return Whether the phone supports adding more calls. |
| 246 | */ |
| 247 | public final boolean canAddCall() { |
| 248 | return mPhone == null ? false : mPhone.canAddCall(); |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Obtains the current phone call audio state. |
| 253 | * |
| 254 | * @return An object encapsulating the audio state. Returns null if the service is not |
| 255 | * fully initialized. |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 256 | * @deprecated Use {@link #getCallAudioState()} instead. |
| 257 | * @hide |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 258 | */ |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 259 | @Deprecated |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 260 | public final AudioState getAudioState() { |
| 261 | return mPhone == null ? null : mPhone.getAudioState(); |
| 262 | } |
| 263 | |
| 264 | /** |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 265 | * Obtains the current phone call audio state. |
| 266 | * |
| 267 | * @return An object encapsulating the audio state. Returns null if the service is not |
| 268 | * fully initialized. |
| 269 | */ |
| 270 | public final CallAudioState getCallAudioState() { |
| 271 | return mPhone == null ? null : mPhone.getCallAudioState(); |
| 272 | } |
| 273 | |
| 274 | /** |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 275 | * Sets the microphone mute state. When this request is honored, there will be change to |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 276 | * the {@link #getCallAudioState()}. |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 277 | * |
| 278 | * @param state {@code true} if the microphone should be muted; {@code false} otherwise. |
| 279 | */ |
| 280 | public final void setMuted(boolean state) { |
| 281 | if (mPhone != null) { |
| 282 | mPhone.setMuted(state); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 288 | * be change to the {@link #getCallAudioState()}. |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 289 | * |
| 290 | * @param route The audio route to use. |
| 291 | */ |
| 292 | public final void setAudioRoute(int route) { |
| 293 | if (mPhone != null) { |
| 294 | mPhone.setAudioRoute(route); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | /** |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 299 | * Invoked when the {@code Phone} has been created. This is a signal to the in-call experience |
| 300 | * to start displaying in-call information to the user. Each instance of {@code InCallService} |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 301 | * will have only one {@code Phone}, and this method will be called exactly once in the lifetime |
| 302 | * of the {@code InCallService}. |
| Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 303 | * |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 304 | * @param phone The {@code Phone} object associated with this {@code InCallService}. |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 305 | * @hide |
| Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 306 | * @deprecated Use direct methods on InCallService instead of {@link Phone}. |
| Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 307 | */ |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 308 | @SystemApi |
| Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 309 | @Deprecated |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 310 | public void onPhoneCreated(Phone phone) { |
| 311 | } |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 312 | |
| 313 | /** |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 314 | * Invoked when a {@code Phone} has been destroyed. This is a signal to the in-call experience |
| 315 | * to stop displaying in-call information to the user. This method will be called exactly once |
| 316 | * in the lifetime of the {@code InCallService}, and it will always be called after a previous |
| 317 | * call to {@link #onPhoneCreated(Phone)}. |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 318 | * |
| Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 319 | * @param phone The {@code Phone} object associated with this {@code InCallService}. |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 320 | * @hide |
| Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 321 | * @deprecated Use direct methods on InCallService instead of {@link Phone}. |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 322 | */ |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 323 | @SystemApi |
| Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 324 | @Deprecated |
| Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 325 | public void onPhoneDestroyed(Phone phone) { |
| 326 | } |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 327 | |
| 328 | /** |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 329 | * Called when the audio state changes. |
| 330 | * |
| 331 | * @param audioState The new {@link AudioState}. |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 332 | * @deprecated Use {@link #onCallAudioStateChanged(CallAudioState) instead}. |
| 333 | * @hide |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 334 | */ |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 335 | @Deprecated |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 336 | public void onAudioStateChanged(AudioState audioState) { |
| 337 | } |
| 338 | |
| 339 | /** |
| Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 340 | * Called when the audio state changes. |
| 341 | * |
| 342 | * @param audioState The new {@link CallAudioState}. |
| 343 | */ |
| 344 | public void onCallAudioStateChanged(CallAudioState audioState) { |
| 345 | } |
| 346 | |
| 347 | /** |
| Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 348 | * Called to bring the in-call screen to the foreground. The in-call experience should |
| 349 | * respond immediately by coming to the foreground to inform the user of the state of |
| 350 | * ongoing {@code Call}s. |
| 351 | * |
| 352 | * @param showDialpad If true, put up the dialpad when the screen is shown. |
| 353 | */ |
| 354 | public void onBringToForeground(boolean showDialpad) { |
| 355 | } |
| 356 | |
| 357 | /** |
| 358 | * Called when a {@code Call} has been added to this in-call session. The in-call user |
| 359 | * experience should add necessary state listeners to the specified {@code Call} and |
| 360 | * immediately start to show the user information about the existence |
| 361 | * and nature of this {@code Call}. Subsequent invocations of {@link #getCalls()} will |
| 362 | * include this {@code Call}. |
| 363 | * |
| 364 | * @param call A newly added {@code Call}. |
| 365 | */ |
| 366 | public void onCallAdded(Call call) { |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * Called when a {@code Call} has been removed from this in-call session. The in-call user |
| 371 | * experience should remove any state listeners from the specified {@code Call} and |
| 372 | * immediately stop displaying any information about this {@code Call}. |
| 373 | * Subsequent invocations of {@link #getCalls()} will no longer include this {@code Call}. |
| 374 | * |
| 375 | * @param call A newly removed {@code Call}. |
| 376 | */ |
| 377 | public void onCallRemoved(Call call) { |
| 378 | } |
| 379 | |
| 380 | /** |
| 381 | * Called when the ability to add more calls changes. If the phone cannot |
| 382 | * support more calls then {@code canAddCall} is set to {@code false}. If it can, then it |
| 383 | * is set to {@code true}. This can be used to control the visibility of UI to add more calls. |
| 384 | * |
| 385 | * @param canAddCall Indicates whether an additional call can be added. |
| 386 | */ |
| 387 | public void onCanAddCallChanged(boolean canAddCall) { |
| 388 | } |
| 389 | |
| 390 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 391 | * Used to issue commands to the {@link Connection.VideoProvider} associated with a |
| 392 | * {@link Call}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 393 | */ |
| 394 | public static abstract class VideoCall { |
| 395 | |
| Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 396 | /** @hide */ |
| 397 | public abstract void destroy(); |
| 398 | |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 399 | /** |
| Andrew Lee | 7c9ee2b | 2015-04-16 15:26:08 -0700 | [diff] [blame] | 400 | * Registers a callback to receive commands and state changes for video calls. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 401 | * |
| Andrew Lee | 7c9ee2b | 2015-04-16 15:26:08 -0700 | [diff] [blame] | 402 | * @param callback The video call callback. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 403 | */ |
| Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 404 | public abstract void registerCallback(VideoCall.Callback callback); |
| 405 | |
| 406 | /** |
| Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 407 | * Registers a callback to receive commands and state changes for video calls. |
| 408 | * |
| 409 | * @param callback The video call callback. |
| 410 | * @param handler A handler which commands and status changes will be delivered to. |
| 411 | */ |
| 412 | public abstract void registerCallback(VideoCall.Callback callback, Handler handler); |
| 413 | |
| 414 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 415 | * Clears the video call callback set via {@link #registerCallback}. |
| Tyler Gunn | 295f5d7 | 2015-06-04 11:08:54 -0700 | [diff] [blame] | 416 | * |
| 417 | * @param callback The video call callback to clear. |
| Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 418 | */ |
| Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 419 | public abstract void unregisterCallback(VideoCall.Callback callback); |
| Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 420 | |
| 421 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 422 | * Sets the camera to be used for the outgoing video. |
| 423 | * <p> |
| 424 | * Handled by {@link Connection.VideoProvider#onSetCamera(String)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 425 | * |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 426 | * @param cameraId The id of the camera (use ids as reported by |
| 427 | * {@link CameraManager#getCameraIdList()}). |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 428 | */ |
| 429 | public abstract void setCamera(String cameraId); |
| 430 | |
| 431 | /** |
| 432 | * Sets the surface to be used for displaying a preview of what the user's camera is |
| 433 | * currently capturing. When video transmission is enabled, this is the video signal which |
| 434 | * is sent to the remote device. |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 435 | * <p> |
| 436 | * Handled by {@link Connection.VideoProvider#onSetPreviewSurface(Surface)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 437 | * |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 438 | * @param surface The {@link Surface}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 439 | */ |
| 440 | public abstract void setPreviewSurface(Surface surface); |
| 441 | |
| 442 | /** |
| 443 | * Sets the surface to be used for displaying the video received from the remote device. |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 444 | * <p> |
| 445 | * Handled by {@link Connection.VideoProvider#onSetDisplaySurface(Surface)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 446 | * |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 447 | * @param surface The {@link Surface}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 448 | */ |
| 449 | public abstract void setDisplaySurface(Surface surface); |
| 450 | |
| 451 | /** |
| 452 | * Sets the device orientation, in degrees. Assumes that a standard portrait orientation of |
| 453 | * the device is 0 degrees. |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 454 | * <p> |
| 455 | * Handled by {@link Connection.VideoProvider#onSetDeviceOrientation(int)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 456 | * |
| 457 | * @param rotation The device orientation, in degrees. |
| 458 | */ |
| 459 | public abstract void setDeviceOrientation(int rotation); |
| 460 | |
| 461 | /** |
| 462 | * Sets camera zoom ratio. |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 463 | * <p> |
| 464 | * Handled by {@link Connection.VideoProvider#onSetZoom(float)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 465 | * |
| 466 | * @param value The camera zoom ratio. |
| 467 | */ |
| 468 | public abstract void setZoom(float value); |
| 469 | |
| 470 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 471 | * Issues a request to modify the properties of the current video session. |
| 472 | * <p> |
| 473 | * Example scenarios include: requesting an audio-only call to be upgraded to a |
| 474 | * bi-directional video call, turning on or off the user's camera, sending a pause signal |
| 475 | * when the {@link InCallService} is no longer the foreground application. |
| 476 | * <p> |
| 477 | * Handled by |
| 478 | * {@link Connection.VideoProvider#onSendSessionModifyRequest(VideoProfile, VideoProfile)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 479 | * |
| 480 | * @param requestProfile The requested call video properties. |
| 481 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 482 | public abstract void sendSessionModifyRequest(VideoProfile requestProfile); |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 483 | |
| 484 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 485 | * Provides a response to a request to change the current call video session |
| 486 | * properties. This should be called in response to a request the {@link InCallService} has |
| 487 | * received via {@link VideoCall.Callback#onSessionModifyRequestReceived}. |
| 488 | * <p> |
| 489 | * Handled by |
| 490 | * {@link Connection.VideoProvider#onSendSessionModifyResponse(VideoProfile)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 491 | * |
| 492 | * @param responseProfile The response call video properties. |
| 493 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 494 | public abstract void sendSessionModifyResponse(VideoProfile responseProfile); |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 495 | |
| 496 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 497 | * Issues a request to the {@link Connection.VideoProvider} to retrieve the capabilities |
| 498 | * of the current camera. The current camera is selected using |
| 499 | * {@link VideoCall#setCamera(String)}. |
| 500 | * <p> |
| 501 | * Camera capabilities are reported to the caller via |
| 502 | * {@link VideoCall.Callback#onCameraCapabilitiesChanged(VideoProfile.CameraCapabilities)}. |
| 503 | * <p> |
| 504 | * Handled by {@link Connection.VideoProvider#onRequestCameraCapabilities()}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 505 | */ |
| 506 | public abstract void requestCameraCapabilities(); |
| 507 | |
| 508 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 509 | * Issues a request to the {@link Connection.VideoProvider} to retrieve the cumulative data |
| 510 | * usage for the video component of the current call (in bytes). Data usage is reported |
| 511 | * to the caller via {@link VideoCall.Callback#onCallDataUsageChanged}. |
| 512 | * <p> |
| 513 | * Handled by {@link Connection.VideoProvider#onRequestConnectionDataUsage()}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 514 | */ |
| 515 | public abstract void requestCallDataUsage(); |
| 516 | |
| 517 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 518 | * Provides the {@link Connection.VideoProvider} with the {@link Uri} of an image to be |
| 519 | * displayed to the peer device when the video signal is paused. |
| 520 | * <p> |
| 521 | * Handled by {@link Connection.VideoProvider#onSetPauseImage(Uri)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 522 | * |
| 523 | * @param uri URI of image to display. |
| 524 | */ |
| Yorke Lee | 32f2473 | 2015-05-12 16:18:03 -0700 | [diff] [blame] | 525 | public abstract void setPauseImage(Uri uri); |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 526 | |
| 527 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 528 | * The {@link InCallService} extends this class to provide a means of receiving callbacks |
| Tyler Gunn | 295f5d7 | 2015-06-04 11:08:54 -0700 | [diff] [blame] | 529 | * from the {@link Connection.VideoProvider}. |
| 530 | * <p> |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 531 | * When the {@link InCallService} receives the |
| 532 | * {@link Call.Callback#onVideoCallChanged(Call, VideoCall)} callback, it should create an |
| 533 | * instance its {@link VideoCall.Callback} implementation and set it on the |
| 534 | * {@link VideoCall} using {@link VideoCall#registerCallback(Callback)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 535 | */ |
| Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 536 | public static abstract class Callback { |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 537 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 538 | * Called when the {@link Connection.VideoProvider} receives a session modification |
| Tyler Gunn | 295f5d7 | 2015-06-04 11:08:54 -0700 | [diff] [blame] | 539 | * request from the peer device. |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 540 | * <p> |
| 541 | * The {@link InCallService} may potentially prompt the user to confirm whether they |
| 542 | * wish to accept the request, or decide to automatically accept the request. In either |
| 543 | * case the {@link InCallService} should call |
| 544 | * {@link VideoCall#sendSessionModifyResponse(VideoProfile)} to indicate the video |
| 545 | * profile agreed upon. |
| 546 | * <p> |
| 547 | * Callback originates from |
| 548 | * {@link Connection.VideoProvider#receiveSessionModifyRequest(VideoProfile)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 549 | * |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 550 | * @param videoProfile The requested video profile. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 551 | */ |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 552 | public abstract void onSessionModifyRequestReceived(VideoProfile videoProfile); |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 553 | |
| 554 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 555 | * Called when the {@link Connection.VideoProvider} receives a response to a session |
| 556 | * modification request previously sent to the peer device. |
| 557 | * <p> |
| 558 | * The new video state should not be considered active by the {@link InCallService} |
| 559 | * until the {@link Call} video state changes (the |
| 560 | * {@link Call.Callback#onDetailsChanged(Call, Call.Details)} callback is triggered |
| 561 | * when the video state changes). |
| 562 | * <p> |
| 563 | * Callback originates from |
| 564 | * {@link Connection.VideoProvider#receiveSessionModifyResponse(int, VideoProfile, |
| 565 | * VideoProfile)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 566 | * |
| 567 | * @param status Status of the session modify request. Valid values are |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 568 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, |
| 569 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, |
| 570 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID}, |
| 571 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT}, |
| 572 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE}. |
| 573 | * @param requestedProfile The original request which was sent to the peer device. |
| 574 | * @param responseProfile The actual profile changes made by the peer device. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 575 | */ |
| 576 | public abstract void onSessionModifyResponseReceived(int status, |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 577 | VideoProfile requestedProfile, VideoProfile responseProfile); |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 578 | |
| 579 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 580 | * Handles events related to the current video session which the {@link InCallService} |
| 581 | * may wish to handle. These are separate from requested changes to the session due to |
| 582 | * the underlying protocol or connection. |
| 583 | * <p> |
| 584 | * Callback originates from |
| 585 | * {@link Connection.VideoProvider#handleCallSessionEvent(int)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 586 | * |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 587 | * @param event The event. Valid values are: |
| 588 | * {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE}, |
| 589 | * {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME}, |
| 590 | * {@link Connection.VideoProvider#SESSION_EVENT_TX_START}, |
| 591 | * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP}, |
| 592 | * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE}, |
| 593 | * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 594 | */ |
| 595 | public abstract void onCallSessionEvent(int event); |
| 596 | |
| 597 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 598 | * Handles a change to the video dimensions from the peer device. This could happen if, |
| 599 | * for example, the peer changes orientation of their device, or switches cameras. |
| 600 | * <p> |
| 601 | * Callback originates from |
| 602 | * {@link Connection.VideoProvider#changePeerDimensions(int, int)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 603 | * |
| 604 | * @param width The updated peer video width. |
| 605 | * @param height The updated peer video height. |
| 606 | */ |
| 607 | public abstract void onPeerDimensionsChanged(int width, int height); |
| 608 | |
| 609 | /** |
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 610 | * Handles a change to the video quality. |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 611 | * <p> |
| 612 | * Callback originates from {@link Connection.VideoProvider#changeVideoQuality(int)}. |
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 613 | * |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 614 | * @param videoQuality The updated peer video quality. Valid values: |
| 615 | * {@link VideoProfile#QUALITY_HIGH}, |
| 616 | * {@link VideoProfile#QUALITY_MEDIUM}, |
| 617 | * {@link VideoProfile#QUALITY_LOW}, |
| 618 | * {@link VideoProfile#QUALITY_DEFAULT}. |
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 619 | */ |
| 620 | public abstract void onVideoQualityChanged(int videoQuality); |
| 621 | |
| 622 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 623 | * Handles an update to the total data used for the current video session. |
| 624 | * <p> |
| 625 | * Used by the {@link Connection.VideoProvider} in response to |
| 626 | * {@link VideoCall#requestCallDataUsage()}. May also be called periodically by the |
| 627 | * {@link Connection.VideoProvider}. |
| 628 | * <p> |
| 629 | * Callback originates from {@link Connection.VideoProvider#setCallDataUsage(long)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 630 | * |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 631 | * @param dataUsage The updated data usage (in bytes). |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 632 | */ |
| Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 633 | public abstract void onCallDataUsageChanged(long dataUsage); |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 634 | |
| 635 | /** |
| Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 636 | * Handles a change in the capabilities of the currently selected camera. |
| 637 | * <p> |
| 638 | * Used by the {@link Connection.VideoProvider} in response to |
| 639 | * {@link VideoCall#requestCameraCapabilities()}. The {@link Connection.VideoProvider} |
| 640 | * may also report the camera capabilities after a call to |
| 641 | * {@link VideoCall#setCamera(String)}. |
| 642 | * <p> |
| 643 | * Callback originates from |
| 644 | * {@link Connection.VideoProvider#changeCameraCapabilities( |
| 645 | * VideoProfile.CameraCapabilities)}. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 646 | * |
| Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 647 | * @param cameraCapabilities The changed camera capabilities. |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 648 | */ |
| Yorke Lee | 400470f | 2015-05-12 13:31:25 -0700 | [diff] [blame] | 649 | public abstract void onCameraCapabilitiesChanged( |
| 650 | VideoProfile.CameraCapabilities cameraCapabilities); |
| Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 651 | } |
| 652 | } |
| Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 653 | } |