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 | |
Tyler Gunn | 7cc70b4 | 2014-09-12 22:17:27 -0700 | [diff] [blame^] | 17 | package com.android.server.telecom; |
Ben Gilad | 9f2bed3 | 2013-12-12 17:43:26 -0800 | [diff] [blame] | 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; |
Tyler Gunn | 7cc70b4 | 2014-09-12 22:17:27 -0700 | [diff] [blame^] | 21 | import android.telecom.PhoneAccountHandle; |
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; |
Tyler Gunn | 7cc70b4 | 2014-09-12 22:17:27 -0700 | [diff] [blame^] | 24 | import com.android.internal.telecom.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; |
Nancy Chen | 2d8eb3a | 2014-09-08 18:29:45 -0700 | [diff] [blame] | 40 | private static final int MSG_MUTE = 8; |
| 41 | private static final int MSG_SET_AUDIO_ROUTE = 9; |
| 42 | private static final int MSG_CONFERENCE = 10; |
| 43 | private static final int MSG_SPLIT_FROM_CONFERENCE = 11; |
| 44 | private static final int MSG_SWAP_WITH_BACKGROUND_CALL = 12; |
| 45 | private static final int MSG_PHONE_ACCOUNT_SELECTED = 13; |
| 46 | private static final int MSG_TURN_ON_PROXIMITY_SENSOR = 14; |
| 47 | private static final int MSG_TURN_OFF_PROXIMITY_SENSOR = 15; |
| 48 | private static final int MSG_MERGE_CONFERENCE = 16; |
| 49 | private static final int MSG_SWAP_CONFERENCE = 17; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 50 | |
| 51 | private final class InCallAdapterHandler extends Handler { |
| 52 | @Override |
| 53 | public void handleMessage(Message msg) { |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 54 | Call call; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 55 | switch (msg.what) { |
Andrew Lee | 38931d0 | 2014-07-16 10:17:36 -0700 | [diff] [blame] | 56 | case MSG_ANSWER_CALL: { |
| 57 | SomeArgs args = (SomeArgs) msg.obj; |
| 58 | try { |
| 59 | call = mCallIdMapper.getCall(args.arg1); |
| 60 | int videoState = (int) args.arg2; |
| 61 | if (call != null) { |
| 62 | mCallsManager.answerCall(call, videoState); |
| 63 | } else { |
| 64 | Log.w(this, "answerCall, unknown call id: %s", msg.obj); |
| 65 | } |
| 66 | } finally { |
| 67 | args.recycle(); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 68 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 69 | break; |
Andrew Lee | 38931d0 | 2014-07-16 10:17:36 -0700 | [diff] [blame] | 70 | } |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 71 | case MSG_REJECT_CALL: { |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 72 | SomeArgs args = (SomeArgs) msg.obj; |
| 73 | try { |
| 74 | call = mCallIdMapper.getCall(args.arg1); |
| 75 | boolean rejectWithMessage = args.argi1 == 1; |
| 76 | String textMessage = (String) args.arg2; |
| 77 | if (call != null) { |
| 78 | mCallsManager.rejectCall(call, rejectWithMessage, textMessage); |
| 79 | } else { |
| 80 | Log.w(this, "setRingback, unknown call id: %s", args.arg1); |
| 81 | } |
| 82 | } finally { |
| 83 | args.recycle(); |
| 84 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 85 | break; |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 86 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 87 | case MSG_PLAY_DTMF_TONE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 88 | call = mCallIdMapper.getCall(msg.obj); |
| 89 | if (call != null) { |
| 90 | mCallsManager.playDtmfTone(call, (char) msg.arg1); |
| 91 | } else { |
| 92 | Log.w(this, "playDtmfTone, unknown call id: %s", msg.obj); |
| 93 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 94 | break; |
| 95 | case MSG_STOP_DTMF_TONE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 96 | call = mCallIdMapper.getCall(msg.obj); |
| 97 | if (call != null) { |
| 98 | mCallsManager.stopDtmfTone(call); |
| 99 | } else { |
| 100 | Log.w(this, "stopDtmfTone, unknown call id: %s", msg.obj); |
| 101 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 102 | break; |
| 103 | case MSG_POST_DIAL_CONTINUE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 104 | call = mCallIdMapper.getCall(msg.obj); |
Evan Charlton | 352105c | 2014-06-03 14:10:54 -0700 | [diff] [blame] | 105 | mCallsManager.postDialContinue(call, msg.arg1 == 1); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 106 | call = mCallIdMapper.getCall(msg.obj); |
| 107 | if (call != null) { |
| 108 | mCallsManager.postDialContinue(call, msg.arg1 == 1); |
| 109 | } else { |
| 110 | Log.w(this, "postDialContinue, unknown call id: %s", msg.obj); |
| 111 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 112 | break; |
| 113 | case MSG_DISCONNECT_CALL: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 114 | call = mCallIdMapper.getCall(msg.obj); |
| 115 | if (call != null) { |
| 116 | mCallsManager.disconnectCall(call); |
| 117 | } else { |
| 118 | Log.w(this, "disconnectCall, unknown call id: %s", msg.obj); |
| 119 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 120 | break; |
| 121 | case MSG_HOLD_CALL: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 122 | call = mCallIdMapper.getCall(msg.obj); |
| 123 | if (call != null) { |
| 124 | mCallsManager.holdCall(call); |
| 125 | } else { |
| 126 | Log.w(this, "holdCall, unknown call id: %s", msg.obj); |
| 127 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 128 | break; |
| 129 | case MSG_UNHOLD_CALL: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 130 | call = mCallIdMapper.getCall(msg.obj); |
| 131 | if (call != null) { |
| 132 | mCallsManager.unholdCall(call); |
| 133 | } else { |
| 134 | Log.w(this, "unholdCall, unknown call id: %s", msg.obj); |
| 135 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 136 | break; |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 137 | case MSG_PHONE_ACCOUNT_SELECTED: { |
| 138 | SomeArgs args = (SomeArgs) msg.obj; |
| 139 | try { |
| 140 | call = mCallIdMapper.getCall(args.arg1); |
| 141 | if (call != null) { |
Evan Charlton | 8917637 | 2014-07-19 18:23:09 -0700 | [diff] [blame] | 142 | mCallsManager.phoneAccountSelected(call, (PhoneAccountHandle) args.arg2); |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 143 | } else { |
| 144 | Log.w(this, "phoneAccountSelected, unknown call id: %s", args.arg1); |
| 145 | } |
| 146 | } finally { |
| 147 | args.recycle(); |
| 148 | } |
| 149 | break; |
| 150 | } |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 151 | case MSG_MUTE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 152 | mCallsManager.mute(msg.arg1 == 1); |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 153 | break; |
| 154 | case MSG_SET_AUDIO_ROUTE: |
| 155 | mCallsManager.setAudioRoute(msg.arg1); |
| 156 | break; |
Santos Cordon | 12d6182 | 2014-07-29 16:02:20 -0700 | [diff] [blame] | 157 | case MSG_CONFERENCE: { |
| 158 | SomeArgs args = (SomeArgs) msg.obj; |
| 159 | try { |
| 160 | call = mCallIdMapper.getCall(args.arg1); |
| 161 | Call otherCall = mCallIdMapper.getCall(args.arg2); |
| 162 | if (call != null && otherCall != null) { |
| 163 | mCallsManager.conference(call, otherCall); |
| 164 | } else { |
| 165 | Log.w(this, "conference, unknown call id: %s", msg.obj); |
| 166 | } |
| 167 | } finally { |
| 168 | args.recycle(); |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 169 | } |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 170 | break; |
Santos Cordon | 12d6182 | 2014-07-29 16:02:20 -0700 | [diff] [blame] | 171 | } |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 172 | case MSG_SPLIT_FROM_CONFERENCE: |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 173 | call = mCallIdMapper.getCall(msg.obj); |
| 174 | if (call != null) { |
| 175 | call.splitFromConference(); |
| 176 | } else { |
| 177 | Log.w(this, "splitFromConference, unknown call id: %s", msg.obj); |
| 178 | } |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 179 | break; |
Yorke Lee | d134687 | 2014-07-28 14:38:45 -0700 | [diff] [blame] | 180 | case MSG_TURN_ON_PROXIMITY_SENSOR: |
| 181 | mCallsManager.turnOnProximitySensor(); |
| 182 | break; |
| 183 | case MSG_TURN_OFF_PROXIMITY_SENSOR: |
| 184 | mCallsManager.turnOffProximitySensor((boolean) msg.obj); |
| 185 | break; |
Santos Cordon | 6805923 | 2014-09-04 20:09:42 -0700 | [diff] [blame] | 186 | case MSG_MERGE_CONFERENCE: |
| 187 | call = mCallIdMapper.getCall(msg.obj); |
| 188 | if (call != null) { |
| 189 | call.mergeConference(); |
| 190 | } else { |
| 191 | Log.w(this, "mergeConference, unknown call id: %s", msg.obj); |
| 192 | } |
| 193 | break; |
| 194 | case MSG_SWAP_CONFERENCE: |
| 195 | call = mCallIdMapper.getCall(msg.obj); |
| 196 | if (call != null) { |
| 197 | call.swapConference(); |
| 198 | } else { |
| 199 | Log.w(this, "swapConference, unknown call id: %s", msg.obj); |
| 200 | } |
| 201 | break; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 202 | } |
| 203 | } |
| 204 | } |
Santos Cordon | 61d0f70 | 2014-02-19 02:52:23 -0800 | [diff] [blame] | 205 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 206 | private final CallsManager mCallsManager; |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 207 | private final Handler mHandler = new InCallAdapterHandler(); |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 208 | private final CallIdMapper mCallIdMapper; |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 209 | |
| 210 | /** Persists the specified parameters. */ |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 211 | public InCallAdapter(CallsManager callsManager, CallIdMapper callIdMapper) { |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 212 | ThreadUtil.checkOnMainThread(); |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 213 | mCallsManager = callsManager; |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 214 | mCallIdMapper = callIdMapper; |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 215 | } |
| 216 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 217 | @Override |
Andrew Lee | 38931d0 | 2014-07-16 10:17:36 -0700 | [diff] [blame] | 218 | public void answerCall(String callId, int videoState) { |
| 219 | Log.d(this, "answerCall(%s,%d)", callId, videoState); |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 220 | if (mCallIdMapper.isValidCallId(callId)) { |
| 221 | SomeArgs args = SomeArgs.obtain(); |
| 222 | args.arg1 = callId; |
| 223 | args.arg2 = videoState; |
| 224 | mHandler.obtainMessage(MSG_ANSWER_CALL, args).sendToTarget(); |
| 225 | } |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 226 | } |
| 227 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 228 | @Override |
Ihab Awad | ff7493a | 2014-06-10 13:47:44 -0700 | [diff] [blame] | 229 | public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) { |
| 230 | Log.d(this, "rejectCall(%s,%b,%s)", callId, rejectWithMessage, textMessage); |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 231 | if (mCallIdMapper.isValidCallId(callId)) { |
| 232 | SomeArgs args = SomeArgs.obtain(); |
| 233 | args.arg1 = callId; |
| 234 | args.argi1 = rejectWithMessage ? 1 : 0; |
| 235 | args.arg2 = textMessage; |
| 236 | mHandler.obtainMessage(MSG_REJECT_CALL, args).sendToTarget(); |
| 237 | } |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 238 | } |
| 239 | |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 240 | @Override |
| 241 | public void playDtmfTone(String callId, char digit) { |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 242 | Log.d(this, "playDtmfTone(%s,%c)", callId, digit); |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 243 | if (mCallIdMapper.isValidCallId(callId)) { |
| 244 | mHandler.obtainMessage(MSG_PLAY_DTMF_TONE, (int) digit, 0, callId).sendToTarget(); |
| 245 | } |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 246 | } |
| 247 | |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 248 | @Override |
| 249 | public void stopDtmfTone(String callId) { |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 250 | Log.d(this, "stopDtmfTone(%s)", callId); |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 251 | if (mCallIdMapper.isValidCallId(callId)) { |
| 252 | mHandler.obtainMessage(MSG_STOP_DTMF_TONE, callId).sendToTarget(); |
| 253 | } |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 254 | } |
| 255 | |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 256 | @Override |
Evan Charlton | 352105c | 2014-06-03 14:10:54 -0700 | [diff] [blame] | 257 | public void postDialContinue(String callId, boolean proceed) { |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 258 | Log.d(this, "postDialContinue(%s)", callId); |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 259 | if (mCallIdMapper.isValidCallId(callId)) { |
| 260 | mHandler.obtainMessage(MSG_POST_DIAL_CONTINUE, proceed ? 1 : 0, 0, callId).sendToTarget(); |
| 261 | } |
Ihab Awad | 74549ec | 2014-03-10 15:33:25 -0700 | [diff] [blame] | 262 | } |
| 263 | |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 264 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 265 | public void disconnectCall(String callId) { |
Sailesh Nepal | e59bb19 | 2014-04-01 18:33:59 -0700 | [diff] [blame] | 266 | Log.v(this, "disconnectCall: %s", callId); |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 267 | if (mCallIdMapper.isValidCallId(callId)) { |
| 268 | mHandler.obtainMessage(MSG_DISCONNECT_CALL, callId).sendToTarget(); |
| 269 | } |
Santos Cordon | e3d76ab | 2014-01-28 17:25:20 -0800 | [diff] [blame] | 270 | } |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 271 | |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 272 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 273 | public void holdCall(String callId) { |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 274 | if (mCallIdMapper.isValidCallId(callId)) { |
| 275 | mHandler.obtainMessage(MSG_HOLD_CALL, callId).sendToTarget(); |
| 276 | } |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 277 | } |
| 278 | |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 279 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 280 | public void unholdCall(String callId) { |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 281 | if (mCallIdMapper.isValidCallId(callId)) { |
| 282 | mHandler.obtainMessage(MSG_UNHOLD_CALL, callId).sendToTarget(); |
| 283 | } |
Yorke Lee | cdf3ebd | 2014-03-12 18:31:41 -0700 | [diff] [blame] | 284 | } |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 285 | |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 286 | @Override |
Evan Charlton | 8917637 | 2014-07-19 18:23:09 -0700 | [diff] [blame] | 287 | public void phoneAccountSelected(String callId, PhoneAccountHandle accountHandle) { |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 288 | if (mCallIdMapper.isValidCallId(callId)) { |
| 289 | SomeArgs args = SomeArgs.obtain(); |
| 290 | args.arg1 = callId; |
| 291 | args.arg2 = accountHandle; |
| 292 | mHandler.obtainMessage(MSG_PHONE_ACCOUNT_SELECTED, args).sendToTarget(); |
| 293 | } |
Nancy Chen | 53ceedc | 2014-07-08 18:56:51 -0700 | [diff] [blame] | 294 | } |
| 295 | |
| 296 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 297 | public void mute(boolean shouldMute) { |
| 298 | mHandler.obtainMessage(MSG_MUTE, shouldMute ? 1 : 0, 0).sendToTarget(); |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 299 | } |
| 300 | |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 301 | @Override |
Sailesh Nepal | 10ea460 | 2014-04-01 17:23:32 -0700 | [diff] [blame] | 302 | public void setAudioRoute(int route) { |
| 303 | mHandler.obtainMessage(MSG_SET_AUDIO_ROUTE, route, 0).sendToTarget(); |
Sailesh Nepal | 6aca10a | 2014-03-24 16:11:02 -0700 | [diff] [blame] | 304 | } |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 305 | |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 306 | @Override |
Santos Cordon | 12d6182 | 2014-07-29 16:02:20 -0700 | [diff] [blame] | 307 | public void conference(String callId, String otherCallId) { |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 308 | if (mCallIdMapper.isValidCallId(callId) && |
| 309 | mCallIdMapper.isValidCallId(otherCallId)) { |
| 310 | SomeArgs args = SomeArgs.obtain(); |
| 311 | args.arg1 = callId; |
| 312 | args.arg2 = otherCallId; |
| 313 | mHandler.obtainMessage(MSG_CONFERENCE, args).sendToTarget(); |
| 314 | } |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 315 | } |
| 316 | |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 317 | @Override |
Santos Cordon | a161070 | 2014-06-04 20:22:56 -0700 | [diff] [blame] | 318 | public void splitFromConference(String callId) { |
Jay Shrauner | 969755a | 2014-08-11 20:34:43 -0700 | [diff] [blame] | 319 | if (mCallIdMapper.isValidCallId(callId)) { |
| 320 | mHandler.obtainMessage(MSG_SPLIT_FROM_CONFERENCE, callId).sendToTarget(); |
| 321 | } |
Santos Cordon | 8f3282c | 2014-06-01 13:56:02 -0700 | [diff] [blame] | 322 | } |
Sailesh Nepal | e8ecb98 | 2014-07-11 17:19:42 -0700 | [diff] [blame] | 323 | |
| 324 | @Override |
Santos Cordon | 6805923 | 2014-09-04 20:09:42 -0700 | [diff] [blame] | 325 | public void mergeConference(String callId) { |
| 326 | if (mCallIdMapper.isValidCallId(callId)) { |
| 327 | mHandler.obtainMessage(MSG_MERGE_CONFERENCE, callId).sendToTarget(); |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | @Override |
| 332 | public void swapConference(String callId) { |
| 333 | if (mCallIdMapper.isValidCallId(callId)) { |
| 334 | mHandler.obtainMessage(MSG_SWAP_CONFERENCE, callId).sendToTarget(); |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | @Override |
Yorke Lee | d134687 | 2014-07-28 14:38:45 -0700 | [diff] [blame] | 339 | public void turnOnProximitySensor() { |
| 340 | mHandler.obtainMessage(MSG_TURN_ON_PROXIMITY_SENSOR).sendToTarget(); |
| 341 | } |
| 342 | |
| 343 | @Override |
| 344 | public void turnOffProximitySensor(boolean screenOnImmediately) { |
| 345 | mHandler.obtainMessage(MSG_TURN_OFF_PROXIMITY_SENSOR, screenOnImmediately).sendToTarget(); |
| 346 | } |
Ben Gilad | 9f2bed3 | 2013-12-12 17:43:26 -0800 | [diff] [blame] | 347 | } |