blob: 77701457484a3eaec5a8825a5a48279ad3f9ead8 [file] [log] [blame]
Santos Cordon8f3fd302014-01-27 08:46:21 -08001/*
2 * Copyright (C) 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 Gunnef9f6f92014-09-12 22:16:17 -070017package android.telecom;
Santos Cordon8f3fd302014-01-27 08:46:21 -080018
Ravi Palurif4b38e72020-02-05 12:35:41 +053019import android.annotation.NonNull;
Hall Liua98f58b52017-11-07 17:59:28 -080020import android.bluetooth.BluetoothDevice;
Hall Liu6dfa2492019-10-01 17:20:39 -070021import android.net.Uri;
Junhoedf3d822022-11-24 09:26:37 +000022import android.os.Binder;
Tyler Gunn876dbfb2016-03-14 15:18:07 -070023import android.os.Bundle;
Junhoedf3d822022-11-24 09:26:37 +000024import android.os.OutcomeReceiver;
Sailesh Nepalab5d2822014-03-08 18:01:06 -080025import android.os.RemoteException;
Junhoedf3d822022-11-24 09:26:37 +000026import android.os.ResultReceiver;
Sailesh Nepalab5d2822014-03-08 18:01:06 -080027
Tyler Gunnef9f6f92014-09-12 22:16:17 -070028import com.android.internal.telecom.IInCallAdapter;
Sailesh Nepalab5d2822014-03-08 18:01:06 -080029
Tyler Gunndee56a82016-03-23 16:06:34 -070030import java.util.List;
Junhoedf3d822022-11-24 09:26:37 +000031import java.util.concurrent.Executor;
Tyler Gunndee56a82016-03-23 16:06:34 -070032
Santos Cordon8f3fd302014-01-27 08:46:21 -080033/**
Sailesh Nepalab5d2822014-03-08 18:01:06 -080034 * Receives commands from {@link InCallService} implementations which should be executed by
Tyler Gunnef9f6f92014-09-12 22:16:17 -070035 * Telecom. When Telecom binds to a {@link InCallService}, an instance of this class is given to
Santos Cordon8f3fd302014-01-27 08:46:21 -080036 * the in-call service through which it can manipulate live (active, dialing, ringing) calls. When
Ihab Awade63fadb2014-07-09 21:52:04 -070037 * the in-call service is notified of new calls, it can use the
Santos Cordon8f3fd302014-01-27 08:46:21 -080038 * given call IDs to execute commands such as {@link #answerCall} for incoming calls or
39 * {@link #disconnectCall} for active calls the user would like to end. Some commands are only
40 * appropriate for calls in certain states; please consult each method for such limitations.
Ihab Awadb19a0bc2014-08-07 19:46:01 -070041 * <p>
42 * The adapter will stop functioning when there are no more calls.
43 *
Hall Liu95d55872017-01-25 17:12:49 -080044 * @hide
Santos Cordon8f3fd302014-01-27 08:46:21 -080045 */
Sailesh Nepalab5d2822014-03-08 18:01:06 -080046public final class InCallAdapter {
47 private final IInCallAdapter mAdapter;
48
49 /**
50 * {@hide}
51 */
52 public InCallAdapter(IInCallAdapter adapter) {
53 mAdapter = adapter;
54 }
55
Santos Cordon8f3fd302014-01-27 08:46:21 -080056 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -070057 * Instructs Telecom to answer the specified call.
Santos Cordon8f3fd302014-01-27 08:46:21 -080058 *
59 * @param callId The identifier of the call to answer.
Andrew Lee8da4c3c2014-07-16 10:11:42 -070060 * @param videoState The video state in which to answer the call.
Santos Cordon8f3fd302014-01-27 08:46:21 -080061 */
Andrew Lee8da4c3c2014-07-16 10:11:42 -070062 public void answerCall(String callId, int videoState) {
Sailesh Nepalab5d2822014-03-08 18:01:06 -080063 try {
Andrew Lee8da4c3c2014-07-16 10:11:42 -070064 mAdapter.answerCall(callId, videoState);
Sailesh Nepalab5d2822014-03-08 18:01:06 -080065 } catch (RemoteException e) {
66 }
67 }
Santos Cordon8f3fd302014-01-27 08:46:21 -080068
69 /**
Pooja Jaind34698d2017-12-28 14:15:31 +053070 * Instructs Telecom to deflect the specified call.
71 *
72 * @param callId The identifier of the call to deflect.
73 * @param address The address to deflect.
74 */
75 public void deflectCall(String callId, Uri address) {
76 try {
77 mAdapter.deflectCall(callId, address);
78 } catch (RemoteException e) {
79 }
80 }
81
82 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -070083 * Instructs Telecom to reject the specified call.
Santos Cordon8f3fd302014-01-27 08:46:21 -080084 *
85 * @param callId The identifier of the call to reject.
Ihab Awadc0677542014-06-10 13:29:47 -070086 * @param rejectWithMessage Whether to reject with a text message.
87 * @param textMessage An optional text message with which to respond.
Santos Cordon8f3fd302014-01-27 08:46:21 -080088 */
Ihab Awadc0677542014-06-10 13:29:47 -070089 public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) {
Sailesh Nepalab5d2822014-03-08 18:01:06 -080090 try {
Ihab Awadc0677542014-06-10 13:29:47 -070091 mAdapter.rejectCall(callId, rejectWithMessage, textMessage);
Sailesh Nepalab5d2822014-03-08 18:01:06 -080092 } catch (RemoteException e) {
93 }
94 }
Santos Cordon8f3fd302014-01-27 08:46:21 -080095
96 /**
Tyler Gunnfacfdee2020-01-23 13:10:37 -080097 * Instructs Telecom to reject the specified call.
98 *
99 * @param callId The identifier of the call to reject.
100 * @param rejectReason The reason the call was rejected.
101 */
102 public void rejectCall(String callId, @Call.RejectReason int rejectReason) {
103 try {
104 mAdapter.rejectCallWithReason(callId, rejectReason);
105 } catch (RemoteException e) {
106 }
107 }
108
109 /**
Ravi Palurif4b38e72020-02-05 12:35:41 +0530110 * Instructs Telecom to transfer the specified call.
111 *
112 * @param callId The identifier of the call to transfer.
113 * @param targetNumber The address to transfer to.
Tyler Gunn460360d2020-07-29 10:21:45 -0700114 * @param isConfirmationRequired if {@code true} it will initiate a confirmed transfer,
115 * if {@code false}, it will initiate unconfirmed transfer.
Ravi Palurif4b38e72020-02-05 12:35:41 +0530116 */
117 public void transferCall(@NonNull String callId, @NonNull Uri targetNumber,
118 boolean isConfirmationRequired) {
119 try {
120 mAdapter.transferCall(callId, targetNumber, isConfirmationRequired);
121 } catch (RemoteException e) {
122 }
123 }
124
125 /**
126 * Instructs Telecom to transfer the specified call to another ongoing call.
127 *
128 * @param callId The identifier of the call to transfer.
129 * @param otherCallId The identifier of the other call to which this will be transferred.
130 */
131 public void transferCall(@NonNull String callId, @NonNull String otherCallId) {
132 try {
133 mAdapter.consultativeTransfer(callId, otherCallId);
134 } catch (RemoteException e) {
135 }
136 }
137
138 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700139 * Instructs Telecom to disconnect the specified call.
Santos Cordon8f3fd302014-01-27 08:46:21 -0800140 *
141 * @param callId The identifier of the call to disconnect.
142 */
Sailesh Nepalab5d2822014-03-08 18:01:06 -0800143 public void disconnectCall(String callId) {
144 try {
145 mAdapter.disconnectCall(callId);
146 } catch (RemoteException e) {
147 }
148 }
Yorke Lee81ccaaa2014-03-12 18:33:19 -0700149
150 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700151 * Instructs Telecom to put the specified call on hold.
Yorke Lee81ccaaa2014-03-12 18:33:19 -0700152 *
153 * @param callId The identifier of the call to put on hold.
154 */
155 public void holdCall(String callId) {
156 try {
157 mAdapter.holdCall(callId);
158 } catch (RemoteException e) {
159 }
160 }
161
162 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700163 * Instructs Telecom to release the specified call from hold.
Yorke Lee81ccaaa2014-03-12 18:33:19 -0700164 *
165 * @param callId The identifier of the call to release from hold.
166 */
167 public void unholdCall(String callId) {
168 try {
169 mAdapter.unholdCall(callId);
170 } catch (RemoteException e) {
171 }
172 }
Sailesh Nepal4cff3922014-03-19 10:15:37 -0700173
174 /**
175 * Mute the microphone.
176 *
177 * @param shouldMute True if the microphone should be muted.
178 */
179 public void mute(boolean shouldMute) {
180 try {
181 mAdapter.mute(shouldMute);
182 } catch (RemoteException e) {
183 }
184 }
185
186 /**
Yorke Lee4af59352015-05-13 14:14:54 -0700187 * Sets the audio route (speaker, bluetooth, etc...). See {@link CallAudioState}.
Sailesh Nepal4cff3922014-03-19 10:15:37 -0700188 *
189 * @param route The audio route to use.
190 */
191 public void setAudioRoute(int route) {
192 try {
Hall Liua98f58b52017-11-07 17:59:28 -0800193 mAdapter.setAudioRoute(route, null);
194 } catch (RemoteException e) {
195 }
196 }
197
198 /**
Hall Liu6dfa2492019-10-01 17:20:39 -0700199 * @see Call#enterBackgroundAudioProcessing()
200 */
201 public void enterBackgroundAudioProcessing(String callId) {
202 try {
203 mAdapter.enterBackgroundAudioProcessing(callId);
204 } catch (RemoteException e) {
205 }
206 }
207
208 /**
209 * @see Call#exitBackgroundAudioProcessing(boolean)
210 */
211 public void exitBackgroundAudioProcessing(String callId, boolean shouldRing) {
212 try {
213 mAdapter.exitBackgroundAudioProcessing(callId, shouldRing);
214 } catch (RemoteException e) {
215 }
216 }
217
218 /**
Hall Liua98f58b52017-11-07 17:59:28 -0800219 * Request audio routing to a specific bluetooth device. Calling this method may result in
220 * the device routing audio to a different bluetooth device than the one specified. A list of
221 * available devices can be obtained via {@link CallAudioState#getSupportedBluetoothDevices()}
222 *
223 * @param bluetoothAddress The address of the bluetooth device to connect to, as returned by
224 * {@link BluetoothDevice#getAddress()}, or {@code null} if no device is preferred.
225 */
226 public void requestBluetoothAudio(String bluetoothAddress) {
227 try {
228 mAdapter.setAudioRoute(CallAudioState.ROUTE_BLUETOOTH, bluetoothAddress);
Sailesh Nepal4cff3922014-03-19 10:15:37 -0700229 } catch (RemoteException e) {
230 }
231 }
Ihab Awad2f236642014-03-10 15:33:45 -0700232
233 /**
Junhoedf3d822022-11-24 09:26:37 +0000234 * Request audio routing to a specific CallEndpoint.. See {@link CallEndpoint}.
235 *
236 * @param endpoint The call endpoint to use.
237 * @param executor The executor of where the callback will execute.
238 * @param callback The callback to notify the result of the endpoint change.
239 */
240 public void requestCallEndpointChange(CallEndpoint endpoint, Executor executor,
241 OutcomeReceiver<Void, CallEndpointException> callback) {
242 try {
243 mAdapter.requestCallEndpointChange(endpoint, new ResultReceiver(null) {
244 @Override
245 protected void onReceiveResult(int resultCode, Bundle result) {
246 super.onReceiveResult(resultCode, result);
247 final long identity = Binder.clearCallingIdentity();
248 try {
249 if (resultCode == CallEndpoint.ENDPOINT_OPERATION_SUCCESS) {
250 executor.execute(() -> callback.onResult(null));
251 } else {
252 executor.execute(() -> callback.onError(
253 result.getParcelable(CallEndpointException.CHANGE_ERROR,
254 CallEndpointException.class)));
255 }
256 } finally {
257 Binder.restoreCallingIdentity(identity);
258 }
259 }
260 });
261 } catch (RemoteException e) {
262 Log.d(this, "Remote exception calling requestCallEndpointChange");
263 }
264 }
265
266 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700267 * Instructs Telecom to play a dual-tone multi-frequency signaling (DTMF) tone in a call.
Ihab Awad2f236642014-03-10 15:33:45 -0700268 *
269 * Any other currently playing DTMF tone in the specified call is immediately stopped.
270 *
271 * @param callId The unique ID of the call in which the tone will be played.
272 * @param digit A character representing the DTMF digit for which to play the tone. This
273 * value must be one of {@code '0'} through {@code '9'}, {@code '*'} or {@code '#'}.
274 */
275 public void playDtmfTone(String callId, char digit) {
276 try {
277 mAdapter.playDtmfTone(callId, digit);
278 } catch (RemoteException e) {
279 }
280 }
281
282 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700283 * Instructs Telecom to stop any dual-tone multi-frequency signaling (DTMF) tone currently
Ihab Awad2f236642014-03-10 15:33:45 -0700284 * playing.
285 *
286 * DTMF tones are played by calling {@link #playDtmfTone(String,char)}. If no DTMF tone is
287 * currently playing, this method will do nothing.
288 *
289 * @param callId The unique ID of the call in which any currently playing tone will be stopped.
290 */
291 public void stopDtmfTone(String callId) {
292 try {
293 mAdapter.stopDtmfTone(callId);
294 } catch (RemoteException e) {
295 }
296 }
297
298 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700299 * Instructs Telecom to continue playing a post-dial DTMF string.
Ihab Awad2f236642014-03-10 15:33:45 -0700300 *
301 * A post-dial DTMF string is a string of digits entered after a phone number, when dialed,
302 * that are immediately sent as DTMF tones to the recipient as soon as the connection is made.
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700303 * While these tones are playing, Telecom will notify the {@link InCallService} that the call
Ihab Awade63fadb2014-07-09 21:52:04 -0700304 * is in the post dial state.
Ihab Awad2f236642014-03-10 15:33:45 -0700305 *
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700306 * If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_PAUSE} symbol, Telecom
Evan Charlton8acdbb82014-04-01 13:50:07 -0700307 * will temporarily pause playing the tones for a pre-defined period of time.
Ihab Awad2f236642014-03-10 15:33:45 -0700308 *
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700309 * If the DTMF string contains a {@link TelecomManager#DTMF_CHARACTER_WAIT} symbol, Telecom
Evan Charlton8acdbb82014-04-01 13:50:07 -0700310 * will pause playing the tones and notify the {@link InCallService} that the call is in the
Ihab Awade63fadb2014-07-09 21:52:04 -0700311 * post dial wait state. When the user decides to continue the postdial sequence, the
312 * {@link InCallService} should invoke the {@link #postDialContinue(String,boolean)} method.
Ihab Awad2f236642014-03-10 15:33:45 -0700313 *
314 * @param callId The unique ID of the call for which postdial string playing should continue.
Evan Charlton6dea4ac2014-06-03 14:07:13 -0700315 * @param proceed Whether or not to continue with the post-dial sequence.
Ihab Awad2f236642014-03-10 15:33:45 -0700316 */
Evan Charlton6dea4ac2014-06-03 14:07:13 -0700317 public void postDialContinue(String callId, boolean proceed) {
Ihab Awad2f236642014-03-10 15:33:45 -0700318 try {
Evan Charlton6dea4ac2014-06-03 14:07:13 -0700319 mAdapter.postDialContinue(callId, proceed);
Ihab Awad2f236642014-03-10 15:33:45 -0700320 } catch (RemoteException e) {
321 }
322 }
Sailesh Nepalb632e5b2014-04-03 12:54:33 -0700323
324 /**
Nancy Chen36c62f32014-10-21 18:36:39 -0700325 * Instructs Telecom to add a PhoneAccountHandle to the specified call.
Nancy Chen5da0fd52014-07-08 14:16:17 -0700326 *
Nancy Chen36c62f32014-10-21 18:36:39 -0700327 * @param callId The identifier of the call.
328 * @param accountHandle The PhoneAccountHandle through which to place the call.
329 * @param setDefault {@code True} if this account should be set as the default for calls.
Nancy Chen5da0fd52014-07-08 14:16:17 -0700330 */
Nancy Chen36c62f32014-10-21 18:36:39 -0700331 public void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle,
332 boolean setDefault) {
Nancy Chen5da0fd52014-07-08 14:16:17 -0700333 try {
Nancy Chen36c62f32014-10-21 18:36:39 -0700334 mAdapter.phoneAccountSelected(callId, accountHandle, setDefault);
Nancy Chen5da0fd52014-07-08 14:16:17 -0700335 } catch (RemoteException e) {
336 }
337 }
338
339 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700340 * Instructs Telecom to conference the specified call.
Santos Cordon980acb92014-05-31 10:31:19 -0700341 *
342 * @param callId The unique ID of the call.
Santos Cordon980acb92014-05-31 10:31:19 -0700343 * @hide
344 */
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700345 public void conference(String callId, String otherCallId) {
Santos Cordon980acb92014-05-31 10:31:19 -0700346 try {
Santos Cordon7c7bc7f2014-07-28 18:15:48 -0700347 mAdapter.conference(callId, otherCallId);
Santos Cordon980acb92014-05-31 10:31:19 -0700348 } catch (RemoteException ignored) {
349 }
350 }
351
352 /**
Ravi Paluri404babb2020-01-23 19:02:44 +0530353 * Instructs Telecom to pull participants to existing call
354 *
355 * @param callId The unique ID of the call.
356 * @param participants participants to be pulled to existing call.
357 */
358 public void addConferenceParticipants(String callId, List<Uri> participants) {
359 try {
360 mAdapter.addConferenceParticipants(callId, participants);
361 } catch (RemoteException ignored) {
362 }
363 }
364
365
366 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700367 * Instructs Telecom to split the specified call from any conference call with which it may be
Santos Cordon980acb92014-05-31 10:31:19 -0700368 * connected.
369 *
370 * @param callId The unique ID of the call.
371 * @hide
372 */
Santos Cordonb6939982014-06-04 20:20:58 -0700373 public void splitFromConference(String callId) {
Santos Cordon980acb92014-05-31 10:31:19 -0700374 try {
375 mAdapter.splitFromConference(callId);
376 } catch (RemoteException ignored) {
377 }
378 }
Sailesh Nepal61203862014-07-11 14:50:13 -0700379
380 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700381 * Instructs Telecom to merge child calls of the specified conference call.
Santos Cordona4868042014-09-04 17:39:22 -0700382 */
383 public void mergeConference(String callId) {
384 try {
385 mAdapter.mergeConference(callId);
386 } catch (RemoteException ignored) {
387 }
388 }
389
390 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700391 * Instructs Telecom to swap the child calls of the specified conference call.
Santos Cordona4868042014-09-04 17:39:22 -0700392 */
393 public void swapConference(String callId) {
394 try {
395 mAdapter.swapConference(callId);
396 } catch (RemoteException ignored) {
397 }
398 }
399
400 /**
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700401 * Instructs Telecom to pull an external call to the local device.
402 *
403 * @param callId The callId to pull.
404 */
405 public void pullExternalCall(String callId) {
406 try {
407 mAdapter.pullExternalCall(callId);
408 } catch (RemoteException ignored) {
409 }
410 }
411
412 /**
413 * Intructs Telecom to send a call event.
414 *
415 * @param callId The callId to send the event for.
416 * @param event The event.
Sanket Padawef6a9e5b2018-01-05 14:26:16 -0800417 * @param targetSdkVer Target sdk version of the app calling this api
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700418 * @param extras Extras associated with the event.
419 */
Sanket Padawef6a9e5b2018-01-05 14:26:16 -0800420 public void sendCallEvent(String callId, String event, int targetSdkVer, Bundle extras) {
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700421 try {
Sanket Padawef6a9e5b2018-01-05 14:26:16 -0800422 mAdapter.sendCallEvent(callId, event, targetSdkVer, extras);
Tyler Gunn876dbfb2016-03-14 15:18:07 -0700423 } catch (RemoteException ignored) {
424 }
425 }
426
427 /**
Tyler Gunndee56a82016-03-23 16:06:34 -0700428 * Intructs Telecom to add extras to a call.
429 *
430 * @param callId The callId to add the extras to.
431 * @param extras The extras.
432 */
433 public void putExtras(String callId, Bundle extras) {
434 try {
435 mAdapter.putExtras(callId, extras);
436 } catch (RemoteException ignored) {
437 }
438 }
439
440 /**
441 * Intructs Telecom to add an extra to a call.
442 *
443 * @param callId The callId to add the extras to.
444 * @param key The extra key.
445 * @param value The extra value.
446 */
447 public void putExtra(String callId, String key, boolean value) {
448 try {
449 Bundle bundle = new Bundle();
450 bundle.putBoolean(key, value);
451 mAdapter.putExtras(callId, bundle);
452 } catch (RemoteException ignored) {
453 }
454 }
455
456 /**
457 * Intructs Telecom to add an extra to a call.
458 *
459 * @param callId The callId to add the extras to.
460 * @param key The extra key.
461 * @param value The extra value.
462 */
463 public void putExtra(String callId, String key, int value) {
464 try {
465 Bundle bundle = new Bundle();
466 bundle.putInt(key, value);
467 mAdapter.putExtras(callId, bundle);
468 } catch (RemoteException ignored) {
469 }
470 }
471
472 /**
473 * Intructs Telecom to add an extra to a call.
474 *
475 * @param callId The callId to add the extras to.
476 * @param key The extra key.
477 * @param value The extra value.
478 */
479 public void putExtra(String callId, String key, String value) {
480 try {
481 Bundle bundle = new Bundle();
482 bundle.putString(key, value);
483 mAdapter.putExtras(callId, bundle);
484 } catch (RemoteException ignored) {
485 }
486 }
487
488 /**
489 * Intructs Telecom to remove extras from a call.
490 * @param callId The callId to remove the extras from.
491 * @param keys The extra keys to remove.
492 */
493 public void removeExtras(String callId, List<String> keys) {
494 try {
495 mAdapter.removeExtras(callId, keys);
496 } catch (RemoteException ignored) {
497 }
498 }
499
500 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700501 * Instructs Telecom to turn the proximity sensor on.
Yorke Lee0d6ea712014-07-28 14:39:23 -0700502 */
503 public void turnProximitySensorOn() {
504 try {
505 mAdapter.turnOnProximitySensor();
506 } catch (RemoteException ignored) {
507 }
508 }
509
510 /**
Tyler Gunnef9f6f92014-09-12 22:16:17 -0700511 * Instructs Telecom to turn the proximity sensor off.
Yorke Lee0d6ea712014-07-28 14:39:23 -0700512 *
513 * @param screenOnImmediately If true, the screen will be turned on immediately if it was
514 * previously off. Otherwise, the screen will only be turned on after the proximity sensor
515 * is no longer triggered.
516 */
517 public void turnProximitySensorOff(boolean screenOnImmediately) {
518 try {
519 mAdapter.turnOffProximitySensor(screenOnImmediately);
520 } catch (RemoteException ignored) {
521 }
522 }
Hall Liu95d55872017-01-25 17:12:49 -0800523
524 /**
525 * Sends an RTT upgrade request to the remote end of the connection.
526 */
Hall Liu57006aa2017-02-06 10:49:48 -0800527 public void sendRttRequest(String callId) {
Hall Liu95d55872017-01-25 17:12:49 -0800528 try {
Hall Liu57006aa2017-02-06 10:49:48 -0800529 mAdapter.sendRttRequest(callId);
Hall Liu95d55872017-01-25 17:12:49 -0800530 } catch (RemoteException ignored) {
531 }
532 }
533
534 /**
535 * Responds to an RTT upgrade request initiated from the remote end.
536 *
537 * @param id the ID of the request as specified by Telecom
538 * @param accept Whether the request should be accepted.
539 */
Hall Liu57006aa2017-02-06 10:49:48 -0800540 public void respondToRttRequest(String callId, int id, boolean accept) {
Hall Liu95d55872017-01-25 17:12:49 -0800541 try {
Hall Liu57006aa2017-02-06 10:49:48 -0800542 mAdapter.respondToRttRequest(callId, id, accept);
Hall Liu95d55872017-01-25 17:12:49 -0800543 } catch (RemoteException ignored) {
544 }
545 }
546
547 /**
548 * Instructs Telecom to shut down the RTT communication channel.
549 */
Hall Liu57006aa2017-02-06 10:49:48 -0800550 public void stopRtt(String callId) {
Hall Liu95d55872017-01-25 17:12:49 -0800551 try {
Hall Liu57006aa2017-02-06 10:49:48 -0800552 mAdapter.stopRtt(callId);
Hall Liu95d55872017-01-25 17:12:49 -0800553 } catch (RemoteException ignored) {
554 }
555 }
556
557 /**
558 * Sets the RTT audio mode.
559 * @param mode the desired RTT audio mode
560 */
Hall Liu57006aa2017-02-06 10:49:48 -0800561 public void setRttMode(String callId, int mode) {
Hall Liu95d55872017-01-25 17:12:49 -0800562 try {
Hall Liu57006aa2017-02-06 10:49:48 -0800563 mAdapter.setRttMode(callId, mode);
Hall Liu95d55872017-01-25 17:12:49 -0800564 } catch (RemoteException ignored) {
565 }
566 }
Sanket Padawea8eddd42017-11-03 11:07:35 -0700567
568
569 /**
570 * Initiates a handover of this {@link Call} to the {@link ConnectionService} identified
571 * by destAcct.
572 * @param callId The callId of the Call which calls this function.
573 * @param destAcct ConnectionService to which the call should be handed over.
574 * @param videoState The video state desired after the handover.
575 * @param extras Extra information to be passed to ConnectionService
576 */
577 public void handoverTo(String callId, PhoneAccountHandle destAcct, int videoState,
578 Bundle extras) {
579 try {
580 mAdapter.handoverTo(callId, destAcct, videoState, extras);
581 } catch (RemoteException ignored) {
582 }
583 }
Santos Cordon8f3fd302014-01-27 08:46:21 -0800584}