InCallService.java revision f2600eb5aca1ec9bda2674d878528a770d5c220b
1ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal/* 2ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * Copyright (C) 2013 The Android Open Source Project 3ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * 4ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * Licensed under the Apache License, Version 2.0 (the "License"); 5ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * you may not use this file except in compliance with the License. 6ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * You may obtain a copy of the License at 7ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * 8ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * http://www.apache.org/licenses/LICENSE-2.0 9ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * 10ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * Unless required by applicable law or agreed to in writing, software 11ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * distributed under the License is distributed on an "AS IS" BASIS, 12ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * See the License for the specific language governing permissions and 14ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * limitations under the License. 15ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal */ 16ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 17ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunnpackage android.telecom; 18ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 192ac401093e5ebb975f14e5108d457c148370f7deTyler Gunnimport android.annotation.SdkConstant; 20a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordonimport android.annotation.SystemApi; 212f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordonimport android.app.Service; 222f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordonimport android.content.Intent; 23b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunnimport android.hardware.camera2.CameraManager; 2432f24731604fd81289a39619bbc925b65184b505Yorke Leeimport android.net.Uri; 25ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepalimport android.os.Handler; 26ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepalimport android.os.IBinder; 27ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepalimport android.os.Looper; 28ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepalimport android.os.Message; 2950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Leeimport android.view.Surface; 30ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 312f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awadimport com.android.internal.os.SomeArgs; 32ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunnimport com.android.internal.telecom.IInCallAdapter; 33ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunnimport com.android.internal.telecom.IInCallService; 34ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 3550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Leeimport java.lang.String; 36a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordonimport java.util.Collections; 37a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordonimport java.util.List; 3850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 39ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal/** 40ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * This service is implemented by any app that wishes to provide the user-interface for managing 41ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunn * phone calls. Telecom binds to this service while there exists a live (active or incoming) call, 42f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * and uses it to notify the in-call app of any live and recently disconnected calls. An app must 43f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * first be set as the default phone app (See {@link TelecomManager#getDefaultDialerPackage()}) 44f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * before the telecom service will bind to its {@code InCallService} implementation. 45f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * <p> 46f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * Below is an example manifest registration for an {@code InCallService}. The meta-data 47f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * ({@link TelecomManager#METADATA_IN_CALL_SERVICE_UI}) indicates that this particular 48f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * {@code InCallService} implementation intends to replace the built-in in-call UI. 49f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * <pre> 50f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * {@code 51f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * <service android:name="your.package.YourInCallServiceImplementation" 52f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * android:permission="android.permission.BIND_IN_CALL_SERVICE"> 53f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * <meta-data android:name="android.telecom.IN_CALL_SERVICE_UI" android:value="true" /> 54f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * <intent-filter> 55f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * <action android:name="android.telecom.InCallService"/> 56f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * </intent-filter> 57f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * </service> 58f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * } 59f2600eb5aca1ec9bda2674d878528a770d5c220bSantos Cordon * </pre> 60ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal */ 612f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordonpublic abstract class InCallService extends Service { 622ac401093e5ebb975f14e5108d457c148370f7deTyler Gunn 632ac401093e5ebb975f14e5108d457c148370f7deTyler Gunn /** 642ac401093e5ebb975f14e5108d457c148370f7deTyler Gunn * The {@link Intent} that must be declared as handled by the service. 652ac401093e5ebb975f14e5108d457c148370f7deTyler Gunn */ 662ac401093e5ebb975f14e5108d457c148370f7deTyler Gunn @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) 67ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunn public static final String SERVICE_INTERFACE = "android.telecom.InCallService"; 682ac401093e5ebb975f14e5108d457c148370f7deTyler Gunn 69ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal private static final int MSG_SET_IN_CALL_ADAPTER = 1; 70ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal private static final int MSG_ADD_CALL = 2; 716043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal private static final int MSG_UPDATE_CALL = 3; 725d0410fa7c2dead7906780551ba4aa0305021cefIhab Awad private static final int MSG_SET_POST_DIAL_WAIT = 4; 734af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 5; 745d0410fa7c2dead7906780551ba4aa0305021cefIhab Awad private static final int MSG_BRING_TO_FOREGROUND = 6; 756c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7; 76ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 77ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal /** Default Handler used to consolidate binder method calls onto a single thread. */ 78ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal private final Handler mHandler = new Handler(Looper.getMainLooper()) { 79ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal @Override 80ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal public void handleMessage(Message msg) { 815e6162de625dfda047ff390bbc1ccf9a97db2261Jay Shrauner if (mPhone == null && msg.what != MSG_SET_IN_CALL_ADAPTER) { 825e6162de625dfda047ff390bbc1ccf9a97db2261Jay Shrauner return; 835e6162de625dfda047ff390bbc1ccf9a97db2261Jay Shrauner } 845e6162de625dfda047ff390bbc1ccf9a97db2261Jay Shrauner 85ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal switch (msg.what) { 86ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal case MSG_SET_IN_CALL_ADAPTER: 87e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad mPhone = new Phone(new InCallAdapter((IInCallAdapter) msg.obj)); 88a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon mPhone.addListener(mPhoneListener); 89e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad onPhoneCreated(mPhone); 90ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal break; 91ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal case MSG_ADD_CALL: 9288b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon mPhone.internalAddCall((ParcelableCall) msg.obj); 93ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal break; 946043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal case MSG_UPDATE_CALL: 9588b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon mPhone.internalUpdateCall((ParcelableCall) msg.obj); 962f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad break; 972f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad case MSG_SET_POST_DIAL_WAIT: { 982f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad SomeArgs args = (SomeArgs) msg.obj; 992f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad try { 1002f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad String callId = (String) args.arg1; 1012f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad String remaining = (String) args.arg2; 102e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad mPhone.internalSetPostDialWait(callId, remaining); 1032f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad } finally { 1042f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad args.recycle(); 1052f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad } 1062f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad break; 1072f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad } 1084af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee case MSG_ON_CALL_AUDIO_STATE_CHANGED: 1094af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee mPhone.internalCallAudioStateChanged((CallAudioState) msg.obj); 110b632e5b122d82333c390cc334ab17100bc2af7a2Sailesh Nepal break; 1113534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon case MSG_BRING_TO_FOREGROUND: 112e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad mPhone.internalBringToForeground(msg.arg1 == 1); 1133534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon break; 1146c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon case MSG_ON_CAN_ADD_CALL_CHANGED: 1156c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon mPhone.internalSetCanAddCall(msg.arg1 == 1); 1166c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon break; 117ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal default: 118ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal break; 119ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal } 120ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal } 121ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal }; 122ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 123ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal /** Manages the binder calls so that the implementor does not need to deal with it. */ 124ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal private final class InCallServiceBinder extends IInCallService.Stub { 125ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal @Override 126ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal public void setInCallAdapter(IInCallAdapter inCallAdapter) { 127ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal mHandler.obtainMessage(MSG_SET_IN_CALL_ADAPTER, inCallAdapter).sendToTarget(); 128ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal } 129ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 130ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal @Override 13188b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon public void addCall(ParcelableCall call) { 1326043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal mHandler.obtainMessage(MSG_ADD_CALL, call).sendToTarget(); 133ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal } 134ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 135ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal @Override 13688b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon public void updateCall(ParcelableCall call) { 1376043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal mHandler.obtainMessage(MSG_UPDATE_CALL, call).sendToTarget(); 1382f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad } 1392f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad 1402f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad @Override 1412f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad public void setPostDial(String callId, String remaining) { 1425d0410fa7c2dead7906780551ba4aa0305021cefIhab Awad // TODO: Unused 1432f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad } 1442f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad 1452f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad @Override 1462f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad public void setPostDialWait(String callId, String remaining) { 1472f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad SomeArgs args = SomeArgs.obtain(); 1482f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad args.arg1 = callId; 1492f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad args.arg2 = remaining; 1502f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad mHandler.obtainMessage(MSG_SET_POST_DIAL_WAIT, args).sendToTarget(); 1512f23664b4fb9527f3b4e12843926ffe2220ea559Ihab Awad } 152b632e5b122d82333c390cc334ab17100bc2af7a2Sailesh Nepal 153b632e5b122d82333c390cc334ab17100bc2af7a2Sailesh Nepal @Override 1544af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee public void onCallAudioStateChanged(CallAudioState callAudioState) { 1554af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, callAudioState).sendToTarget(); 156b632e5b122d82333c390cc334ab17100bc2af7a2Sailesh Nepal } 1573534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon 1583534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon @Override 1593534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon public void bringToForeground(boolean showDialpad) { 1603534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon mHandler.obtainMessage(MSG_BRING_TO_FOREGROUND, showDialpad ? 1 : 0, 0).sendToTarget(); 1613534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon } 1626c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon 1636c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon @Override 1646c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon public void onCanAddCallChanged(boolean canAddCall) { 1656c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon mHandler.obtainMessage(MSG_ON_CAN_ADD_CALL_CHANGED, canAddCall ? 1 : 0, 0) 1666c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon .sendToTarget(); 1676c912b7d056c67b41fd46f31de168795e97c2336Santos Cordon } 168ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal } 169ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 170a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon private Phone.Listener mPhoneListener = new Phone.Listener() { 171a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** ${inheritDoc} */ 172a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @Override 173a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onAudioStateChanged(Phone phone, AudioState audioState) { 174a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon InCallService.this.onAudioStateChanged(audioState); 175a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 176a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 1774af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee public void onCallAudioStateChanged(Phone phone, CallAudioState callAudioState) { 1784af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee InCallService.this.onCallAudioStateChanged(callAudioState); 1794af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee }; 1804af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee 181a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** ${inheritDoc} */ 182a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @Override 183a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onBringToForeground(Phone phone, boolean showDialpad) { 184a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon InCallService.this.onBringToForeground(showDialpad); 185a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 186a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 187a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** ${inheritDoc} */ 188a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @Override 189a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onCallAdded(Phone phone, Call call) { 190a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon InCallService.this.onCallAdded(call); 191a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 192a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 193a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** ${inheritDoc} */ 194a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @Override 195a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onCallRemoved(Phone phone, Call call) { 196a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon InCallService.this.onCallRemoved(call); 197a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 198a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 199a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** ${inheritDoc} */ 200a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @Override 201a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onCanAddCallChanged(Phone phone, boolean canAddCall) { 202a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon InCallService.this.onCanAddCallChanged(canAddCall); 203a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 204a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 205a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon }; 206a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 207e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad private Phone mPhone; 208ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 2092f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon public InCallService() { 2102f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon } 211ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 2122f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon @Override 2132f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon public IBinder onBind(Intent intent) { 214e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad return new InCallServiceBinder(); 215924748fa3fc663c780c3fb21ec1332bd9757fcd2Evan Charlton } 216924748fa3fc663c780c3fb21ec1332bd9757fcd2Evan Charlton 217f30d7e9a8e8fa7e10068139decb0e7665381a686Santos Cordon @Override 218f30d7e9a8e8fa7e10068139decb0e7665381a686Santos Cordon public boolean onUnbind(Intent intent) { 219619b3c0d09ff01ca163601a22973a58fd13ca64cSantos Cordon if (mPhone != null) { 220619b3c0d09ff01ca163601a22973a58fd13ca64cSantos Cordon Phone oldPhone = mPhone; 221619b3c0d09ff01ca163601a22973a58fd13ca64cSantos Cordon mPhone = null; 222f30d7e9a8e8fa7e10068139decb0e7665381a686Santos Cordon 223619b3c0d09ff01ca163601a22973a58fd13ca64cSantos Cordon oldPhone.destroy(); 224a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon // destroy sets all the calls to disconnected if any live ones still exist. Therefore, 225a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon // it is important to remove the Listener *after* the call to destroy so that 226a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon // InCallService.on* callbacks are appropriately called. 227a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon oldPhone.removeListener(mPhoneListener); 228a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 229619b3c0d09ff01ca163601a22973a58fd13ca64cSantos Cordon onPhoneDestroyed(oldPhone); 230619b3c0d09ff01ca163601a22973a58fd13ca64cSantos Cordon } 231a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 232f30d7e9a8e8fa7e10068139decb0e7665381a686Santos Cordon return false; 233f30d7e9a8e8fa7e10068139decb0e7665381a686Santos Cordon } 234f30d7e9a8e8fa7e10068139decb0e7665381a686Santos Cordon 235924748fa3fc663c780c3fb21ec1332bd9757fcd2Evan Charlton /** 236e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * Obtain the {@code Phone} associated with this {@code InCallService}. 237ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * 238e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * @return The {@code Phone} object associated with this {@code InCallService}, or {@code null} 2392f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon * if the {@code InCallService} is not in a state where it has an associated 2402f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon * {@code Phone}. 241a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @hide 24229886d8571b703c4b9559d51421e8051bb1641c1Santos Cordon * @deprecated Use direct methods on InCallService instead of {@link Phone}. 243ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal */ 244a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @SystemApi 24529886d8571b703c4b9559d51421e8051bb1641c1Santos Cordon @Deprecated 24629886d8571b703c4b9559d51421e8051bb1641c1Santos Cordon public Phone getPhone() { 247e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad return mPhone; 248924748fa3fc663c780c3fb21ec1332bd9757fcd2Evan Charlton } 249ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal 250ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal /** 251a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Obtains the current list of {@code Call}s to be displayed by this in-call experience. 252a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 253a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @return A list of the relevant {@code Call}s. 254a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 255a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public final List<Call> getCalls() { 256a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon return mPhone == null ? Collections.<Call>emptyList() : mPhone.getCalls(); 257a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 258a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 259a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 260a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Returns if the device can support additional calls. 261a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 262a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @return Whether the phone supports adding more calls. 263a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 264a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public final boolean canAddCall() { 265a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon return mPhone == null ? false : mPhone.canAddCall(); 266a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 267a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 268a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 269a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Obtains the current phone call audio state. 270a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 271a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @return An object encapsulating the audio state. Returns null if the service is not 272a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * fully initialized. 2734af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * @deprecated Use {@link #getCallAudioState()} instead. 2744af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * @hide 275a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 2764af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee @Deprecated 277a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public final AudioState getAudioState() { 278a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon return mPhone == null ? null : mPhone.getAudioState(); 279a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 280a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 281a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 2824af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * Obtains the current phone call audio state. 2834af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * 2844af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * @return An object encapsulating the audio state. Returns null if the service is not 2854af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * fully initialized. 2864af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee */ 2874af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee public final CallAudioState getCallAudioState() { 2884af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee return mPhone == null ? null : mPhone.getCallAudioState(); 2894af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee } 2904af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee 2914af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee /** 292a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Sets the microphone mute state. When this request is honored, there will be change to 2934af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * the {@link #getCallAudioState()}. 294a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 295a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @param state {@code true} if the microphone should be muted; {@code false} otherwise. 296a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 297a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public final void setMuted(boolean state) { 298a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon if (mPhone != null) { 299a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon mPhone.setMuted(state); 300a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 301a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 302a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 303a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 304a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will 3054af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * be change to the {@link #getCallAudioState()}. 306a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 307a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @param route The audio route to use. 308a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 309a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public final void setAudioRoute(int route) { 310a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon if (mPhone != null) { 311a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon mPhone.setAudioRoute(route); 312a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 313a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 314a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 315a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 316e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * Invoked when the {@code Phone} has been created. This is a signal to the in-call experience 317e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * to start displaying in-call information to the user. Each instance of {@code InCallService} 3182f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon * will have only one {@code Phone}, and this method will be called exactly once in the lifetime 3192f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon * of the {@code InCallService}. 320b632e5b122d82333c390cc334ab17100bc2af7a2Sailesh Nepal * 321e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * @param phone The {@code Phone} object associated with this {@code InCallService}. 322a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @hide 32329886d8571b703c4b9559d51421e8051bb1641c1Santos Cordon * @deprecated Use direct methods on InCallService instead of {@link Phone}. 324b632e5b122d82333c390cc334ab17100bc2af7a2Sailesh Nepal */ 325a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @SystemApi 32629886d8571b703c4b9559d51421e8051bb1641c1Santos Cordon @Deprecated 3272f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon public void onPhoneCreated(Phone phone) { 3282f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon } 3293534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon 3303534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon /** 331e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * Invoked when a {@code Phone} has been destroyed. This is a signal to the in-call experience 332e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * to stop displaying in-call information to the user. This method will be called exactly once 333e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * in the lifetime of the {@code InCallService}, and it will always be called after a previous 334e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * call to {@link #onPhoneCreated(Phone)}. 3353534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon * 336e63fadb109ce52f9c357520074379aca0e3cb11dIhab Awad * @param phone The {@code Phone} object associated with this {@code InCallService}. 337a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @hide 33829886d8571b703c4b9559d51421e8051bb1641c1Santos Cordon * @deprecated Use direct methods on InCallService instead of {@link Phone}. 3393534ede5722b98c5be1526ba0bc2cd8acfbe0e55Santos Cordon */ 340a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon @SystemApi 34129886d8571b703c4b9559d51421e8051bb1641c1Santos Cordon @Deprecated 3422f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon public void onPhoneDestroyed(Phone phone) { 3432f42b11d40c631c471e03dc35f94ab32af45a9acSantos Cordon } 34450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 34550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 346a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Called when the audio state changes. 347a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 348a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @param audioState The new {@link AudioState}. 3494af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * @deprecated Use {@link #onCallAudioStateChanged(CallAudioState) instead}. 3504af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * @hide 351a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 3524af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee @Deprecated 353a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onAudioStateChanged(AudioState audioState) { 354a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 355a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 356a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 3574af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * Called when the audio state changes. 3584af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * 3594af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee * @param audioState The new {@link CallAudioState}. 3604af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee */ 3614af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee public void onCallAudioStateChanged(CallAudioState audioState) { 3624af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee } 3634af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee 3644af5935c71f1e31ef1aec27661c4ef60545a0924Yorke Lee /** 365a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Called to bring the in-call screen to the foreground. The in-call experience should 366a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * respond immediately by coming to the foreground to inform the user of the state of 367a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * ongoing {@code Call}s. 368a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 369a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @param showDialpad If true, put up the dialpad when the screen is shown. 370a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 371a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onBringToForeground(boolean showDialpad) { 372a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 373a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 374a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 375a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Called when a {@code Call} has been added to this in-call session. The in-call user 376a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * experience should add necessary state listeners to the specified {@code Call} and 377a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * immediately start to show the user information about the existence 378a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * and nature of this {@code Call}. Subsequent invocations of {@link #getCalls()} will 379a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * include this {@code Call}. 380a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 381a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @param call A newly added {@code Call}. 382a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 383a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onCallAdded(Call call) { 384a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 385a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 386a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 387a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Called when a {@code Call} has been removed from this in-call session. The in-call user 388a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * experience should remove any state listeners from the specified {@code Call} and 389a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * immediately stop displaying any information about this {@code Call}. 390a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Subsequent invocations of {@link #getCalls()} will no longer include this {@code Call}. 391a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 392a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @param call A newly removed {@code Call}. 393a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 394a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onCallRemoved(Call call) { 395a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 396a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 397a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 398a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * Called when the ability to add more calls changes. If the phone cannot 399a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * support more calls then {@code canAddCall} is set to {@code false}. If it can, then it 400a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * is set to {@code true}. This can be used to control the visibility of UI to add more calls. 401a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * 402a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon * @param canAddCall Indicates whether an additional call can be added. 403a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon */ 404a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon public void onCanAddCallChanged(boolean canAddCall) { 405a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon } 406a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon 407a2492810dfb0cd290b5466e33d5bdc5be4fb330eSantos Cordon /** 408b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Used to issue commands to the {@link Connection.VideoProvider} associated with a 409b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Call}. 41050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 41150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public static abstract class VideoCall { 41250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 413011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee /** @hide */ 414011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee public abstract void destroy(); 415011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee 41650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 4177c9ee2b0c59b7f215511c3c9000f71d5e902715aAndrew Lee * Registers a callback to receive commands and state changes for video calls. 41850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 4197c9ee2b0c59b7f215511c3c9000f71d5e902715aAndrew Lee * @param callback The video call callback. 42050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 421da80c870a8c6d796446c373db9c9a989ebf8a388Andrew Lee public abstract void registerCallback(VideoCall.Callback callback); 422da80c870a8c6d796446c373db9c9a989ebf8a388Andrew Lee 423da80c870a8c6d796446c373db9c9a989ebf8a388Andrew Lee /** 424011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee * Registers a callback to receive commands and state changes for video calls. 425011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee * 426011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee * @param callback The video call callback. 427011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee * @param handler A handler which commands and status changes will be delivered to. 428011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee */ 429011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee public abstract void registerCallback(VideoCall.Callback callback, Handler handler); 430011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee 431011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee /** 432b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Clears the video call callback set via {@link #registerCallback}. 433295f5d7777ba63836bf75cb4de15bdaae06dfc1fTyler Gunn * 434295f5d7777ba63836bf75cb4de15bdaae06dfc1fTyler Gunn * @param callback The video call callback to clear. 43575958420f2d294ceda517c2782b294002dc2969fTyler Gunn */ 436011728fc3a4368b601844d225d1f37bf48ea5735Andrew Lee public abstract void unregisterCallback(VideoCall.Callback callback); 43775958420f2d294ceda517c2782b294002dc2969fTyler Gunn 43875958420f2d294ceda517c2782b294002dc2969fTyler Gunn /** 439b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Sets the camera to be used for the outgoing video. 440b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 441b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onSetCamera(String)}. 44250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 443b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param cameraId The id of the camera (use ids as reported by 444b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link CameraManager#getCameraIdList()}). 44550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 44650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void setCamera(String cameraId); 44750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 44850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 44950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * Sets the surface to be used for displaying a preview of what the user's camera is 45050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * currently capturing. When video transmission is enabled, this is the video signal which 45150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * is sent to the remote device. 452b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 453b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onSetPreviewSurface(Surface)}. 45450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 455b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param surface The {@link Surface}. 45650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 45750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void setPreviewSurface(Surface surface); 45850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 45950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 46050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * Sets the surface to be used for displaying the video received from the remote device. 461b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 462b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onSetDisplaySurface(Surface)}. 46350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 464b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param surface The {@link Surface}. 46550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 46650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void setDisplaySurface(Surface surface); 46750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 46850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 46950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * Sets the device orientation, in degrees. Assumes that a standard portrait orientation of 47050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * the device is 0 degrees. 471b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 472b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onSetDeviceOrientation(int)}. 47350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 47450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param rotation The device orientation, in degrees. 47550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 47650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void setDeviceOrientation(int rotation); 47750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 47850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 47950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * Sets camera zoom ratio. 480b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 481b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onSetZoom(float)}. 48250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 48350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param value The camera zoom ratio. 48450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 48550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void setZoom(float value); 48650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 48750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 488b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Issues a request to modify the properties of the current video session. 489b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 490b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Example scenarios include: requesting an audio-only call to be upgraded to a 491b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * bi-directional video call, turning on or off the user's camera, sending a pause signal 492b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * when the {@link InCallService} is no longer the foreground application. 493b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 494b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by 495b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#onSendSessionModifyRequest(VideoProfile, VideoProfile)}. 49650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 49750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param requestProfile The requested call video properties. 49850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 499b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad public abstract void sendSessionModifyRequest(VideoProfile requestProfile); 50050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 50150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 502b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Provides a response to a request to change the current call video session 503b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * properties. This should be called in response to a request the {@link InCallService} has 504b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * received via {@link VideoCall.Callback#onSessionModifyRequestReceived}. 505b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 506b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by 507b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#onSendSessionModifyResponse(VideoProfile)}. 50850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 50950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param responseProfile The response call video properties. 51050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 511b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad public abstract void sendSessionModifyResponse(VideoProfile responseProfile); 51250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 51350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 514b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Issues a request to the {@link Connection.VideoProvider} to retrieve the capabilities 515b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * of the current camera. The current camera is selected using 516b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoCall#setCamera(String)}. 517b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 518b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Camera capabilities are reported to the caller via 519b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoCall.Callback#onCameraCapabilitiesChanged(VideoProfile.CameraCapabilities)}. 520b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 521b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onRequestCameraCapabilities()}. 52250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 52350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void requestCameraCapabilities(); 52450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 52550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 526b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Issues a request to the {@link Connection.VideoProvider} to retrieve the cumulative data 527b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * usage for the video component of the current call (in bytes). Data usage is reported 528b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * to the caller via {@link VideoCall.Callback#onCallDataUsageChanged}. 529b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 530b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onRequestConnectionDataUsage()}. 53150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 53250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void requestCallDataUsage(); 53350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 53450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 535b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Provides the {@link Connection.VideoProvider} with the {@link Uri} of an image to be 536b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * displayed to the peer device when the video signal is paused. 537b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 538b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handled by {@link Connection.VideoProvider#onSetPauseImage(Uri)}. 53950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 54050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param uri URI of image to display. 54150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 54232f24731604fd81289a39619bbc925b65184b505Yorke Lee public abstract void setPauseImage(Uri uri); 54350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 54450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 545b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * The {@link InCallService} extends this class to provide a means of receiving callbacks 546295f5d7777ba63836bf75cb4de15bdaae06dfc1fTyler Gunn * from the {@link Connection.VideoProvider}. 547295f5d7777ba63836bf75cb4de15bdaae06dfc1fTyler Gunn * <p> 548b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * When the {@link InCallService} receives the 549b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Call.Callback#onVideoCallChanged(Call, VideoCall)} callback, it should create an 550b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * instance its {@link VideoCall.Callback} implementation and set it on the 551b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoCall} using {@link VideoCall#registerCallback(Callback)}. 55250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 553da80c870a8c6d796446c373db9c9a989ebf8a388Andrew Lee public static abstract class Callback { 55450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 555b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Called when the {@link Connection.VideoProvider} receives a session modification 556295f5d7777ba63836bf75cb4de15bdaae06dfc1fTyler Gunn * request from the peer device. 557b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 558b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * The {@link InCallService} may potentially prompt the user to confirm whether they 559b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * wish to accept the request, or decide to automatically accept the request. In either 560b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * case the {@link InCallService} should call 561b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoCall#sendSessionModifyResponse(VideoProfile)} to indicate the video 562b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * profile agreed upon. 563b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 564b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Callback originates from 565b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#receiveSessionModifyRequest(VideoProfile)}. 56650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 567b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param videoProfile The requested video profile. 56850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 569b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad public abstract void onSessionModifyRequestReceived(VideoProfile videoProfile); 57050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 57150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 572b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Called when the {@link Connection.VideoProvider} receives a response to a session 573b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * modification request previously sent to the peer device. 574b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 575b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * The new video state should not be considered active by the {@link InCallService} 576b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * until the {@link Call} video state changes (the 577b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Call.Callback#onDetailsChanged(Call, Call.Details)} callback is triggered 578b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * when the video state changes). 579b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 580b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Callback originates from 581b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#receiveSessionModifyResponse(int, VideoProfile, 582b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * VideoProfile)}. 58350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 58450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param status Status of the session modify request. Valid values are 585b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_SUCCESS}, 586b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_FAIL}, 587b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_INVALID}, 588b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_TIMED_OUT}, 589b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE}. 590b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param requestedProfile The original request which was sent to the peer device. 591b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param responseProfile The actual profile changes made by the peer device. 59250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 59350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void onSessionModifyResponseReceived(int status, 594b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad VideoProfile requestedProfile, VideoProfile responseProfile); 59550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 59650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 597b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handles events related to the current video session which the {@link InCallService} 598b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * may wish to handle. These are separate from requested changes to the session due to 599b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * the underlying protocol or connection. 600b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 601b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Callback originates from 602b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#handleCallSessionEvent(int)}. 60350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 604b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param event The event. Valid values are: 605b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_EVENT_RX_PAUSE}, 606b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_EVENT_RX_RESUME}, 607b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_EVENT_TX_START}, 608b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_EVENT_TX_STOP}, 609b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_FAILURE}, 610b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#SESSION_EVENT_CAMERA_READY}. 61150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 61250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void onCallSessionEvent(int event); 61350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 61450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 615b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handles a change to the video dimensions from the peer device. This could happen if, 616b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * for example, the peer changes orientation of their device, or switches cameras. 617b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 618b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Callback originates from 619b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#changePeerDimensions(int, int)}. 62050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 62150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param width The updated peer video width. 62250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * @param height The updated peer video height. 62350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 62450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee public abstract void onPeerDimensionsChanged(int width, int height); 62550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 62650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 62707366813cdf3768dcd69a1f744023747564d654aRekha Kumar * Handles a change to the video quality. 628b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 629b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Callback originates from {@link Connection.VideoProvider#changeVideoQuality(int)}. 63007366813cdf3768dcd69a1f744023747564d654aRekha Kumar * 631b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param videoQuality The updated peer video quality. Valid values: 632b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoProfile#QUALITY_HIGH}, 633b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoProfile#QUALITY_MEDIUM}, 634b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoProfile#QUALITY_LOW}, 635b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoProfile#QUALITY_DEFAULT}. 63607366813cdf3768dcd69a1f744023747564d654aRekha Kumar */ 63707366813cdf3768dcd69a1f744023747564d654aRekha Kumar public abstract void onVideoQualityChanged(int videoQuality); 63807366813cdf3768dcd69a1f744023747564d654aRekha Kumar 63907366813cdf3768dcd69a1f744023747564d654aRekha Kumar /** 640b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handles an update to the total data used for the current video session. 641b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 642b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Used by the {@link Connection.VideoProvider} in response to 643b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoCall#requestCallDataUsage()}. May also be called periodically by the 644b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider}. 645b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 646b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Callback originates from {@link Connection.VideoProvider#setCallDataUsage(long)}. 64750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 648b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * @param dataUsage The updated data usage (in bytes). 64950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 65007366813cdf3768dcd69a1f744023747564d654aRekha Kumar public abstract void onCallDataUsageChanged(long dataUsage); 65150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee 65250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee /** 653b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Handles a change in the capabilities of the currently selected camera. 654b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 655b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Used by the {@link Connection.VideoProvider} in response to 656b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoCall#requestCameraCapabilities()}. The {@link Connection.VideoProvider} 657b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * may also report the camera capabilities after a call to 658b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link VideoCall#setCamera(String)}. 659b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * <p> 660b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * Callback originates from 661b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * {@link Connection.VideoProvider#changeCameraCapabilities( 662b702ef8a91c9adec68b11e36c50b89fd5bcbb607Tyler Gunn * VideoProfile.CameraCapabilities)}. 66350aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee * 664b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad * @param cameraCapabilities The changed camera capabilities. 66550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee */ 666400470fab932fe3374149ab89386e460ea161002Yorke Lee public abstract void onCameraCapabilitiesChanged( 667400470fab932fe3374149ab89386e460ea161002Yorke Lee VideoProfile.CameraCapabilities cameraCapabilities); 66850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee } 66950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee } 670ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal} 671