blob: c0f8c675cb5134c7eb92a7e48315df4f1a17de15 [file] [log] [blame]
Santos Cordoncba1b442013-07-18 12:43:58 -07001/**
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
17package com.android.phone;
18
19import com.android.internal.telephony.CallManager;
20import com.android.services.telephony.common.ICallCommandService;
21
22/**
23 * Service interface used by in-call ui to control phone calls using commands
24 * exposed as methods. Instances of this class are handed to in-call UI via
25 * CallMonitorService.
26 */
27class CallCommandService extends ICallCommandService.Stub {
28
29 private CallManager mCallManager;
30
31 public CallCommandService(CallManager callManager) {
32 mCallManager = callManager;
33 }
34
35 /**
36 * TODO(klp): Add a confirmation callback parameter.
37 */
38 @Override
39 public void answerCall(int callId) {
40 // TODO(klp): Change to using the callId and logic from InCallScreen::internalAnswerCall
41 PhoneUtils.answerCall(mCallManager.getFirstActiveRingingCall());
42 }
43
44 /**
45 * TODO(klp): Add a confirmation callback parameter.
46 */
47 @Override
48 public void rejectCall(int callId) {
49 // TODO(klp): Change to using the callId
50 PhoneUtils.hangupRingingCall(mCallManager.getFirstActiveRingingCall());
51 }
52
53 @Override
54 public void disconnectCall(int callId) {
55 // TODO(klp): Change to using the callId
56 PhoneUtils.hangup(mCallManager);
57 }
58}