1 /* 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 17 package com.android.server.telecom; 18 19 import android.net.Uri; 20 import android.os.Binder; 21 import android.os.Bundle; 22 import android.os.ResultReceiver; 23 import android.os.UserHandle; 24 import android.telecom.CallEndpoint; 25 import android.telecom.Log; 26 import android.telecom.PhoneAccountHandle; 27 28 import com.android.internal.telecom.IInCallAdapter; 29 30 import java.util.List; 31 32 /** 33 * Receives call commands and updates from in-call app and passes them through to CallsManager. 34 * {@link InCallController} creates an instance of this class and passes it to the in-call app after 35 * binding to it. This adapter can receive commands and updates until the in-call app is unbound. 36 */ 37 class InCallAdapter extends IInCallAdapter.Stub { 38 private final CallsManager mCallsManager; 39 private final CallIdMapper mCallIdMapper; 40 private final TelecomSystem.SyncRoot mLock; 41 private final String mOwnerPackageName; 42 private final String mOwnerPackageAbbreviation; 43 44 /** Persists the specified parameters. */ InCallAdapter(CallsManager callsManager, CallIdMapper callIdMapper, TelecomSystem.SyncRoot lock, String ownerPackageName)45 public InCallAdapter(CallsManager callsManager, CallIdMapper callIdMapper, 46 TelecomSystem.SyncRoot lock, String ownerPackageName) { 47 mCallsManager = callsManager; 48 mCallIdMapper = callIdMapper; 49 mLock = lock; 50 mOwnerPackageName = ownerPackageName; 51 mOwnerPackageAbbreviation = Log.getPackageAbbreviation(ownerPackageName); 52 } 53 54 @Override answerCall(String callId, int videoState)55 public void answerCall(String callId, int videoState) { 56 try { 57 Log.startSession(LogUtils.Sessions.ICA_ANSWER_CALL, mOwnerPackageAbbreviation); 58 long token = Binder.clearCallingIdentity(); 59 try { 60 synchronized (mLock) { 61 Log.d(this, "answerCall(%s,%d)", callId, videoState); 62 Call call = mCallIdMapper.getCall(callId); 63 if (call != null) { 64 mCallsManager.answerCall(call, videoState); 65 } else { 66 Log.w(this, "answerCall, unknown call id: %s", callId); 67 } 68 } 69 } finally { 70 Binder.restoreCallingIdentity(token); 71 } 72 } finally { 73 Log.endSession(); 74 } 75 } 76 77 @Override deflectCall(String callId, Uri address)78 public void deflectCall(String callId, Uri address) { 79 try { 80 Log.startSession(LogUtils.Sessions.ICA_DEFLECT_CALL, mOwnerPackageAbbreviation); 81 long token = Binder.clearCallingIdentity(); 82 try { 83 synchronized (mLock) { 84 Log.i(this, "deflectCall - %s, %s ", callId, Log.pii(address)); 85 Call call = mCallIdMapper.getCall(callId); 86 if (call != null) { 87 mCallsManager.deflectCall(call, address); 88 } else { 89 Log.w(this, "deflectCall, unknown call id: %s", callId); 90 } 91 } 92 } finally { 93 Binder.restoreCallingIdentity(token); 94 } 95 } finally { 96 Log.endSession(); 97 } 98 } 99 100 @Override rejectCall(String callId, boolean rejectWithMessage, String textMessage)101 public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) { 102 try { 103 Log.startSession(LogUtils.Sessions.ICA_REJECT_CALL, mOwnerPackageAbbreviation); 104 105 int callingUid = Binder.getCallingUid(); 106 long token = Binder.clearCallingIdentity(); 107 try { 108 synchronized (mLock) { 109 // Check to make sure the in-call app's user isn't restricted from sending SMS. 110 // If so, silently drop the outgoing message. Also drop message if the screen is 111 // locked. 112 if (!mCallsManager.isReplyWithSmsAllowed(callingUid)) { 113 rejectWithMessage = false; 114 textMessage = null; 115 } 116 117 Log.d(this, "rejectCall(%s,%b,%s)", callId, rejectWithMessage, textMessage); 118 Call call = mCallIdMapper.getCall(callId); 119 if (call != null) { 120 mCallsManager.rejectCall(call, rejectWithMessage, textMessage); 121 } else { 122 Log.w(this, "setRingback, unknown call id: %s", callId); 123 } 124 } 125 } finally { 126 Binder.restoreCallingIdentity(token); 127 } 128 } finally { 129 Log.endSession(); 130 } 131 } 132 133 @Override rejectCallWithReason(String callId, @android.telecom.Call.RejectReason int rejectReason)134 public void rejectCallWithReason(String callId, 135 @android.telecom.Call.RejectReason int rejectReason) { 136 try { 137 Log.startSession(LogUtils.Sessions.ICA_REJECT_CALL, mOwnerPackageAbbreviation); 138 139 int callingUid = Binder.getCallingUid(); 140 long token = Binder.clearCallingIdentity(); 141 try { 142 synchronized (mLock) { 143 Log.d(this, "rejectCallWithReason(%s,%d)", callId, rejectReason); 144 Call call = mCallIdMapper.getCall(callId); 145 if (call != null) { 146 mCallsManager.rejectCall(call, rejectReason); 147 } else { 148 Log.w(this, "rejectCallWithReason, unknown call id: %s", callId); 149 } 150 } 151 } finally { 152 Binder.restoreCallingIdentity(token); 153 } 154 } finally { 155 Log.endSession(); 156 } 157 } 158 transferCall(String callId, Uri targetNumber, boolean isConfirmationRequired)159 public void transferCall(String callId, Uri targetNumber, boolean isConfirmationRequired) { 160 try { 161 Log.startSession(LogUtils.Sessions.ICA_TRANSFER_CALL, mOwnerPackageAbbreviation); 162 long token = Binder.clearCallingIdentity(); 163 try { 164 synchronized (mLock) { 165 Log.i(this, "transferCall - %s, %s, %b", callId, Log.pii(targetNumber), 166 isConfirmationRequired); 167 Call call = mCallIdMapper.getCall(callId); 168 if (call != null) { 169 mCallsManager.transferCall(call, targetNumber, isConfirmationRequired); 170 } else { 171 Log.w(this, "transferCall, unknown call id: %s", callId); 172 } 173 } 174 } finally { 175 Binder.restoreCallingIdentity(token); 176 } 177 } finally { 178 Log.endSession(); 179 } 180 } 181 182 @Override consultativeTransfer(String callId, String otherCallId)183 public void consultativeTransfer(String callId, String otherCallId) { 184 try { 185 Log.startSession(LogUtils.Sessions.ICA_CONSULTATIVE_TRANSFER, 186 mOwnerPackageAbbreviation); 187 long token = Binder.clearCallingIdentity(); 188 try { 189 synchronized (mLock) { 190 Log.i(this, "consultativeTransfer - %s, %s", callId, otherCallId); 191 Call call = mCallIdMapper.getCall(callId); 192 Call otherCall = mCallIdMapper.getCall(otherCallId); 193 if (call != null && otherCall != null) { 194 mCallsManager.transferCall(call, otherCall); 195 } else { 196 Log.w(this, "consultativeTransfer, unknown call id: %s or %s", 197 callId, otherCallId); 198 } 199 } 200 } finally { 201 Binder.restoreCallingIdentity(token); 202 } 203 } finally { 204 Log.endSession(); 205 } 206 } 207 208 @Override playDtmfTone(String callId, char digit)209 public void playDtmfTone(String callId, char digit) { 210 try { 211 Log.startSession("ICA.pDT", mOwnerPackageAbbreviation); 212 long token = Binder.clearCallingIdentity(); 213 try { 214 synchronized (mLock) { 215 Log.d(this, "playDtmfTone(%s,%c)", callId, digit); 216 Call call = mCallIdMapper.getCall(callId); 217 if (call != null) { 218 mCallsManager.playDtmfTone(call, digit); 219 } else { 220 Log.w(this, "playDtmfTone, unknown call id: %s", callId); 221 } 222 } 223 } finally { 224 Binder.restoreCallingIdentity(token); 225 } 226 } finally { 227 Log.endSession(); 228 } 229 } 230 231 @Override stopDtmfTone(String callId)232 public void stopDtmfTone(String callId) { 233 try { 234 Log.startSession("ICA.sDT", mOwnerPackageAbbreviation); 235 long token = Binder.clearCallingIdentity(); 236 try { 237 synchronized (mLock) { 238 Log.d(this, "stopDtmfTone(%s)", callId); 239 Call call = mCallIdMapper.getCall(callId); 240 if (call != null) { 241 mCallsManager.stopDtmfTone(call); 242 } else { 243 Log.w(this, "stopDtmfTone, unknown call id: %s", callId); 244 } 245 } 246 } finally { 247 Binder.restoreCallingIdentity(token); 248 } 249 } finally { 250 Log.endSession(); 251 } 252 } 253 254 @Override postDialContinue(String callId, boolean proceed)255 public void postDialContinue(String callId, boolean proceed) { 256 try { 257 Log.startSession("ICA.pDC", mOwnerPackageAbbreviation); 258 long token = Binder.clearCallingIdentity(); 259 try { 260 synchronized (mLock) { 261 Log.d(this, "postDialContinue(%s)", callId); 262 Call call = mCallIdMapper.getCall(callId); 263 if (call != null) { 264 mCallsManager.postDialContinue(call, proceed); 265 } else { 266 Log.w(this, "postDialContinue, unknown call id: %s", callId); 267 } 268 } 269 } finally { 270 Binder.restoreCallingIdentity(token); 271 } 272 } finally { 273 Log.endSession(); 274 } 275 } 276 277 @Override disconnectCall(String callId)278 public void disconnectCall(String callId) { 279 try { 280 Log.startSession(LogUtils.Sessions.ICA_DISCONNECT_CALL, mOwnerPackageAbbreviation); 281 long token = Binder.clearCallingIdentity(); 282 try { 283 synchronized (mLock) { 284 Log.v(this, "disconnectCall: %s", callId); 285 Call call = mCallIdMapper.getCall(callId); 286 if (call != null) { 287 mCallsManager.disconnectCall(call); 288 } else { 289 Log.w(this, "disconnectCall, unknown call id: %s", callId); 290 } 291 } 292 } finally { 293 Binder.restoreCallingIdentity(token); 294 } 295 } finally { 296 Log.endSession(); 297 } 298 } 299 300 @Override holdCall(String callId)301 public void holdCall(String callId) { 302 try { 303 Log.startSession(LogUtils.Sessions.ICA_HOLD_CALL, mOwnerPackageAbbreviation); 304 long token = Binder.clearCallingIdentity(); 305 try { 306 synchronized (mLock) { 307 Call call = mCallIdMapper.getCall(callId); 308 if (call != null) { 309 mCallsManager.holdCall(call); 310 } else { 311 Log.w(this, "holdCall, unknown call id: %s", callId); 312 } 313 } 314 } finally { 315 Binder.restoreCallingIdentity(token); 316 } 317 } finally { 318 Log.endSession(); 319 } 320 } 321 322 @Override unholdCall(String callId)323 public void unholdCall(String callId) { 324 try { 325 Log.startSession(LogUtils.Sessions.ICA_UNHOLD_CALL, mOwnerPackageAbbreviation); 326 long token = Binder.clearCallingIdentity(); 327 try { 328 synchronized (mLock) { 329 Call call = mCallIdMapper.getCall(callId); 330 if (call != null) { 331 mCallsManager.unholdCall(call); 332 } else { 333 Log.w(this, "unholdCall, unknown call id: %s", callId); 334 } 335 } 336 } finally { 337 Binder.restoreCallingIdentity(token); 338 } 339 } finally { 340 Log.endSession(); 341 } 342 } 343 344 @Override phoneAccountSelected(String callId, PhoneAccountHandle accountHandle, boolean setDefault)345 public void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle, 346 boolean setDefault) { 347 try { 348 Log.startSession("ICA.pAS", mOwnerPackageAbbreviation); 349 long token = Binder.clearCallingIdentity(); 350 try { 351 synchronized (mLock) { 352 Call call = mCallIdMapper.getCall(callId); 353 if (call != null) { 354 mCallsManager.phoneAccountSelected(call, accountHandle, setDefault); 355 } else { 356 Log.w(this, "phoneAccountSelected, unknown call id: %s", callId); 357 } 358 } 359 } finally { 360 Binder.restoreCallingIdentity(token); 361 } 362 } finally { 363 Log.endSession(); 364 } 365 } 366 367 @Override mute(boolean shouldMute)368 public void mute(boolean shouldMute) { 369 try { 370 Log.startSession(LogUtils.Sessions.ICA_MUTE, mOwnerPackageAbbreviation); 371 long token = Binder.clearCallingIdentity(); 372 try { 373 synchronized (mLock) { 374 mCallsManager.mute(shouldMute); 375 } 376 } finally { 377 Binder.restoreCallingIdentity(token); 378 } 379 } finally { 380 Log.endSession(); 381 } 382 } 383 384 @Override setAudioRoute(int route, String bluetoothAddress)385 public void setAudioRoute(int route, String bluetoothAddress) { 386 try { 387 Log.startSession(LogUtils.Sessions.ICA_SET_AUDIO_ROUTE, mOwnerPackageAbbreviation); 388 long token = Binder.clearCallingIdentity(); 389 try { 390 synchronized (mLock) { 391 mCallsManager.setAudioRoute(route, bluetoothAddress); 392 } 393 } finally { 394 Binder.restoreCallingIdentity(token); 395 } 396 } finally { 397 Log.endSession(); 398 } 399 } 400 401 @Override requestCallEndpointChange(CallEndpoint endpoint, ResultReceiver callback)402 public void requestCallEndpointChange(CallEndpoint endpoint, ResultReceiver callback) { 403 try { 404 Log.startSession(LogUtils.Sessions.ICA_SET_AUDIO_ROUTE, mOwnerPackageAbbreviation); 405 long token = Binder.clearCallingIdentity(); 406 try { 407 synchronized (mLock) { 408 mCallsManager.requestCallEndpointChange(endpoint, callback); 409 } 410 } finally { 411 Binder.restoreCallingIdentity(token); 412 } 413 } finally { 414 Log.endSession(); 415 } 416 } 417 418 @Override enterBackgroundAudioProcessing(String callId)419 public void enterBackgroundAudioProcessing(String callId) { 420 try { 421 Log.startSession(LogUtils.Sessions.ICA_ENTER_AUDIO_PROCESSING, 422 mOwnerPackageAbbreviation); 423 // TODO: enforce the extra permission. 424 long token = Binder.clearCallingIdentity(); 425 try { 426 synchronized (mLock) { 427 Call call = mCallIdMapper.getCall(callId); 428 if (call != null) { 429 mCallsManager.enterBackgroundAudioProcessing(call, mOwnerPackageName); 430 } else { 431 Log.w(this, "enterBackgroundAudioProcessing, unknown call id: %s", callId); 432 } 433 } 434 } finally { 435 Binder.restoreCallingIdentity(token); 436 } 437 } finally { 438 Log.endSession(); 439 } 440 } 441 442 @Override exitBackgroundAudioProcessing(String callId, boolean shouldRing)443 public void exitBackgroundAudioProcessing(String callId, boolean shouldRing) { 444 try { 445 Log.startSession(LogUtils.Sessions.ICA_EXIT_AUDIO_PROCESSING, 446 mOwnerPackageAbbreviation); 447 long token = Binder.clearCallingIdentity(); 448 try { 449 synchronized (mLock) { 450 Call call = mCallIdMapper.getCall(callId); 451 if (call != null) { 452 mCallsManager.exitBackgroundAudioProcessing(call, shouldRing); 453 } else { 454 Log.w(InCallAdapter.this, 455 "exitBackgroundAudioProcessing, unknown call id: %s", callId); 456 } 457 } 458 } finally { 459 Binder.restoreCallingIdentity(token); 460 } 461 } finally { 462 Log.endSession(); 463 } 464 } 465 466 @Override conference(String callId, String otherCallId)467 public void conference(String callId, String otherCallId) { 468 try { 469 Log.startSession(LogUtils.Sessions.ICA_CONFERENCE, mOwnerPackageAbbreviation); 470 long token = Binder.clearCallingIdentity(); 471 try { 472 synchronized (mLock) { 473 Call call = mCallIdMapper.getCall(callId); 474 Call otherCall = mCallIdMapper.getCall(otherCallId); 475 if (call != null && otherCall != null) { 476 mCallsManager.conference(call, otherCall); 477 } else { 478 Log.w(this, "conference, unknown call id: %s or %s", callId, otherCallId); 479 } 480 } 481 } finally { 482 Binder.restoreCallingIdentity(token); 483 } 484 } finally { 485 Log.endSession(); 486 } 487 } 488 489 @Override splitFromConference(String callId)490 public void splitFromConference(String callId) { 491 try { 492 Log.startSession("ICA.sFC", mOwnerPackageAbbreviation); 493 long token = Binder.clearCallingIdentity(); 494 try { 495 synchronized (mLock) { 496 Call call = mCallIdMapper.getCall(callId); 497 if (call != null) { 498 call.splitFromConference(); 499 } else { 500 Log.w(this, "splitFromConference, unknown call id: %s", callId); 501 } 502 } 503 } finally { 504 Binder.restoreCallingIdentity(token); 505 } 506 } finally { 507 Log.endSession(); 508 } 509 } 510 511 @Override mergeConference(String callId)512 public void mergeConference(String callId) { 513 try { 514 Log.startSession("ICA.mC", mOwnerPackageAbbreviation); 515 long token = Binder.clearCallingIdentity(); 516 try { 517 synchronized (mLock) { 518 Call call = mCallIdMapper.getCall(callId); 519 if (call != null) { 520 call.mergeConference(); 521 } else { 522 Log.w(this, "mergeConference, unknown call id: %s", callId); 523 } 524 } 525 } finally { 526 Binder.restoreCallingIdentity(token); 527 } 528 } finally { 529 Log.endSession(); 530 } 531 } 532 533 @Override swapConference(String callId)534 public void swapConference(String callId) { 535 try { 536 Log.startSession("ICA.sC", mOwnerPackageAbbreviation); 537 long token = Binder.clearCallingIdentity(); 538 try { 539 synchronized (mLock) { 540 Call call = mCallIdMapper.getCall(callId); 541 if (call != null) { 542 call.swapConference(); 543 } else { 544 Log.w(this, "swapConference, unknown call id: %s", callId); 545 } 546 } 547 } finally { 548 Binder.restoreCallingIdentity(token); 549 } 550 } finally { 551 Log.endSession(); 552 } 553 } 554 555 @Override addConferenceParticipants(String callId, List<Uri> participants)556 public void addConferenceParticipants(String callId, List<Uri> participants) { 557 try { 558 Log.startSession("ICA.aCP", mOwnerPackageAbbreviation); 559 long token = Binder.clearCallingIdentity(); 560 try { 561 synchronized (mLock) { 562 Call call = mCallIdMapper.getCall(callId); 563 if (call != null) { 564 call.addConferenceParticipants(participants); 565 } else { 566 Log.w(this, "addConferenceParticipants, unknown call id: %s", callId); 567 } 568 } 569 } finally { 570 Binder.restoreCallingIdentity(token); 571 } 572 } finally { 573 Log.endSession(); 574 } 575 } 576 577 578 @Override pullExternalCall(String callId)579 public void pullExternalCall(String callId) { 580 try { 581 Log.startSession("ICA.pEC", mOwnerPackageAbbreviation); 582 long token = Binder.clearCallingIdentity(); 583 try { 584 synchronized (mLock) { 585 Call call = mCallIdMapper.getCall(callId); 586 if (call != null) { 587 call.pullExternalCall(); 588 } else { 589 Log.w(this, "pullExternalCall, unknown call id: %s", callId); 590 } 591 } 592 } finally { 593 Binder.restoreCallingIdentity(token); 594 } 595 } finally { 596 Log.endSession(); 597 } 598 } 599 600 @Override sendCallEvent(String callId, String event, int targetSdkVer, Bundle extras)601 public void sendCallEvent(String callId, String event, int targetSdkVer, Bundle extras) { 602 try { 603 Log.startSession("ICA.sCE", mOwnerPackageAbbreviation); 604 long token = Binder.clearCallingIdentity(); 605 try { 606 synchronized (mLock) { 607 Call call = mCallIdMapper.getCall(callId); 608 if (call != null) { 609 call.sendCallEvent(event, targetSdkVer, extras); 610 } else { 611 Log.w(this, "sendCallEvent, unknown call id: %s", callId); 612 } 613 } 614 } finally { 615 Binder.restoreCallingIdentity(token); 616 } 617 } finally { 618 Log.endSession(); 619 } 620 } 621 622 @Override putExtras(String callId, Bundle extras)623 public void putExtras(String callId, Bundle extras) { 624 try { 625 Log.startSession("ICA.pE", mOwnerPackageAbbreviation); 626 long token = Binder.clearCallingIdentity(); 627 try { 628 synchronized (mLock) { 629 Call call = mCallIdMapper.getCall(callId); 630 if (call != null) { 631 // Make sure to identify the ICS that originated the extras change so that 632 // InCallController can propagate these out to other ICSes. 633 call.putInCallServiceExtras(extras, mOwnerPackageName); 634 } else { 635 Log.w(this, "putExtras, unknown call id: %s", callId); 636 } 637 } 638 } finally { 639 Binder.restoreCallingIdentity(token); 640 } 641 } finally { 642 Log.endSession(); 643 } 644 } 645 646 @Override removeExtras(String callId, List<String> keys)647 public void removeExtras(String callId, List<String> keys) { 648 try { 649 Log.startSession("ICA.rE", mOwnerPackageAbbreviation); 650 long token = Binder.clearCallingIdentity(); 651 try { 652 synchronized (mLock) { 653 Call call = mCallIdMapper.getCall(callId); 654 if (call != null) { 655 call.removeExtras(Call.SOURCE_INCALL_SERVICE, keys); 656 } else { 657 Log.w(this, "removeExtra, unknown call id: %s", callId); 658 } 659 } 660 } finally { 661 Binder.restoreCallingIdentity(token); 662 } 663 } finally { 664 Log.endSession(); 665 } 666 } 667 668 @Override turnOnProximitySensor()669 public void turnOnProximitySensor() { 670 try { 671 Log.startSession("ICA.tOnPS", mOwnerPackageAbbreviation); 672 long token = Binder.clearCallingIdentity(); 673 try { 674 synchronized (mLock) { 675 mCallsManager.turnOnProximitySensor(); 676 } 677 } finally { 678 Binder.restoreCallingIdentity(token); 679 } 680 } finally { 681 Log.endSession(); 682 } 683 } 684 685 @Override turnOffProximitySensor(boolean screenOnImmediately)686 public void turnOffProximitySensor(boolean screenOnImmediately) { 687 try { 688 Log.startSession("ICA.tOffPS", mOwnerPackageAbbreviation); 689 long token = Binder.clearCallingIdentity(); 690 try { 691 synchronized (mLock) { 692 mCallsManager.turnOffProximitySensor(screenOnImmediately); 693 } 694 } finally { 695 Binder.restoreCallingIdentity(token); 696 } 697 } finally { 698 Log.endSession(); 699 } 700 } 701 702 @Override sendRttRequest(String callId)703 public void sendRttRequest(String callId) { 704 try { 705 Log.startSession("ICA.sRR", mOwnerPackageAbbreviation); 706 long token = Binder.clearCallingIdentity(); 707 try { 708 synchronized (mLock) { 709 Call call = mCallIdMapper.getCall(callId); 710 if (call != null) { 711 call.sendRttRequest(); 712 } else { 713 Log.w(this, "stopRtt(): call %s not found", callId); 714 } 715 } 716 } finally { 717 Binder.restoreCallingIdentity(token); 718 } 719 } finally { 720 Log.endSession(); 721 } 722 } 723 724 @Override respondToRttRequest(String callId, int id, boolean accept)725 public void respondToRttRequest(String callId, int id, boolean accept) { 726 try { 727 Log.startSession("ICA.rTRR", mOwnerPackageAbbreviation); 728 long token = Binder.clearCallingIdentity(); 729 try { 730 synchronized (mLock) { 731 Call call = mCallIdMapper.getCall(callId); 732 if (call != null) { 733 call.handleRttRequestResponse(id, accept); 734 } else { 735 Log.w(this, "respondToRttRequest(): call %s not found", callId); 736 } 737 } 738 } finally { 739 Binder.restoreCallingIdentity(token); 740 } 741 } finally { 742 Log.endSession(); 743 } 744 } 745 746 @Override stopRtt(String callId)747 public void stopRtt(String callId) { 748 try { 749 Log.startSession("ICA.sRTT", mOwnerPackageAbbreviation); 750 long token = Binder.clearCallingIdentity(); 751 try { 752 synchronized (mLock) { 753 Call call = mCallIdMapper.getCall(callId); 754 if (call != null) { 755 call.stopRtt(); 756 } else { 757 Log.w(this, "stopRtt(): call %s not found", callId); 758 } 759 } 760 } finally { 761 Binder.restoreCallingIdentity(token); 762 } 763 } finally { 764 Log.endSession(); 765 } 766 } 767 768 @Override setRttMode(String callId, int mode)769 public void setRttMode(String callId, int mode) { 770 try { 771 Log.startSession("ICA.sRM", mOwnerPackageAbbreviation); 772 long token = Binder.clearCallingIdentity(); 773 try { 774 synchronized (mLock) { 775 Call call = mCallIdMapper.getCall(callId); 776 if (call != null) { 777 call.setRttMode(mode); 778 } else { 779 Log.w(this, "setRttMode(): call %s not found", callId); 780 } 781 } 782 } finally { 783 Binder.restoreCallingIdentity(token); 784 } 785 } finally { 786 Log.endSession(); 787 } 788 } 789 790 @Override handoverTo(String callId, PhoneAccountHandle destAcct, int videoState, Bundle extras)791 public void handoverTo(String callId, PhoneAccountHandle destAcct, int videoState, 792 Bundle extras) { 793 try { 794 Log.startSession("ICA.hT", mOwnerPackageAbbreviation); 795 long token = Binder.clearCallingIdentity(); 796 try { 797 synchronized (mLock) { 798 Call call = mCallIdMapper.getCall(callId); 799 if (call != null) { 800 call.handoverTo(destAcct, videoState, extras); 801 } else { 802 Log.w(this, "handoverTo, unknown call id: %s", callId); 803 } 804 } 805 } finally { 806 Binder.restoreCallingIdentity(token); 807 } 808 } finally { 809 Log.endSession(); 810 } 811 } 812 } 813