Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 1 | /* |
| 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 | |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 18 | |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 19 | import android.annotation.NonNull; |
Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 20 | import android.annotation.SdkConstant; |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 21 | import android.annotation.SystemApi; |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 22 | import android.app.Service; |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 23 | import android.bluetooth.BluetoothDevice; |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 24 | import android.content.Intent; |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 25 | import android.hardware.camera2.CameraManager; |
Yorke Lee | 32f2473 | 2015-05-12 16:18:03 -0700 | [diff] [blame] | 26 | import android.net.Uri; |
Tyler Gunn | 876dbfb | 2016-03-14 15:18:07 -0700 | [diff] [blame] | 27 | import android.os.Bundle; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 28 | import android.os.Handler; |
| 29 | import android.os.IBinder; |
| 30 | import android.os.Looper; |
| 31 | import android.os.Message; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 32 | import android.view.Surface; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 33 | |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 34 | import com.android.internal.os.SomeArgs; |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 35 | import com.android.internal.telecom.IInCallAdapter; |
| 36 | import com.android.internal.telecom.IInCallService; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 37 | |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 38 | import java.util.Collections; |
| 39 | import java.util.List; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 40 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 41 | /** |
Tyler Gunn | 9e76fd19b | 2018-12-17 09:56:11 -0800 | [diff] [blame] | 42 | * This service is implemented by an app that wishes to provide functionality for managing |
| 43 | * phone calls. |
Tyler Gunn | 9e76fd19b | 2018-12-17 09:56:11 -0800 | [diff] [blame] | 44 | * <h2>Becoming the Default Phone App</h2> |
Tyler Gunn | 556d240 | 2019-04-10 08:59:43 -0700 | [diff] [blame] | 45 | * The default dialer/phone app is one which provides the in-call user interface while the device is |
| 46 | * in a call. A device is bundled with a system provided default dialer/phone app. The user may |
| 47 | * choose a single app to take over this role from the system app. An app which wishes to fulfill |
| 48 | * one this role uses the {@code android.app.role.RoleManager} to request that they fill the role. |
| 49 | * <p> |
Tyler Gunn | 9e76fd19b | 2018-12-17 09:56:11 -0800 | [diff] [blame] | 50 | * An app filling the role of the default phone app provides a user interface while the device is in |
| 51 | * a call, and the device is not in car mode. |
Santos Cordon | f2600eb | 2015-06-22 15:02:20 -0700 | [diff] [blame] | 52 | * <p> |
| 53 | * Below is an example manifest registration for an {@code InCallService}. The meta-data |
Tyler Gunn | dc6e6c4 | 2018-07-03 16:08:17 -0700 | [diff] [blame] | 54 | * {@link TelecomManager#METADATA_IN_CALL_SERVICE_UI} indicates that this particular |
Santos Cordon | f2600eb | 2015-06-22 15:02:20 -0700 | [diff] [blame] | 55 | * {@code InCallService} implementation intends to replace the built-in in-call UI. |
Tyler Gunn | dc6e6c4 | 2018-07-03 16:08:17 -0700 | [diff] [blame] | 56 | * The meta-data {@link TelecomManager#METADATA_IN_CALL_SERVICE_RINGING} indicates that this |
| 57 | * {@link InCallService} will play the ringtone for incoming calls. See |
| 58 | * <a href="#incomingCallNotification">below</a> for more information on showing the incoming call |
| 59 | * UI and playing the ringtone in your app. |
Santos Cordon | f2600eb | 2015-06-22 15:02:20 -0700 | [diff] [blame] | 60 | * <pre> |
| 61 | * {@code |
Neil Fuller | 71fbb81 | 2015-11-30 09:51:33 +0000 | [diff] [blame] | 62 | * <service android:name="your.package.YourInCallServiceImplementation" |
Sailesh Nepal | 78f3ba6 | 2015-12-28 16:20:56 -0800 | [diff] [blame] | 63 | * android:permission="android.permission.BIND_INCALL_SERVICE"> |
Neil Fuller | 71fbb81 | 2015-11-30 09:51:33 +0000 | [diff] [blame] | 64 | * <meta-data android:name="android.telecom.IN_CALL_SERVICE_UI" android:value="true" /> |
Tyler Gunn | dc6e6c4 | 2018-07-03 16:08:17 -0700 | [diff] [blame] | 65 | * <meta-data android:name="android.telecom.IN_CALL_SERVICE_RINGING" |
| 66 | * android:value="true" /> |
Neil Fuller | 71fbb81 | 2015-11-30 09:51:33 +0000 | [diff] [blame] | 67 | * <intent-filter> |
| 68 | * <action android:name="android.telecom.InCallService"/> |
| 69 | * </intent-filter> |
| 70 | * </service> |
Santos Cordon | f2600eb | 2015-06-22 15:02:20 -0700 | [diff] [blame] | 71 | * } |
| 72 | * </pre> |
Tyler Gunn | fe39efa | 2018-02-02 13:18:02 -0800 | [diff] [blame] | 73 | * <p> |
| 74 | * In addition to implementing the {@link InCallService} API, you must also declare an activity in |
| 75 | * your manifest which handles the {@link Intent#ACTION_DIAL} intent. The example below illustrates |
| 76 | * how this is done: |
| 77 | * <pre> |
| 78 | * {@code |
| 79 | * <activity android:name="your.package.YourDialerActivity" |
| 80 | * android:label="@string/yourDialerActivityLabel"> |
| 81 | * <intent-filter> |
| 82 | * <action android:name="android.intent.action.DIAL" /> |
| 83 | * <category android:name="android.intent.category.DEFAULT" /> |
| 84 | * </intent-filter> |
| 85 | * </activity> |
| 86 | * } |
| 87 | * </pre> |
| 88 | * <p> |
Tyler Gunn | 9e76fd19b | 2018-12-17 09:56:11 -0800 | [diff] [blame] | 89 | * When a user installs your application and runs it for the first time, you should use the |
| 90 | * {@link android.app.role.RoleManager} to prompt the user to see if they would like your app to |
| 91 | * be the new default phone app. |
| 92 | * <p id="requestRole"> |
| 93 | * The code below shows how your app can request to become the default phone/dialer app: |
| 94 | * <pre> |
| 95 | * {@code |
| 96 | * private static final int REQUEST_ID = 1; |
| 97 | * |
| 98 | * public void requestRole() { |
| 99 | * RoleManager roleManager = (RoleManager) getSystemService(ROLE_SERVICE); |
| 100 | * Intent intent = roleManager.createRequestRoleIntent(RoleManager.ROLE_DIALER); |
| 101 | * startActivityForResult(intent, REQUEST_ID); |
| 102 | * } |
| 103 | * |
| 104 | * @Override |
| 105 | * public void onActivityResult(int requestCode, int resultCode, Intent data) { |
| 106 | * if (requestCode == REQUEST_ID) { |
| 107 | * if (resultCode == android.app.Activity.RESULT_OK) { |
| 108 | * // Your app is now the default dialer app |
| 109 | * } else { |
| 110 | * // Your app is not the default dialer app |
| 111 | * } |
| 112 | * } |
| 113 | * } |
| 114 | * </pre> |
Tyler Gunn | dc6e6c4 | 2018-07-03 16:08:17 -0700 | [diff] [blame] | 115 | * <p id="incomingCallNotification"> |
Tyler Gunn | 9e76fd19b | 2018-12-17 09:56:11 -0800 | [diff] [blame] | 116 | * <h3>Showing the Incoming Call Notification</h3> |
Tyler Gunn | dc6e6c4 | 2018-07-03 16:08:17 -0700 | [diff] [blame] | 117 | * When your app receives a new incoming call via {@link InCallService#onCallAdded(Call)}, it is |
| 118 | * responsible for displaying an incoming call UI for the incoming call. It should do this using |
| 119 | * {@link android.app.NotificationManager} APIs to post a new incoming call notification. |
| 120 | * <p> |
| 121 | * Where your app declares the meta-data {@link TelecomManager#METADATA_IN_CALL_SERVICE_RINGING}, it |
| 122 | * is responsible for playing the ringtone for incoming calls. Your app should create a |
| 123 | * {@link android.app.NotificationChannel} which specifies the desired ringtone. For example: |
| 124 | * <pre><code> |
| 125 | * NotificationChannel channel = new NotificationChannel(YOUR_CHANNEL_ID, "Incoming Calls", |
| 126 | * NotificationManager.IMPORTANCE_MAX); |
| 127 | * // other channel setup stuff goes here. |
| 128 | * |
| 129 | * // We'll use the default system ringtone for our incoming call notification channel. You can |
| 130 | * // use your own audio resource here. |
| 131 | * Uri ringtoneUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE); |
| 132 | * channel.setSound(ringtoneUri, new AudioAttributes.Builder() |
| 133 | * // Setting the AudioAttributes is important as it identifies the purpose of your |
| 134 | * // notification sound. |
| 135 | * .setUsage(AudioAttributes.USAGE_NOTIFICATION_RINGTONE) |
| 136 | * .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) |
| 137 | * .build()); |
| 138 | * |
| 139 | * NotificationManager mgr = getSystemService(NotificationManager.class); |
| 140 | * mgr.createNotificationChannel(channel); |
| 141 | * </code></pre> |
| 142 | * <p> |
| 143 | * When your app receives a new incoming call, it creates a {@link android.app.Notification} for the |
| 144 | * incoming call and associates it with your incoming call notification channel. You can specify a |
| 145 | * {@link android.app.PendingIntent} on the notification which will launch your full screen |
| 146 | * incoming call UI. The notification manager framework will display your notification as a |
| 147 | * heads-up notification if the user is actively using the phone. When the user is not using the |
| 148 | * phone, your full-screen incoming call UI is used instead. |
| 149 | * For example: |
Tyler Gunn | 9e76fd19b | 2018-12-17 09:56:11 -0800 | [diff] [blame] | 150 | * <pre><code>{@code |
Tyler Gunn | dc6e6c4 | 2018-07-03 16:08:17 -0700 | [diff] [blame] | 151 | * // Create an intent which triggers your fullscreen incoming call user interface. |
| 152 | * Intent intent = new Intent(Intent.ACTION_MAIN, null); |
| 153 | * intent.setFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION | Intent.FLAG_ACTIVITY_NEW_TASK); |
| 154 | * intent.setClass(context, YourIncomingCallActivity.class); |
| 155 | * PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, 0); |
| 156 | * |
| 157 | * // Build the notification as an ongoing high priority item; this ensures it will show as |
| 158 | * // a heads up notification which slides down over top of the current content. |
| 159 | * final Notification.Builder builder = new Notification.Builder(context); |
| 160 | * builder.setOngoing(true); |
| 161 | * builder.setPriority(Notification.PRIORITY_HIGH); |
| 162 | * |
| 163 | * // Set notification content intent to take user to the fullscreen UI if user taps on the |
| 164 | * // notification body. |
| 165 | * builder.setContentIntent(pendingIntent); |
| 166 | * // Set full screen intent to trigger display of the fullscreen UI when the notification |
| 167 | * // manager deems it appropriate. |
| 168 | * builder.setFullScreenIntent(pendingIntent, true); |
| 169 | * |
| 170 | * // Setup notification content. |
| 171 | * builder.setSmallIcon( yourIconResourceId ); |
| 172 | * builder.setContentTitle("Your notification title"); |
| 173 | * builder.setContentText("Your notification content."); |
| 174 | * |
| 175 | * // Use builder.addAction(..) to add buttons to answer or reject the call. |
| 176 | * |
| 177 | * NotificationManager notificationManager = mContext.getSystemService( |
| 178 | * NotificationManager.class); |
| 179 | * notificationManager.notify(YOUR_CHANNEL_ID, YOUR_TAG, YOUR_ID, builder.build()); |
Tyler Gunn | 9e76fd19b | 2018-12-17 09:56:11 -0800 | [diff] [blame] | 180 | * }</pre> |
| 181 | * <p> |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 182 | */ |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 183 | public abstract class InCallService extends Service { |
Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 184 | |
| 185 | /** |
| 186 | * The {@link Intent} that must be declared as handled by the service. |
| 187 | */ |
| 188 | @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 189 | public static final String SERVICE_INTERFACE = "android.telecom.InCallService"; |
Tyler Gunn | 2ac4010 | 2014-08-18 16:23:10 -0700 | [diff] [blame] | 190 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 191 | private static final int MSG_SET_IN_CALL_ADAPTER = 1; |
| 192 | private static final int MSG_ADD_CALL = 2; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 193 | private static final int MSG_UPDATE_CALL = 3; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 194 | private static final int MSG_SET_POST_DIAL_WAIT = 4; |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 195 | private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 5; |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 196 | private static final int MSG_BRING_TO_FOREGROUND = 6; |
Santos Cordon | 6c912b7 | 2014-11-07 16:05:09 -0800 | [diff] [blame] | 197 | private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7; |
Sailesh Nepal | 9c2618b | 2016-01-23 16:28:22 -0800 | [diff] [blame] | 198 | private static final int MSG_SILENCE_RINGER = 8; |
Tyler Gunn | 876dbfb | 2016-03-14 15:18:07 -0700 | [diff] [blame] | 199 | private static final int MSG_ON_CONNECTION_EVENT = 9; |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 200 | private static final int MSG_ON_RTT_UPGRADE_REQUEST = 10; |
Hall Liu | 57006aa | 2017-02-06 10:49:48 -0800 | [diff] [blame] | 201 | private static final int MSG_ON_RTT_INITIATION_FAILURE = 11; |
Sanket Padawe | 85291f6 | 2017-12-01 13:59:27 -0800 | [diff] [blame] | 202 | private static final int MSG_ON_HANDOVER_FAILED = 12; |
Tyler Gunn | 858bfaf | 2018-01-22 15:17:54 -0800 | [diff] [blame] | 203 | private static final int MSG_ON_HANDOVER_COMPLETE = 13; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 204 | |
| 205 | /** Default Handler used to consolidate binder method calls onto a single thread. */ |
| 206 | private final Handler mHandler = new Handler(Looper.getMainLooper()) { |
| 207 | @Override |
| 208 | public void handleMessage(Message msg) { |
Jay Shrauner | 5e6162d | 2014-09-22 20:47:45 -0700 | [diff] [blame] | 209 | if (mPhone == null && msg.what != MSG_SET_IN_CALL_ADAPTER) { |
| 210 | return; |
| 211 | } |
| 212 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 213 | switch (msg.what) { |
| 214 | case MSG_SET_IN_CALL_ADAPTER: |
Tyler Gunn | bf9c6fd | 2016-11-09 10:19:23 -0800 | [diff] [blame] | 215 | String callingPackage = getApplicationContext().getOpPackageName(); |
Tyler Gunn | 159f35c | 2017-03-02 09:28:37 -0800 | [diff] [blame] | 216 | mPhone = new Phone(new InCallAdapter((IInCallAdapter) msg.obj), callingPackage, |
| 217 | getApplicationContext().getApplicationInfo().targetSdkVersion); |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 218 | mPhone.addListener(mPhoneListener); |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 219 | onPhoneCreated(mPhone); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 220 | break; |
| 221 | case MSG_ADD_CALL: |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 222 | mPhone.internalAddCall((ParcelableCall) msg.obj); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 223 | break; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 224 | case MSG_UPDATE_CALL: |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 225 | mPhone.internalUpdateCall((ParcelableCall) msg.obj); |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 226 | break; |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 227 | case MSG_SET_POST_DIAL_WAIT: { |
| 228 | SomeArgs args = (SomeArgs) msg.obj; |
| 229 | try { |
| 230 | String callId = (String) args.arg1; |
| 231 | String remaining = (String) args.arg2; |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 232 | mPhone.internalSetPostDialWait(callId, remaining); |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 233 | } finally { |
| 234 | args.recycle(); |
| 235 | } |
| 236 | break; |
| 237 | } |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 238 | case MSG_ON_CALL_AUDIO_STATE_CHANGED: |
| 239 | mPhone.internalCallAudioStateChanged((CallAudioState) msg.obj); |
Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 240 | break; |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 241 | case MSG_BRING_TO_FOREGROUND: |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 242 | mPhone.internalBringToForeground(msg.arg1 == 1); |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 243 | break; |
Santos Cordon | 6c912b7 | 2014-11-07 16:05:09 -0800 | [diff] [blame] | 244 | case MSG_ON_CAN_ADD_CALL_CHANGED: |
| 245 | mPhone.internalSetCanAddCall(msg.arg1 == 1); |
| 246 | break; |
Sailesh Nepal | 9c2618b | 2016-01-23 16:28:22 -0800 | [diff] [blame] | 247 | case MSG_SILENCE_RINGER: |
| 248 | mPhone.internalSilenceRinger(); |
| 249 | break; |
Tyler Gunn | 876dbfb | 2016-03-14 15:18:07 -0700 | [diff] [blame] | 250 | case MSG_ON_CONNECTION_EVENT: { |
| 251 | SomeArgs args = (SomeArgs) msg.obj; |
| 252 | try { |
| 253 | String callId = (String) args.arg1; |
| 254 | String event = (String) args.arg2; |
| 255 | Bundle extras = (Bundle) args.arg3; |
| 256 | mPhone.internalOnConnectionEvent(callId, event, extras); |
| 257 | } finally { |
| 258 | args.recycle(); |
| 259 | } |
| 260 | break; |
| 261 | } |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 262 | case MSG_ON_RTT_UPGRADE_REQUEST: { |
| 263 | String callId = (String) msg.obj; |
| 264 | int requestId = msg.arg1; |
| 265 | mPhone.internalOnRttUpgradeRequest(callId, requestId); |
| 266 | break; |
| 267 | } |
Hall Liu | 57006aa | 2017-02-06 10:49:48 -0800 | [diff] [blame] | 268 | case MSG_ON_RTT_INITIATION_FAILURE: { |
| 269 | String callId = (String) msg.obj; |
| 270 | int reason = msg.arg1; |
| 271 | mPhone.internalOnRttInitiationFailure(callId, reason); |
| 272 | break; |
| 273 | } |
Sanket Padawe | 85291f6 | 2017-12-01 13:59:27 -0800 | [diff] [blame] | 274 | case MSG_ON_HANDOVER_FAILED: { |
| 275 | String callId = (String) msg.obj; |
| 276 | int error = msg.arg1; |
| 277 | mPhone.internalOnHandoverFailed(callId, error); |
| 278 | break; |
| 279 | } |
Tyler Gunn | 858bfaf | 2018-01-22 15:17:54 -0800 | [diff] [blame] | 280 | case MSG_ON_HANDOVER_COMPLETE: { |
| 281 | String callId = (String) msg.obj; |
| 282 | mPhone.internalOnHandoverComplete(callId); |
| 283 | break; |
| 284 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 285 | default: |
| 286 | break; |
| 287 | } |
| 288 | } |
| 289 | }; |
| 290 | |
| 291 | /** Manages the binder calls so that the implementor does not need to deal with it. */ |
| 292 | private final class InCallServiceBinder extends IInCallService.Stub { |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 293 | @Override |
| 294 | public void setInCallAdapter(IInCallAdapter inCallAdapter) { |
| 295 | mHandler.obtainMessage(MSG_SET_IN_CALL_ADAPTER, inCallAdapter).sendToTarget(); |
| 296 | } |
| 297 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 298 | @Override |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 299 | public void addCall(ParcelableCall call) { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 300 | mHandler.obtainMessage(MSG_ADD_CALL, call).sendToTarget(); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 301 | } |
| 302 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 303 | @Override |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 304 | public void updateCall(ParcelableCall call) { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 305 | mHandler.obtainMessage(MSG_UPDATE_CALL, call).sendToTarget(); |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 306 | } |
| 307 | |
| 308 | @Override |
| 309 | public void setPostDial(String callId, String remaining) { |
Ihab Awad | 5d0410f | 2014-07-30 10:07:40 -0700 | [diff] [blame] | 310 | // TODO: Unused |
Ihab Awad | 2f23664 | 2014-03-10 15:33:45 -0700 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | @Override |
| 314 | public void setPostDialWait(String callId, String remaining) { |
| 315 | SomeArgs args = SomeArgs.obtain(); |
| 316 | args.arg1 = callId; |
| 317 | args.arg2 = remaining; |
| 318 | mHandler.obtainMessage(MSG_SET_POST_DIAL_WAIT, args).sendToTarget(); |
| 319 | } |
Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 320 | |
| 321 | @Override |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 322 | public void onCallAudioStateChanged(CallAudioState callAudioState) { |
| 323 | mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, callAudioState).sendToTarget(); |
Sailesh Nepal | b632e5b | 2014-04-03 12:54:33 -0700 | [diff] [blame] | 324 | } |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 325 | |
Santos Cordon | 3534ede | 2014-05-29 13:07:10 -0700 | [diff] [blame] | 326 | @Override |
| 327 | public void bringToForeground(boolean showDialpad) { |
| 328 | mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget(); |
| 329 | } |
Santos Cordon | 6c912b7 | 2014-11-07 16:05:09 -0800 | [diff] [blame] | 330 | |
| 331 | @Override |
| 332 | public void onCanAddCallChanged(boolean canAddCall) { |
| 333 | mHandler.obtainMessage(MSG_ON_CAN_ADD_CALL_CHANGED, canAddCall ? 1 : 0, 0) |
| 334 | .sendToTarget(); |
| 335 | } |
Sailesh Nepal | 9c2618b | 2016-01-23 16:28:22 -0800 | [diff] [blame] | 336 | |
| 337 | @Override |
| 338 | public void silenceRinger() { |
| 339 | mHandler.obtainMessage(MSG_SILENCE_RINGER).sendToTarget(); |
| 340 | } |
Tyler Gunn | 876dbfb | 2016-03-14 15:18:07 -0700 | [diff] [blame] | 341 | |
| 342 | @Override |
| 343 | public void onConnectionEvent(String callId, String event, Bundle extras) { |
| 344 | SomeArgs args = SomeArgs.obtain(); |
| 345 | args.arg1 = callId; |
| 346 | args.arg2 = event; |
| 347 | args.arg3 = extras; |
| 348 | mHandler.obtainMessage(MSG_ON_CONNECTION_EVENT, args).sendToTarget(); |
| 349 | } |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 350 | |
| 351 | @Override |
| 352 | public void onRttUpgradeRequest(String callId, int id) { |
| 353 | mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, id, 0, callId).sendToTarget(); |
| 354 | } |
Hall Liu | 57006aa | 2017-02-06 10:49:48 -0800 | [diff] [blame] | 355 | |
| 356 | @Override |
| 357 | public void onRttInitiationFailure(String callId, int reason) { |
| 358 | mHandler.obtainMessage(MSG_ON_RTT_INITIATION_FAILURE, reason, 0, callId).sendToTarget(); |
| 359 | } |
Sanket Padawe | 85291f6 | 2017-12-01 13:59:27 -0800 | [diff] [blame] | 360 | |
| 361 | @Override |
| 362 | public void onHandoverFailed(String callId, int error) { |
| 363 | mHandler.obtainMessage(MSG_ON_HANDOVER_FAILED, error, 0, callId).sendToTarget(); |
| 364 | } |
Tyler Gunn | 858bfaf | 2018-01-22 15:17:54 -0800 | [diff] [blame] | 365 | |
| 366 | @Override |
| 367 | public void onHandoverComplete(String callId) { |
| 368 | mHandler.obtainMessage(MSG_ON_HANDOVER_COMPLETE, callId).sendToTarget(); |
| 369 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 370 | } |
| 371 | |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 372 | private Phone.Listener mPhoneListener = new Phone.Listener() { |
| 373 | /** ${inheritDoc} */ |
| 374 | @Override |
| 375 | public void onAudioStateChanged(Phone phone, AudioState audioState) { |
| 376 | InCallService.this.onAudioStateChanged(audioState); |
| 377 | } |
| 378 | |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 379 | public void onCallAudioStateChanged(Phone phone, CallAudioState callAudioState) { |
| 380 | InCallService.this.onCallAudioStateChanged(callAudioState); |
| 381 | }; |
| 382 | |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 383 | /** ${inheritDoc} */ |
| 384 | @Override |
| 385 | public void onBringToForeground(Phone phone, boolean showDialpad) { |
| 386 | InCallService.this.onBringToForeground(showDialpad); |
| 387 | } |
| 388 | |
| 389 | /** ${inheritDoc} */ |
| 390 | @Override |
| 391 | public void onCallAdded(Phone phone, Call call) { |
| 392 | InCallService.this.onCallAdded(call); |
| 393 | } |
| 394 | |
| 395 | /** ${inheritDoc} */ |
| 396 | @Override |
| 397 | public void onCallRemoved(Phone phone, Call call) { |
| 398 | InCallService.this.onCallRemoved(call); |
| 399 | } |
| 400 | |
| 401 | /** ${inheritDoc} */ |
| 402 | @Override |
| 403 | public void onCanAddCallChanged(Phone phone, boolean canAddCall) { |
| 404 | InCallService.this.onCanAddCallChanged(canAddCall); |
| 405 | } |
| 406 | |
Sailesh Nepal | 9c2618b | 2016-01-23 16:28:22 -0800 | [diff] [blame] | 407 | /** ${inheritDoc} */ |
| 408 | @Override |
| 409 | public void onSilenceRinger(Phone phone) { |
| 410 | InCallService.this.onSilenceRinger(); |
| 411 | } |
| 412 | |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 413 | }; |
| 414 | |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 415 | private Phone mPhone; |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 416 | |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 417 | public InCallService() { |
| 418 | } |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 419 | |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 420 | @Override |
| 421 | public IBinder onBind(Intent intent) { |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 422 | return new InCallServiceBinder(); |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 423 | } |
| 424 | |
Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 425 | @Override |
| 426 | public boolean onUnbind(Intent intent) { |
Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 427 | if (mPhone != null) { |
| 428 | Phone oldPhone = mPhone; |
| 429 | mPhone = null; |
Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 430 | |
Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 431 | oldPhone.destroy(); |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 432 | // destroy sets all the calls to disconnected if any live ones still exist. Therefore, |
| 433 | // it is important to remove the Listener *after* the call to destroy so that |
| 434 | // InCallService.on* callbacks are appropriately called. |
| 435 | oldPhone.removeListener(mPhoneListener); |
| 436 | |
Santos Cordon | 619b3c0 | 2014-09-02 17:13:45 -0700 | [diff] [blame] | 437 | onPhoneDestroyed(oldPhone); |
| 438 | } |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 439 | |
Santos Cordon | f30d7e9 | 2014-08-26 09:54:33 -0700 | [diff] [blame] | 440 | return false; |
| 441 | } |
| 442 | |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 443 | /** |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 444 | * Obtain the {@code Phone} associated with this {@code InCallService}. |
| 445 | * |
| 446 | * @return The {@code Phone} object associated with this {@code InCallService}, or {@code null} |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 447 | * if the {@code InCallService} is not in a state where it has an associated |
| 448 | * {@code Phone}. |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 449 | * @hide |
Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 450 | * @deprecated Use direct methods on InCallService instead of {@link Phone}. |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 451 | */ |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 452 | @SystemApi |
Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 453 | @Deprecated |
| 454 | public Phone getPhone() { |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 455 | return mPhone; |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 456 | } |
| 457 | |
| 458 | /** |
Santos Cordon | 895d4b8 | 2015-06-25 16:41:48 -0700 | [diff] [blame] | 459 | * Obtains the current list of {@code Call}s to be displayed by this in-call service. |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 460 | * |
| 461 | * @return A list of the relevant {@code Call}s. |
| 462 | */ |
| 463 | public final List<Call> getCalls() { |
| 464 | return mPhone == null ? Collections.<Call>emptyList() : mPhone.getCalls(); |
| 465 | } |
| 466 | |
| 467 | /** |
| 468 | * Returns if the device can support additional calls. |
| 469 | * |
| 470 | * @return Whether the phone supports adding more calls. |
| 471 | */ |
| 472 | public final boolean canAddCall() { |
| 473 | return mPhone == null ? false : mPhone.canAddCall(); |
| 474 | } |
| 475 | |
| 476 | /** |
| 477 | * Obtains the current phone call audio state. |
| 478 | * |
| 479 | * @return An object encapsulating the audio state. Returns null if the service is not |
| 480 | * fully initialized. |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 481 | * @deprecated Use {@link #getCallAudioState()} instead. |
| 482 | * @hide |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 483 | */ |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 484 | @Deprecated |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 485 | public final AudioState getAudioState() { |
| 486 | return mPhone == null ? null : mPhone.getAudioState(); |
| 487 | } |
| 488 | |
| 489 | /** |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 490 | * Obtains the current phone call audio state. |
| 491 | * |
| 492 | * @return An object encapsulating the audio state. Returns null if the service is not |
| 493 | * fully initialized. |
| 494 | */ |
| 495 | public final CallAudioState getCallAudioState() { |
| 496 | return mPhone == null ? null : mPhone.getCallAudioState(); |
| 497 | } |
| 498 | |
| 499 | /** |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 500 | * Sets the microphone mute state. When this request is honored, there will be change to |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 501 | * the {@link #getCallAudioState()}. |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 502 | * |
| 503 | * @param state {@code true} if the microphone should be muted; {@code false} otherwise. |
| 504 | */ |
| 505 | public final void setMuted(boolean state) { |
| 506 | if (mPhone != null) { |
| 507 | mPhone.setMuted(state); |
| 508 | } |
| 509 | } |
| 510 | |
| 511 | /** |
| 512 | * Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 513 | * be change to the {@link #getCallAudioState()}. |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 514 | * |
| 515 | * @param route The audio route to use. |
| 516 | */ |
| 517 | public final void setAudioRoute(int route) { |
| 518 | if (mPhone != null) { |
| 519 | mPhone.setAudioRoute(route); |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | /** |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 524 | * Request audio routing to a specific bluetooth device. Calling this method may result in |
| 525 | * the device routing audio to a different bluetooth device than the one specified if the |
| 526 | * bluetooth stack is unable to route audio to the requested device. |
| 527 | * A list of available devices can be obtained via |
| 528 | * {@link CallAudioState#getSupportedBluetoothDevices()} |
| 529 | * |
Hall Liu | 1539283 | 2018-04-02 13:52:57 -0700 | [diff] [blame] | 530 | * @param bluetoothDevice The bluetooth device to connect to. |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 531 | */ |
Hall Liu | 1539283 | 2018-04-02 13:52:57 -0700 | [diff] [blame] | 532 | public final void requestBluetoothAudio(@NonNull BluetoothDevice bluetoothDevice) { |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 533 | if (mPhone != null) { |
Hall Liu | 1539283 | 2018-04-02 13:52:57 -0700 | [diff] [blame] | 534 | mPhone.requestBluetoothAudio(bluetoothDevice.getAddress()); |
Hall Liu | a98f58b5 | 2017-11-07 17:59:28 -0800 | [diff] [blame] | 535 | } |
| 536 | } |
| 537 | |
| 538 | /** |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 539 | * Invoked when the {@code Phone} has been created. This is a signal to the in-call experience |
| 540 | * to start displaying in-call information to the user. Each instance of {@code InCallService} |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 541 | * will have only one {@code Phone}, and this method will be called exactly once in the lifetime |
| 542 | * of the {@code InCallService}. |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 543 | * |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 544 | * @param phone The {@code Phone} object associated with this {@code InCallService}. |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 545 | * @hide |
Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 546 | * @deprecated Use direct methods on InCallService instead of {@link Phone}. |
Evan Charlton | 924748f | 2014-04-03 08:36:38 -0700 | [diff] [blame] | 547 | */ |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 548 | @SystemApi |
Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 549 | @Deprecated |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 550 | public void onPhoneCreated(Phone phone) { |
| 551 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 552 | |
| 553 | /** |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 554 | * Invoked when a {@code Phone} has been destroyed. This is a signal to the in-call experience |
| 555 | * to stop displaying in-call information to the user. This method will be called exactly once |
| 556 | * in the lifetime of the {@code InCallService}, and it will always be called after a previous |
| 557 | * call to {@link #onPhoneCreated(Phone)}. |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 558 | * |
Ihab Awad | e63fadb | 2014-07-09 21:52:04 -0700 | [diff] [blame] | 559 | * @param phone The {@code Phone} object associated with this {@code InCallService}. |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 560 | * @hide |
Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 561 | * @deprecated Use direct methods on InCallService instead of {@link Phone}. |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 562 | */ |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 563 | @SystemApi |
Santos Cordon | 29886d8 | 2015-04-16 15:34:07 -0700 | [diff] [blame] | 564 | @Deprecated |
Santos Cordon | 2f42b11 | 2014-07-19 13:19:37 -0700 | [diff] [blame] | 565 | public void onPhoneDestroyed(Phone phone) { |
| 566 | } |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 567 | |
| 568 | /** |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 569 | * Called when the audio state changes. |
| 570 | * |
| 571 | * @param audioState The new {@link AudioState}. |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 572 | * @deprecated Use {@link #onCallAudioStateChanged(CallAudioState) instead}. |
| 573 | * @hide |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 574 | */ |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 575 | @Deprecated |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 576 | public void onAudioStateChanged(AudioState audioState) { |
| 577 | } |
| 578 | |
| 579 | /** |
Yorke Lee | 4af5935 | 2015-05-13 14:14:54 -0700 | [diff] [blame] | 580 | * Called when the audio state changes. |
| 581 | * |
| 582 | * @param audioState The new {@link CallAudioState}. |
| 583 | */ |
| 584 | public void onCallAudioStateChanged(CallAudioState audioState) { |
| 585 | } |
| 586 | |
| 587 | /** |
Santos Cordon | a249281 | 2015-04-15 11:05:16 -0700 | [diff] [blame] | 588 | * Called to bring the in-call screen to the foreground. The in-call experience should |
| 589 | * respond immediately by coming to the foreground to inform the user of the state of |
| 590 | * ongoing {@code Call}s. |
| 591 | * |
| 592 | * @param showDialpad If true, put up the dialpad when the screen is shown. |
| 593 | */ |
| 594 | public void onBringToForeground(boolean showDialpad) { |
| 595 | } |
| 596 | |
| 597 | /** |
| 598 | * Called when a {@code Call} has been added to this in-call session. The in-call user |
| 599 | * experience should add necessary state listeners to the specified {@code Call} and |
| 600 | * immediately start to show the user information about the existence |
| 601 | * and nature of this {@code Call}. Subsequent invocations of {@link #getCalls()} will |
| 602 | * include this {@code Call}. |
| 603 | * |
| 604 | * @param call A newly added {@code Call}. |
| 605 | */ |
| 606 | public void onCallAdded(Call call) { |
| 607 | } |
| 608 | |
| 609 | /** |
| 610 | * Called when a {@code Call} has been removed from this in-call session. The in-call user |
| 611 | * experience should remove any state listeners from the specified {@code Call} and |
| 612 | * immediately stop displaying any information about this {@code Call}. |
| 613 | * Subsequent invocations of {@link #getCalls()} will no longer include this {@code Call}. |
| 614 | * |
| 615 | * @param call A newly removed {@code Call}. |
| 616 | */ |
| 617 | public void onCallRemoved(Call call) { |
| 618 | } |
| 619 | |
| 620 | /** |
| 621 | * Called when the ability to add more calls changes. If the phone cannot |
| 622 | * support more calls then {@code canAddCall} is set to {@code false}. If it can, then it |
| 623 | * is set to {@code true}. This can be used to control the visibility of UI to add more calls. |
| 624 | * |
| 625 | * @param canAddCall Indicates whether an additional call can be added. |
| 626 | */ |
| 627 | public void onCanAddCallChanged(boolean canAddCall) { |
| 628 | } |
| 629 | |
| 630 | /** |
Sailesh Nepal | 9c2618b | 2016-01-23 16:28:22 -0800 | [diff] [blame] | 631 | * Called to silence the ringer if a ringing call exists. |
| 632 | */ |
| 633 | public void onSilenceRinger() { |
| 634 | } |
| 635 | |
| 636 | /** |
Tyler Gunn | 06f3fa6 | 2016-08-25 09:26:15 -0700 | [diff] [blame] | 637 | * Unused; to handle connection events issued by a {@link ConnectionService}, implement the |
| 638 | * {@link android.telecom.Call.Callback#onConnectionEvent(Call, String, Bundle)} callback. |
Tyler Gunn | 876dbfb | 2016-03-14 15:18:07 -0700 | [diff] [blame] | 639 | * <p> |
| 640 | * See {@link Connection#sendConnectionEvent(String, Bundle)}. |
| 641 | * |
| 642 | * @param call The call the event is associated with. |
| 643 | * @param event The event. |
| 644 | * @param extras Any associated extras. |
| 645 | */ |
| 646 | public void onConnectionEvent(Call call, String event, Bundle extras) { |
| 647 | } |
| 648 | |
| 649 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 650 | * Used to issue commands to the {@link Connection.VideoProvider} associated with a |
| 651 | * {@link Call}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 652 | */ |
| 653 | public static abstract class VideoCall { |
| 654 | |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 655 | /** @hide */ |
| 656 | public abstract void destroy(); |
| 657 | |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 658 | /** |
Andrew Lee | 7c9ee2b | 2015-04-16 15:26:08 -0700 | [diff] [blame] | 659 | * Registers a callback to receive commands and state changes for video calls. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 660 | * |
Andrew Lee | 7c9ee2b | 2015-04-16 15:26:08 -0700 | [diff] [blame] | 661 | * @param callback The video call callback. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 662 | */ |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 663 | public abstract void registerCallback(VideoCall.Callback callback); |
| 664 | |
| 665 | /** |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 666 | * Registers a callback to receive commands and state changes for video calls. |
| 667 | * |
| 668 | * @param callback The video call callback. |
| 669 | * @param handler A handler which commands and status changes will be delivered to. |
| 670 | */ |
| 671 | public abstract void registerCallback(VideoCall.Callback callback, Handler handler); |
| 672 | |
| 673 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 674 | * Clears the video call callback set via {@link #registerCallback}. |
Tyler Gunn | 295f5d7 | 2015-06-04 11:08:54 -0700 | [diff] [blame] | 675 | * |
| 676 | * @param callback The video call callback to clear. |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 677 | */ |
Andrew Lee | 011728f | 2015-04-23 15:47:06 -0700 | [diff] [blame] | 678 | public abstract void unregisterCallback(VideoCall.Callback callback); |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 679 | |
| 680 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 681 | * Sets the camera to be used for the outgoing video. |
| 682 | * <p> |
| 683 | * Handled by {@link Connection.VideoProvider#onSetCamera(String)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 684 | * |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 685 | * @param cameraId The id of the camera (use ids as reported by |
| 686 | * {@link CameraManager#getCameraIdList()}). |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 687 | */ |
| 688 | public abstract void setCamera(String cameraId); |
| 689 | |
| 690 | /** |
| 691 | * Sets the surface to be used for displaying a preview of what the user's camera is |
| 692 | * currently capturing. When video transmission is enabled, this is the video signal which |
| 693 | * is sent to the remote device. |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 694 | * <p> |
| 695 | * Handled by {@link Connection.VideoProvider#onSetPreviewSurface(Surface)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 696 | * |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 697 | * @param surface The {@link Surface}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 698 | */ |
| 699 | public abstract void setPreviewSurface(Surface surface); |
| 700 | |
| 701 | /** |
| 702 | * Sets the surface to be used for displaying the video received from the remote device. |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 703 | * <p> |
| 704 | * Handled by {@link Connection.VideoProvider#onSetDisplaySurface(Surface)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 705 | * |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 706 | * @param surface The {@link Surface}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 707 | */ |
| 708 | public abstract void setDisplaySurface(Surface surface); |
| 709 | |
| 710 | /** |
| 711 | * Sets the device orientation, in degrees. Assumes that a standard portrait orientation of |
| 712 | * the device is 0 degrees. |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 713 | * <p> |
| 714 | * Handled by {@link Connection.VideoProvider#onSetDeviceOrientation(int)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 715 | * |
| 716 | * @param rotation The device orientation, in degrees. |
| 717 | */ |
| 718 | public abstract void setDeviceOrientation(int rotation); |
| 719 | |
| 720 | /** |
| 721 | * Sets camera zoom ratio. |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 722 | * <p> |
| 723 | * Handled by {@link Connection.VideoProvider#onSetZoom(float)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 724 | * |
| 725 | * @param value The camera zoom ratio. |
| 726 | */ |
| 727 | public abstract void setZoom(float value); |
| 728 | |
| 729 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 730 | * Issues a request to modify the properties of the current video session. |
| 731 | * <p> |
| 732 | * Example scenarios include: requesting an audio-only call to be upgraded to a |
| 733 | * bi-directional video call, turning on or off the user's camera, sending a pause signal |
| 734 | * when the {@link InCallService} is no longer the foreground application. |
| 735 | * <p> |
| 736 | * Handled by |
| 737 | * {@link Connection.VideoProvider#onSendSessionModifyRequest(VideoProfile, VideoProfile)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 738 | * |
| 739 | * @param requestProfile The requested call video properties. |
| 740 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 741 | public abstract void sendSessionModifyRequest(VideoProfile requestProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 742 | |
| 743 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 744 | * Provides a response to a request to change the current call video session |
| 745 | * properties. This should be called in response to a request the {@link InCallService} has |
| 746 | * received via {@link VideoCall.Callback#onSessionModifyRequestReceived}. |
| 747 | * <p> |
| 748 | * Handled by |
| 749 | * {@link Connection.VideoProvider#onSendSessionModifyResponse(VideoProfile)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 750 | * |
| 751 | * @param responseProfile The response call video properties. |
| 752 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 753 | public abstract void sendSessionModifyResponse(VideoProfile responseProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 754 | |
| 755 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 756 | * Issues a request to the {@link Connection.VideoProvider} to retrieve the capabilities |
| 757 | * of the current camera. The current camera is selected using |
| 758 | * {@link VideoCall#setCamera(String)}. |
| 759 | * <p> |
| 760 | * Camera capabilities are reported to the caller via |
| 761 | * {@link VideoCall.Callback#onCameraCapabilitiesChanged(VideoProfile.CameraCapabilities)}. |
| 762 | * <p> |
| 763 | * Handled by {@link Connection.VideoProvider#onRequestCameraCapabilities()}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 764 | */ |
| 765 | public abstract void requestCameraCapabilities(); |
| 766 | |
| 767 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 768 | * Issues a request to the {@link Connection.VideoProvider} to retrieve the cumulative data |
| 769 | * usage for the video component of the current call (in bytes). Data usage is reported |
| 770 | * to the caller via {@link VideoCall.Callback#onCallDataUsageChanged}. |
| 771 | * <p> |
| 772 | * Handled by {@link Connection.VideoProvider#onRequestConnectionDataUsage()}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 773 | */ |
| 774 | public abstract void requestCallDataUsage(); |
| 775 | |
| 776 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 777 | * Provides the {@link Connection.VideoProvider} with the {@link Uri} of an image to be |
| 778 | * displayed to the peer device when the video signal is paused. |
| 779 | * <p> |
| 780 | * Handled by {@link Connection.VideoProvider#onSetPauseImage(Uri)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 781 | * |
| 782 | * @param uri URI of image to display. |
| 783 | */ |
Yorke Lee | 32f2473 | 2015-05-12 16:18:03 -0700 | [diff] [blame] | 784 | public abstract void setPauseImage(Uri uri); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 785 | |
| 786 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 787 | * The {@link InCallService} extends this class to provide a means of receiving callbacks |
Tyler Gunn | 295f5d7 | 2015-06-04 11:08:54 -0700 | [diff] [blame] | 788 | * from the {@link Connection.VideoProvider}. |
| 789 | * <p> |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 790 | * When the {@link InCallService} receives the |
| 791 | * {@link Call.Callback#onVideoCallChanged(Call, VideoCall)} callback, it should create an |
| 792 | * instance its {@link VideoCall.Callback} implementation and set it on the |
| 793 | * {@link VideoCall} using {@link VideoCall#registerCallback(Callback)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 794 | */ |
Andrew Lee | da80c87 | 2015-04-15 14:09:50 -0700 | [diff] [blame] | 795 | public static abstract class Callback { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 796 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 797 | * Called when the {@link Connection.VideoProvider} receives a session modification |
Tyler Gunn | 295f5d7 | 2015-06-04 11:08:54 -0700 | [diff] [blame] | 798 | * request from the peer device. |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 799 | * <p> |
| 800 | * The {@link InCallService} may potentially prompt the user to confirm whether they |
| 801 | * wish to accept the request, or decide to automatically accept the request. In either |
| 802 | * case the {@link InCallService} should call |
| 803 | * {@link VideoCall#sendSessionModifyResponse(VideoProfile)} to indicate the video |
| 804 | * profile agreed upon. |
| 805 | * <p> |
| 806 | * Callback originates from |
| 807 | * {@link Connection.VideoProvider#receiveSessionModifyRequest(VideoProfile)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 808 | * |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 809 | * @param videoProfile The requested video profile. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 810 | */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 811 | public abstract void onSessionModifyRequestReceived(VideoProfile videoProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 812 | |
| 813 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 814 | * Called when the {@link Connection.VideoProvider} receives a response to a session |
| 815 | * modification request previously sent to the peer device. |
| 816 | * <p> |
| 817 | * The new video state should not be considered active by the {@link InCallService} |
| 818 | * until the {@link Call} video state changes (the |
| 819 | * {@link Call.Callback#onDetailsChanged(Call, Call.Details)} callback is triggered |
| 820 | * when the video state changes). |
| 821 | * <p> |
| 822 | * Callback originates from |
| 823 | * {@link Connection.VideoProvider#receiveSessionModifyResponse(int, VideoProfile, |
| 824 | * VideoProfile)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 825 | * |
| 826 | * @param status Status of the session modify request. Valid values are |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 827 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, |
| 828 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, |
| 829 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID}, |
| 830 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT}, |
| 831 | * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE}. |
| 832 | * @param requestedProfile The original request which was sent to the peer device. |
| 833 | * @param responseProfile The actual profile changes made by the peer device. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 834 | */ |
| 835 | public abstract void onSessionModifyResponseReceived(int status, |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 836 | VideoProfile requestedProfile, VideoProfile responseProfile); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 837 | |
| 838 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 839 | * Handles events related to the current video session which the {@link InCallService} |
| 840 | * may wish to handle. These are separate from requested changes to the session due to |
| 841 | * the underlying protocol or connection. |
| 842 | * <p> |
| 843 | * Callback originates from |
| 844 | * {@link Connection.VideoProvider#handleCallSessionEvent(int)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 845 | * |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 846 | * @param event The event. Valid values are: |
| 847 | * {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE}, |
| 848 | * {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME}, |
| 849 | * {@link Connection.VideoProvider#SESSION_EVENT_TX_START}, |
| 850 | * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP}, |
| 851 | * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE}, |
Tyler Gunn | bf9c6fd | 2016-11-09 10:19:23 -0800 | [diff] [blame] | 852 | * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}, |
| 853 | * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_PERMISSION_ERROR}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 854 | */ |
| 855 | public abstract void onCallSessionEvent(int event); |
| 856 | |
| 857 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 858 | * Handles a change to the video dimensions from the peer device. This could happen if, |
| 859 | * for example, the peer changes orientation of their device, or switches cameras. |
| 860 | * <p> |
| 861 | * Callback originates from |
| 862 | * {@link Connection.VideoProvider#changePeerDimensions(int, int)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 863 | * |
| 864 | * @param width The updated peer video width. |
| 865 | * @param height The updated peer video height. |
| 866 | */ |
| 867 | public abstract void onPeerDimensionsChanged(int width, int height); |
| 868 | |
| 869 | /** |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 870 | * Handles a change to the video quality. |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 871 | * <p> |
| 872 | * Callback originates from {@link Connection.VideoProvider#changeVideoQuality(int)}. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 873 | * |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 874 | * @param videoQuality The updated peer video quality. Valid values: |
| 875 | * {@link VideoProfile#QUALITY_HIGH}, |
| 876 | * {@link VideoProfile#QUALITY_MEDIUM}, |
| 877 | * {@link VideoProfile#QUALITY_LOW}, |
| 878 | * {@link VideoProfile#QUALITY_DEFAULT}. |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 879 | */ |
| 880 | public abstract void onVideoQualityChanged(int videoQuality); |
| 881 | |
| 882 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 883 | * Handles an update to the total data used for the current video session. |
| 884 | * <p> |
| 885 | * Used by the {@link Connection.VideoProvider} in response to |
| 886 | * {@link VideoCall#requestCallDataUsage()}. May also be called periodically by the |
| 887 | * {@link Connection.VideoProvider}. |
| 888 | * <p> |
| 889 | * Callback originates from {@link Connection.VideoProvider#setCallDataUsage(long)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 890 | * |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 891 | * @param dataUsage The updated data usage (in bytes). |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 892 | */ |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 893 | public abstract void onCallDataUsageChanged(long dataUsage); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 894 | |
| 895 | /** |
Tyler Gunn | b702ef8 | 2015-05-29 11:51:53 -0700 | [diff] [blame] | 896 | * Handles a change in the capabilities of the currently selected camera. |
| 897 | * <p> |
| 898 | * Used by the {@link Connection.VideoProvider} in response to |
| 899 | * {@link VideoCall#requestCameraCapabilities()}. The {@link Connection.VideoProvider} |
| 900 | * may also report the camera capabilities after a call to |
| 901 | * {@link VideoCall#setCamera(String)}. |
| 902 | * <p> |
| 903 | * Callback originates from |
| 904 | * {@link Connection.VideoProvider#changeCameraCapabilities( |
| 905 | * VideoProfile.CameraCapabilities)}. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 906 | * |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 907 | * @param cameraCapabilities The changed camera capabilities. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 908 | */ |
Yorke Lee | 400470f | 2015-05-12 13:31:25 -0700 | [diff] [blame] | 909 | public abstract void onCameraCapabilitiesChanged( |
| 910 | VideoProfile.CameraCapabilities cameraCapabilities); |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 911 | } |
| 912 | } |
Sailesh Nepal | ab5d282 | 2014-03-08 18:01:06 -0800 | [diff] [blame] | 913 | } |