Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 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 | |
Ben Gilad | 9f2bed3 | 2013-12-12 17:43:26 -0800 | [diff] [blame] | 17 | package com.android.telecomm; |
| 18 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 19 | import android.os.Handler; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 20 | import android.os.Message; |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 21 | import android.telecomm.PhoneAccount; |
Sailesh Nepal | a439e1b | 2014-03-11 18:19:58 -0700 | [diff] [blame] | 22 | |
Evan Charlton | 352105c | 2014-06-03 14:10:54 -0700 | [diff] [blame] | 23 | import com.android.internal.os.SomeArgs; |
Sailesh Nepal | a439e1b | 2014-03-11 18:19:58 -0700 | [diff] [blame] | 24 | import com.android.internal.telecomm.IInCallAdapter; |
Ben Gilad | 9f2bed3 | 2013-12-12 17:43:26 -0800 | [diff] [blame] | 25 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 26 | /** |
| 27 | * Receives call commands and updates from in-call app and passes them through to CallsManager. |
| 28 | * {@link InCallController} creates an instance of this class and passes it to the in-call app after |
| 29 | * binding to it. This adapter can receive commands and updates until the in-call app is unbound. |
| 30 | */ |
| 31 | class InCallAdapter extends IInCallAdapter.Stub { |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 32 | private static final int MSG_ANSWER_CALL = 0; |
| 33 | private static final int MSG_REJECT_CALL = 1; |
| 34 | private static final int MSG_PLAY_DTMF_TONE = 2; |
| 35 | private static final int MSG_STOP_DTMF_TONE = 3; |
| 36 | private static final int MSG_POST_DIAL_CONTINUE = 4; |
| 37 | private static final int MSG_DISCONNECT_CALL = 5; |
| 38 | private static final int MSG_HOLD_CALL = 6; |
| 39 | private static final int MSG_UNHOLD_CALL = 7; |
Sailesh Nepal | 77da19e | 2014-07-02 21:31:16 -0700 | [diff] [blame] | 40 | private static final int MSG_PHONE_ACCOUNT_CLICKED = 8; |
Sailesh Nepal | 84fa5f8 | 2014-04-02 11:01:11 -0700 | [diff] [blame] | 41 | private static final int MSG_MUTE = 9; |
| 42 | private static final int MSG_SET_AUDIO_ROUTE = 10; |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 43 | private static final int MSG_CONFERENCE = 11; |
| 44 | private static final int MSG_SPLIT_FROM_CONFERENCE = 12; |
Sailesh Nepal | e8ecb98 | 2014-07-11 17:19:42 -0700 | [diff] [blame] | 45 | private static final int MSG_SWAP_WITH_BACKGROUND_CALL = 13; |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 46 | private static final int MSG_PHONE_ACCOUNT_SELECTED = 14; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 47 | |
| 48 | private final class InCallAdapterHandler extends Handler { |
| 49 | @Override |
| 50 | public void handleMessage(Message msg) { |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 51 | Call call; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 52 | switch (msg.what) { |
Andrew Lee | 38931d0 | 2014-07-16 10:17:36 -0700 | [diff] [blame^] | 53 | case MSG_ANSWER_CALL: { |
| 54 | SomeArgs args = (SomeArgs) msg.obj; |
| 55 | try { |
| 56 | call = mCallIdMapper.getCall(args.arg1); |
| 57 | int videoState = (int) args.arg2; |
| 58 | if (call != null) { |
| 59 | mCallsManager.answerCall(call, videoState); |
| 60 | } else { |
| 61 | Log.w(this, "answerCall, unknown call id: %s", msg.obj); |
| 62 | } |
| 63 | } finally { |
| 64 | args.recycle(); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 65 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 66 | break; |
Andrew Lee | 38931d0 | 2014-07-16 10:17:36 -0700 | [diff] [blame^] | 67 | } |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 68 | case MSG_REJECT_CALL: { |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 69 | SomeArgs args = (SomeArgs) msg.obj; |
| 70 | try { |
| 71 | call = mCallIdMapper.getCall(args.arg1); |
| 72 | boolean rejectWithMessage = args.argi1 == 1; |
| 73 | String textMessage = (String) args.arg2; |
| 74 | if (call != null) { |
| 75 | mCallsManager.rejectCall(call, rejectWithMessage, textMessage); |
| 76 | } else { |
| 77 | Log.w(this, "setRingback, unknown call id: %s", args.arg1); |
| 78 | } |
| 79 | } finally { |
| 80 | args.recycle(); |
| 81 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 82 | break; |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 83 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 84 | case MSG_PLAY_DTMF_TONE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 85 | call = mCallIdMapper.getCall(msg.obj); |
| 86 | if (call != null) { |
| 87 | mCallsManager.playDtmfTone(call, (char) msg.arg1); |
| 88 | } else { |
| 89 | Log.w(this, "playDtmfTone, unknown call id: %s", msg.obj); |
| 90 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 91 | break; |
| 92 | case MSG_STOP_DTMF_TONE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 93 | call = mCallIdMapper.getCall(msg.obj); |
| 94 | if (call != null) { |
| 95 | mCallsManager.stopDtmfTone(call); |
| 96 | } else { |
| 97 | Log.w(this, "stopDtmfTone, unknown call id: %s", msg.obj); |
| 98 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 99 | break; |
| 100 | case MSG_POST_DIAL_CONTINUE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 101 | call = mCallIdMapper.getCall(msg.obj); |
Evan Charlton | 352105c | 2014-06-03 14:10:54 -0700 | [diff] [blame] | 102 | mCallsManager.postDialContinue(call, msg.arg1 == 1); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 103 | call = mCallIdMapper.getCall(msg.obj); |
| 104 | if (call != null) { |
| 105 | mCallsManager.postDialContinue(call, msg.arg1 == 1); |
| 106 | } else { |
| 107 | Log.w(this, "postDialContinue, unknown call id: %s", msg.obj); |
| 108 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 109 | break; |
| 110 | case MSG_DISCONNECT_CALL: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 111 | call = mCallIdMapper.getCall(msg.obj); |
| 112 | if (call != null) { |
| 113 | mCallsManager.disconnectCall(call); |
| 114 | } else { |
| 115 | Log.w(this, "disconnectCall, unknown call id: %s", msg.obj); |
| 116 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 117 | break; |
| 118 | case MSG_HOLD_CALL: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 119 | call = mCallIdMapper.getCall(msg.obj); |
| 120 | if (call != null) { |
| 121 | mCallsManager.holdCall(call); |
| 122 | } else { |
| 123 | Log.w(this, "holdCall, unknown call id: %s", msg.obj); |
| 124 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 125 | break; |
| 126 | case MSG_UNHOLD_CALL: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 127 | call = mCallIdMapper.getCall(msg.obj); |
| 128 | if (call != null) { |
| 129 | mCallsManager.unholdCall(call); |
| 130 | } else { |
| 131 | Log.w(this, "unholdCall, unknown call id: %s", msg.obj); |
| 132 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 133 | break; |
Sailesh Nepal | 77da19e | 2014-07-02 21:31:16 -0700 | [diff] [blame] | 134 | case MSG_PHONE_ACCOUNT_CLICKED: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 135 | call = mCallIdMapper.getCall(msg.obj); |
| 136 | if (call != null) { |
Sailesh Nepal | 77da19e | 2014-07-02 21:31:16 -0700 | [diff] [blame] | 137 | mCallsManager.phoneAccountClicked(call); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 138 | } else { |
Sailesh Nepal | 77da19e | 2014-07-02 21:31:16 -0700 | [diff] [blame] | 139 | Log.w(this, "phoneAccountClicked, unknown call id: %s", msg.obj); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 140 | } |
Sailesh Nepal | 84fa5f8 | 2014-04-02 11:01:11 -0700 | [diff] [blame] | 141 | break; |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 142 | case MSG_PHONE_ACCOUNT_SELECTED: { |
| 143 | SomeArgs args = (SomeArgs) msg.obj; |
| 144 | try { |
| 145 | call = mCallIdMapper.getCall(args.arg1); |
| 146 | if (call != null) { |
| 147 | mCallsManager.phoneAccountSelected(call, (PhoneAccount) args.arg2); |
| 148 | } else { |
| 149 | Log.w(this, "phoneAccountSelected, unknown call id: %s", args.arg1); |
| 150 | } |
| 151 | } finally { |
| 152 | args.recycle(); |
| 153 | } |
| 154 | break; |
| 155 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 156 | case MSG_MUTE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 157 | mCallsManager.mute(msg.arg1 == 1); |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 158 | break; |
| 159 | case MSG_SET_AUDIO_ROUTE: |
| 160 | mCallsManager.setAudioRoute(msg.arg1); |
| 161 | break; |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 162 | case MSG_CONFERENCE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 163 | call = mCallIdMapper.getCall(msg.obj); |
| 164 | if (call != null) { |
| 165 | mCallsManager.conference(call); |
| 166 | } else { |
| 167 | Log.w(this, "conference, unknown call id: %s", msg.obj); |
| 168 | } |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 169 | break; |
| 170 | case MSG_SPLIT_FROM_CONFERENCE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 171 | call = mCallIdMapper.getCall(msg.obj); |
| 172 | if (call != null) { |
| 173 | call.splitFromConference(); |
| 174 | } else { |
| 175 | Log.w(this, "splitFromConference, unknown call id: %s", msg.obj); |
| 176 | } |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 177 | break; |
Sailesh Nepal | e8ecb98 | 2014-07-11 17:19:42 -0700 | [diff] [blame] | 178 | case MSG_SWAP_WITH_BACKGROUND_CALL: |
| 179 | call = mCallIdMapper.getCall(msg.obj); |
| 180 | if (call != null) { |
| 181 | call.swapWithBackgroundCall(); |
| 182 | } else { |
| 183 | Log.w(this, "swapWithBackgroundCall, unknown call id: %s", msg.obj); |
| 184 | } |
| 185 | break; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 186 | } |
| 187 | } |
| 188 | } |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 189 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 190 | private final CallsManager mCallsManager; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 191 | private final Handler mHandler = new InCallAdapterHandler(); |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 192 | private final CallIdMapper mCallIdMapper; |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 193 | |
| 194 | /** Persists the specified parameters. */ |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 195 | public InCallAdapter(CallsManager callsManager, CallIdMapper callIdMapper) { |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 196 | ThreadUtil.checkOnMainThread(); |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 197 | mCallsManager = callsManager; |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 198 | mCallIdMapper = callIdMapper; |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 199 | } |
| 200 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 201 | @Override |
Andrew Lee | 38931d0 | 2014-07-16 10:17:36 -0700 | [diff] [blame^] | 202 | public void answerCall(String callId, int videoState) { |
| 203 | Log.d(this, "answerCall(%s,%d)", callId, videoState); |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 204 | mCallIdMapper.checkValidCallId(callId); |
Andrew Lee | 38931d0 | 2014-07-16 10:17:36 -0700 | [diff] [blame^] | 205 | SomeArgs args = SomeArgs.obtain(); |
| 206 | args.arg1 = callId; |
| 207 | args.arg2 = videoState; |
| 208 | mHandler.obtainMessage(MSG_ANSWER_CALL, args).sendToTarget(); |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 209 | } |
| 210 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 211 | @Override |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 212 | public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) { |
| 213 | Log.d(this, "rejectCall(%s,%b,%s)", callId, rejectWithMessage, textMessage); |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 214 | mCallIdMapper.checkValidCallId(callId); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 215 | SomeArgs args = SomeArgs.obtain(); |
| 216 | args.arg1 = callId; |
| 217 | args.argi1 = rejectWithMessage ? 1 : 0; |
| 218 | args.arg2 = textMessage; |
| 219 | mHandler.obtainMessage(MSG_REJECT_CALL, args).sendToTarget(); |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 220 | } |
| 221 | |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 222 | @Override |
| 223 | public void playDtmfTone(String callId, char digit) { |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 224 | Log.d(this, "playDtmfTone(%s,%c)", callId, digit); |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 225 | mCallIdMapper.checkValidCallId(callId); |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 226 | mHandler.obtainMessage(MSG_PLAY_DTMF_TONE, (int) digit, 0, callId).sendToTarget(); |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 227 | } |
| 228 | |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 229 | @Override |
| 230 | public void stopDtmfTone(String callId) { |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 231 | Log.d(this, "stopDtmfTone(%s)", callId); |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 232 | mCallIdMapper.checkValidCallId(callId); |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 233 | mHandler.obtainMessage(MSG_STOP_DTMF_TONE, callId).sendToTarget(); |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 234 | } |
| 235 | |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 236 | @Override |
Evan Charlton | 352105c | 2014-06-03 14:10:54 -0700 | [diff] [blame] | 237 | public void postDialContinue(String callId, boolean proceed) { |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 238 | Log.d(this, "postDialContinue(%s)", callId); |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 239 | mCallIdMapper.checkValidCallId(callId); |
Evan Charlton | 352105c | 2014-06-03 14:10:54 -0700 | [diff] [blame] | 240 | mHandler.obtainMessage(MSG_POST_DIAL_CONTINUE, proceed ? 1 : 0, 0, callId).sendToTarget(); |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 241 | } |
| 242 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 243 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 244 | public void disconnectCall(String callId) { |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 245 | Log.v(this, "disconnectCall: %s", callId); |
| 246 | mCallIdMapper.checkValidCallId(callId); |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 247 | mHandler.obtainMessage(MSG_DISCONNECT_CALL, callId).sendToTarget(); |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 248 | } |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 249 | |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 250 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 251 | public void holdCall(String callId) { |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 252 | mCallIdMapper.checkValidCallId(callId); |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 253 | mHandler.obtainMessage(MSG_HOLD_CALL, callId).sendToTarget(); |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 254 | } |
| 255 | |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 256 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 257 | public void unholdCall(String callId) { |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 258 | mCallIdMapper.checkValidCallId(callId); |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 259 | mHandler.obtainMessage(MSG_UNHOLD_CALL, callId).sendToTarget(); |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 260 | } |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 261 | |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 262 | @Override |
Sailesh Nepal | 77da19e | 2014-07-02 21:31:16 -0700 | [diff] [blame] | 263 | public void phoneAccountClicked(String callId) { |
Sailesh Nepal | 84fa5f8 | 2014-04-02 11:01:11 -0700 | [diff] [blame] | 264 | mCallIdMapper.checkValidCallId(callId); |
Sailesh Nepal | 77da19e | 2014-07-02 21:31:16 -0700 | [diff] [blame] | 265 | mHandler.obtainMessage(MSG_PHONE_ACCOUNT_CLICKED, callId).sendToTarget(); |
Sailesh Nepal | 84fa5f8 | 2014-04-02 11:01:11 -0700 | [diff] [blame] | 266 | } |
| 267 | |
Sailesh Nepal | 84fa5f8 | 2014-04-02 11:01:11 -0700 | [diff] [blame] | 268 | @Override |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 269 | public void phoneAccountSelected(String callId, PhoneAccount account) { |
| 270 | mCallIdMapper.checkValidCallId(callId); |
| 271 | SomeArgs args = SomeArgs.obtain(); |
| 272 | args.arg1 = callId; |
| 273 | args.arg2 = account; |
| 274 | mHandler.obtainMessage(MSG_PHONE_ACCOUNT_SELECTED, args).sendToTarget(); |
| 275 | } |
| 276 | |
| 277 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 278 | public void mute(boolean shouldMute) { |
| 279 | mHandler.obtainMessage(MSG_MUTE, shouldMute ? 1 : 0, 0).sendToTarget(); |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 280 | } |
| 281 | |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 282 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 283 | public void setAudioRoute(int route) { |
| 284 | mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, route, 0).sendToTarget(); |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 285 | } |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 286 | |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 287 | @Override |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 288 | public void conference(String callId) { |
| 289 | mHandler.obtainMessage(MSG_CONFERENCE, callId).sendToTarget(); |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 290 | } |
| 291 | |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 292 | @Override |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 293 | public void splitFromConference(String callId) { |
| 294 | mHandler.obtainMessage(MSG_SPLIT_FROM_CONFERENCE, callId).sendToTarget(); |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 295 | } |
Sailesh Nepal | e8ecb98 | 2014-07-11 17:19:42 -0700 | [diff] [blame] | 296 | |
| 297 | @Override |
| 298 | public void swapWithBackgroundCall(String callId) { |
| 299 | mHandler.obtainMessage(MSG_SWAP_WITH_BACKGROUND_CALL, callId).sendToTarget(); |
| 300 | } |
Ben Gilad | 9f2bed3 | 2013-12-12 17:43:26 -0800 | [diff] [blame] | 301 | } |