1241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng/* 2241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * Copyright (C) 2013 The Android Open Source Project 3241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * 4241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * Licensed under the Apache License, Version 2.0 (the "License"); 5241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * you may not use this file except in compliance with the License. 6241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * You may obtain a copy of the License at 7241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * 8241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * http://www.apache.org/licenses/LICENSE-2.0 9241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * 10241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * Unless required by applicable law or agreed to in writing, software 11241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * distributed under the License is distributed on an "AS IS" BASIS, 12241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * See the License for the specific language governing permissions and 14241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * limitations under the License 15241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng */ 16241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng 17241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Chengpackage com.android.incallui; 18241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng 19c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Leeimport static com.android.incallui.CallButtonFragment.Buttons.*; 20c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee 2135224e8ff0e3707b92626767f048f1bf83352a2dTyler Gunnimport android.content.Context; 226cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Leeimport android.os.Bundle; 230206f6201db40deaa9af1057179aaec85c809dceYorke Leeimport android.telecom.CallAudioState; 246cddf46812634fadc194830774110780f14e9462Tyler Gunnimport android.telecom.InCallService.VideoCall; 256cddf46812634fadc194830774110780f14e9462Tyler Gunnimport android.telecom.VideoProfile; 265bcdca79b692712ff8a5a7e3e1c282f4d73cdf1cSailesh Nepal 27dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordonimport com.android.incallui.AudioModeProvider.AudioModeListener; 288bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumarimport com.android.incallui.InCallCameraManager.Listener; 29ba4e858e872fe446f3a7a17321289d025a40a847Santos Cordonimport com.android.incallui.InCallPresenter.CanAddCallListener; 30671b221ccadea34fb9327ef5342b26419eb5ca99Santos Cordonimport com.android.incallui.InCallPresenter.InCallState; 31671b221ccadea34fb9327ef5342b26419eb5ca99Santos Cordonimport com.android.incallui.InCallPresenter.InCallStateListener; 32c155f799fc0d4a2c9577f1e0688a3f1f5b436aefChristine Chenimport com.android.incallui.InCallPresenter.IncomingCallListener; 33eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunnimport com.android.incallui.InCallPresenter.InCallDetailsListener; 34671b221ccadea34fb9327ef5342b26419eb5ca99Santos Cordon 35eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunnimport java.util.Objects; 36eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn 37241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng/** 38241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng * Logic for call buttons. 39241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng */ 40150a5c58c67f230c8fd7293b180bbf50aa761480Santos Cordonpublic class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButtonUi> 41eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn implements InCallStateListener, AudioModeListener, IncomingCallListener, 428bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar InCallDetailsListener, CanAddCallListener, Listener { 43241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng 446cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee private static final String KEY_AUTOMATICALLY_MUTED = "incall_key_automatically_muted"; 456cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee private static final String KEY_PREVIOUS_MUTE_STATE = "incall_key_previous_mute_state"; 466cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee 47671b221ccadea34fb9327ef5342b26419eb5ca99Santos Cordon private Call mCall; 48e08284ea58e98666e6f1b45734d9901de91c2bb4Yorke Lee private boolean mAutomaticallyMuted = false; 49e08284ea58e98666e6f1b45734d9901de91c2bb4Yorke Lee private boolean mPreviousMuteState = false; 502ce872d6f7dd8a7eb0275b4195336f779972f698Makoto Onuki 519de3d7c5188c02cabf03799f87d494ee7dc702cbSantos Cordon public CallButtonPresenter() { 52241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng } 53241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng 54241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng @Override 55241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng public void onUiReady(CallButtonUi ui) { 56241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng super.onUiReady(ui); 578b6c8d0dbfba6eabe3d835f8cdcec8a13e253d0cChiao Cheng 58b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon AudioModeProvider.getInstance().addListener(this); 59b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon 60b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon // register for call state changes last 61ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee final InCallPresenter inCallPresenter = InCallPresenter.getInstance(); 62ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee inCallPresenter.addListener(this); 63ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee inCallPresenter.addIncomingCallListener(this); 64ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee inCallPresenter.addDetailsListener(this); 65ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee inCallPresenter.addCanAddCallListener(this); 66ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee inCallPresenter.getInCallCameraManager().addCameraSelectionListener(this); 67ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee 68ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee // Update the buttons state immediately for the current call 69ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee onStateChange(InCallState.NO_CALLS, inCallPresenter.getInCallState(), 70ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee CallList.getInstance()); 71dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 72dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 73dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon @Override 74dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon public void onUiUnready(CallButtonUi ui) { 7522c678c74fa38e921ea22b09962062fce6148047Christine Chen super.onUiUnready(ui); 7622c678c74fa38e921ea22b09962062fce6148047Christine Chen 77b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon InCallPresenter.getInstance().removeListener(this); 78b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon AudioModeProvider.getInstance().removeListener(this); 79c155f799fc0d4a2c9577f1e0688a3f1f5b436aefChristine Chen InCallPresenter.getInstance().removeIncomingCallListener(this); 80eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn InCallPresenter.getInstance().removeDetailsListener(this); 818bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar InCallPresenter.getInstance().getInCallCameraManager().removeCameraSelectionListener(this); 82a5d3e4421cd604395fc4c997233994e78579fe31Wei Huang InCallPresenter.getInstance().removeCanAddCallListener(this); 83241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng } 84241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng 85150a5c58c67f230c8fd7293b180bbf50aa761480Santos Cordon @Override 86f3d0654f2b6d77b7eef8bdcb4c39ee59e55017deNancy Chen public void onStateChange(InCallState oldState, InCallState newState, CallList callList) { 8755e998472730cae27a82eed49cf7b020699b9286Christine Chen CallButtonUi ui = getUi(); 889be240faad1857e122614a70fd6e632b143ddc41Christine Chen 89f3d0654f2b6d77b7eef8bdcb4c39ee59e55017deNancy Chen if (newState == InCallState.OUTGOING) { 90e7be13fb0556e62b07bc271b130412d82d7f7521Santos Cordon mCall = callList.getOutgoingCall(); 91f3d0654f2b6d77b7eef8bdcb4c39ee59e55017deNancy Chen } else if (newState == InCallState.INCALL) { 92efd4282ec4221ec5eefd4155a4ad915adcedca70Santos Cordon mCall = callList.getActiveOrBackgroundCall(); 932ce872d6f7dd8a7eb0275b4195336f779972f698Makoto Onuki 942ce872d6f7dd8a7eb0275b4195336f779972f698Makoto Onuki // When connected to voice mail, automatically shows the dialpad. 952ce872d6f7dd8a7eb0275b4195336f779972f698Makoto Onuki // (On previous releases we showed it when in-call shows up, before waiting for 962ce872d6f7dd8a7eb0275b4195336f779972f698Makoto Onuki // OUTGOING. We may want to do that once we start showing "Voice mail" label on 972ce872d6f7dd8a7eb0275b4195336f779972f698Makoto Onuki // the dialpad too.) 9855e998472730cae27a82eed49cf7b020699b9286Christine Chen if (ui != null) { 9904318a393b5492fb72d6edafca588e6b25ad752cNancy Chen if (oldState == InCallState.OUTGOING && mCall != null) { 10004318a393b5492fb72d6edafca588e6b25ad752cNancy Chen if (CallerInfoUtils.isVoiceMailNumber(ui.getContext(), mCall)) { 10104318a393b5492fb72d6edafca588e6b25ad752cNancy Chen ui.displayDialpad(true /* show */, true /* animate */); 10204318a393b5492fb72d6edafca588e6b25ad752cNancy Chen } 10355e998472730cae27a82eed49cf7b020699b9286Christine Chen } 1042ce872d6f7dd8a7eb0275b4195336f779972f698Makoto Onuki } 105f3d0654f2b6d77b7eef8bdcb4c39ee59e55017deNancy Chen } else if (newState == InCallState.INCOMING) { 10655e998472730cae27a82eed49cf7b020699b9286Christine Chen if (ui != null) { 10781bcf2a2e1c197655cf4a3aaf7d9af8088cf102eSai Cheemalapati ui.displayDialpad(false /* show */, true /* animate */); 10855e998472730cae27a82eed49cf7b020699b9286Christine Chen } 109ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee mCall = callList.getIncomingCall(); 110671b221ccadea34fb9327ef5342b26419eb5ca99Santos Cordon } else { 111671b221ccadea34fb9327ef5342b26419eb5ca99Santos Cordon mCall = null; 112671b221ccadea34fb9327ef5342b26419eb5ca99Santos Cordon } 113f3d0654f2b6d77b7eef8bdcb4c39ee59e55017deNancy Chen updateUi(newState, mCall); 114241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng } 115241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng 116eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn /** 117eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * Updates the user interface in response to a change in the details of a call. 118eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * Currently handles changes to the call buttons in response to a change in the details for a 119eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * call. This is important to ensure changes to the active call are reflected in the available 120eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * buttons. 121eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * 122eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * @param call The active call. 123eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * @param details The call details. 124eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn */ 125eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn @Override 126eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn public void onDetailsChanged(Call call, android.telecom.Call.Details details) { 12750ccc0c6cbfc1fce25ada87da13f4e974612d2a8Jay Shrauner // Only update if the changes are for the currently active call 12850ccc0c6cbfc1fce25ada87da13f4e974612d2a8Jay Shrauner if (getUi() != null && call != null && call.equals(mCall)) { 129ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee updateButtonsState(call); 130eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn } 131eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn } 132eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn 133dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon @Override 134f3d0654f2b6d77b7eef8bdcb4c39ee59e55017deNancy Chen public void onIncomingCall(InCallState oldState, InCallState newState, Call call) { 135f3d0654f2b6d77b7eef8bdcb4c39ee59e55017deNancy Chen onStateChange(oldState, newState, CallList.getInstance()); 136c155f799fc0d4a2c9577f1e0688a3f1f5b436aefChristine Chen } 137c155f799fc0d4a2c9577f1e0688a3f1f5b436aefChristine Chen 138c155f799fc0d4a2c9577f1e0688a3f1f5b436aefChristine Chen @Override 139ba4e858e872fe446f3a7a17321289d025a40a847Santos Cordon public void onCanAddCallChanged(boolean canAddCall) { 140cbaa95b644b24c57ad998e4c3296815de58060d5Santos Cordon if (getUi() != null && mCall != null) { 141ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee updateButtonsState(mCall); 142ba4e858e872fe446f3a7a17321289d025a40a847Santos Cordon } 143ba4e858e872fe446f3a7a17321289d025a40a847Santos Cordon } 144ba4e858e872fe446f3a7a17321289d025a40a847Santos Cordon 145ba4e858e872fe446f3a7a17321289d025a40a847Santos Cordon @Override 146dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon public void onAudioMode(int mode) { 1478b6c8d0dbfba6eabe3d835f8cdcec8a13e253d0cChiao Cheng if (getUi() != null) { 1488b6c8d0dbfba6eabe3d835f8cdcec8a13e253d0cChiao Cheng getUi().setAudio(mode); 1498b6c8d0dbfba6eabe3d835f8cdcec8a13e253d0cChiao Cheng } 150dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 151dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 152dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon @Override 153dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon public void onSupportedAudioMode(int mask) { 1548b6c8d0dbfba6eabe3d835f8cdcec8a13e253d0cChiao Cheng if (getUi() != null) { 1558b6c8d0dbfba6eabe3d835f8cdcec8a13e253d0cChiao Cheng getUi().setSupportedAudio(mask); 1568b6c8d0dbfba6eabe3d835f8cdcec8a13e253d0cChiao Cheng } 157dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 158dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 1593e69e4fe0e6dbce738cc6b3f9a71fc177e9fe1b6Santos Cordon @Override 1603e69e4fe0e6dbce738cc6b3f9a71fc177e9fe1b6Santos Cordon public void onMute(boolean muted) { 1617154c3df1cd121a61b8fdd51f6e936be735c4e2bAndrew Lee if (getUi() != null && !mAutomaticallyMuted) { 1623e69e4fe0e6dbce738cc6b3f9a71fc177e9fe1b6Santos Cordon getUi().setMute(muted); 1633e69e4fe0e6dbce738cc6b3f9a71fc177e9fe1b6Santos Cordon } 1643e69e4fe0e6dbce738cc6b3f9a71fc177e9fe1b6Santos Cordon } 1653e69e4fe0e6dbce738cc6b3f9a71fc177e9fe1b6Santos Cordon 166dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon public int getAudioMode() { 167b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon return AudioModeProvider.getInstance().getAudioMode(); 168dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 169dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 170dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon public int getSupportedAudio() { 171b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon return AudioModeProvider.getInstance().getSupportedModes(); 172dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 173dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 174dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon public void setAudioMode(int mode) { 175dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 176dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon // TODO: Set a intermediate state in this presenter until we get 177dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon // an update for onAudioMode(). This will make UI response immediate 178dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon // if it turns out to be slow 179dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 1800206f6201db40deaa9af1057179aaec85c809dceYorke Lee Log.d(this, "Sending new Audio Mode: " + CallAudioState.audioRouteToString(mode)); 1816cddf46812634fadc194830774110780f14e9462Tyler Gunn TelecomAdapter.getInstance().setAudioRoute(mode); 182dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 183dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 184dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon /** 185dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon * Function assumes that bluetooth is not supported. 186dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon */ 187dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon public void toggleSpeakerphone() { 188dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon // this function should not be called if bluetooth is available 1890206f6201db40deaa9af1057179aaec85c809dceYorke Lee if (0 != (CallAudioState.ROUTE_BLUETOOTH & getSupportedAudio())) { 190dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 1919de3d7c5188c02cabf03799f87d494ee7dc702cbSantos Cordon // It's clear the UI is wrong, so update the supported mode once again. 1921a7f2bcab2d2023f2ee4cfb0bc57bc265b5aab87Chiao Cheng Log.e(this, "toggling speakerphone not allowed when bluetooth supported."); 1939de3d7c5188c02cabf03799f87d494ee7dc702cbSantos Cordon getUi().setSupportedAudio(getSupportedAudio()); 194dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon return; 195dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 196dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 1970206f6201db40deaa9af1057179aaec85c809dceYorke Lee int newMode = CallAudioState.ROUTE_SPEAKER; 198dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 199dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon // if speakerphone is already on, change to wired/earpiece 2000206f6201db40deaa9af1057179aaec85c809dceYorke Lee if (getAudioMode() == CallAudioState.ROUTE_SPEAKER) { 2010206f6201db40deaa9af1057179aaec85c809dceYorke Lee newMode = CallAudioState.ROUTE_WIRED_OR_EARPIECE; 202dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 203dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 204dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon setAudioMode(newMode); 205dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon } 206dab149c9b2185be82cbca63cc3980e41444900c0Santos Cordon 207241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng public void muteClicked(boolean checked) { 2081a7f2bcab2d2023f2ee4cfb0bc57bc265b5aab87Chiao Cheng Log.d(this, "turning on mute: " + checked); 2096cddf46812634fadc194830774110780f14e9462Tyler Gunn TelecomAdapter.getInstance().mute(checked); 210241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng } 211241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng 2128193bc3df6b0726d36a5b7b889ec91c4d59f40c1Santos Cordon public void holdClicked(boolean checked) { 213e286f91abd12dee037de19c3836d8002e450a9c9Santos Cordon if (mCall == null) { 214e286f91abd12dee037de19c3836d8002e450a9c9Santos Cordon return; 215e286f91abd12dee037de19c3836d8002e450a9c9Santos Cordon } 216fc22ba88566ef70e202128335231c367de6c52afSailesh Nepal if (checked) { 217fc22ba88566ef70e202128335231c367de6c52afSailesh Nepal Log.i(this, "Putting the call on hold: " + mCall); 2186cddf46812634fadc194830774110780f14e9462Tyler Gunn TelecomAdapter.getInstance().holdCall(mCall.getId()); 219fc22ba88566ef70e202128335231c367de6c52afSailesh Nepal } else { 220fc22ba88566ef70e202128335231c367de6c52afSailesh Nepal Log.i(this, "Removing the call from hold: " + mCall); 2216cddf46812634fadc194830774110780f14e9462Tyler Gunn TelecomAdapter.getInstance().unholdCall(mCall.getId()); 2220e7d8b3f2a18171087b3fe4aa9cc3bf4449ad5b3Yorke Lee } 2238193bc3df6b0726d36a5b7b889ec91c4d59f40c1Santos Cordon } 2248193bc3df6b0726d36a5b7b889ec91c4d59f40c1Santos Cordon 22552c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon public void swapClicked() { 22652c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon if (mCall == null) { 22752c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon return; 22852c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon } 22952c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon 23052c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon Log.i(this, "Swapping the call: " + mCall); 2316cddf46812634fadc194830774110780f14e9462Tyler Gunn TelecomAdapter.getInstance().swap(mCall.getId()); 23252c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon } 23352c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon 23461b7737bc556865097f9ca846bddb562371013fdSantos Cordon public void mergeClicked() { 2356cddf46812634fadc194830774110780f14e9462Tyler Gunn TelecomAdapter.getInstance().merge(mCall.getId()); 23661b7737bc556865097f9ca846bddb562371013fdSantos Cordon } 23761b7737bc556865097f9ca846bddb562371013fdSantos Cordon 23861b7737bc556865097f9ca846bddb562371013fdSantos Cordon public void addCallClicked() { 239e08284ea58e98666e6f1b45734d9901de91c2bb4Yorke Lee // Automatically mute the current call 240e08284ea58e98666e6f1b45734d9901de91c2bb4Yorke Lee mAutomaticallyMuted = true; 241b0d08a16da088e01f416f52a7b74ee9630c1493aSantos Cordon mPreviousMuteState = AudioModeProvider.getInstance().getMute(); 242a485665ec253f0a04cf7e411cb7acc2738196c63Yorke Lee // Simulate a click on the mute button 243a485665ec253f0a04cf7e411cb7acc2738196c63Yorke Lee muteClicked(true); 2446cddf46812634fadc194830774110780f14e9462Tyler Gunn TelecomAdapter.getInstance().addCall(); 24561b7737bc556865097f9ca846bddb562371013fdSantos Cordon } 24661b7737bc556865097f9ca846bddb562371013fdSantos Cordon 247746ee736f255772f7da308765fab22ba7512a10eAndrew Lee public void changeToVoiceClicked() { 248230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee VideoCall videoCall = mCall.getVideoCall(); 249230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee if (videoCall == null) { 250746ee736f255772f7da308765fab22ba7512a10eAndrew Lee return; 251746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 252746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 25343f3e6e0760ea774e479935733d8a30b724457cdIhab Awad VideoProfile videoProfile = new VideoProfile( 254b586ec8d0896edf5f22099cb64f01cc046010b91Yorke Lee VideoProfile.STATE_AUDIO_ONLY, VideoProfile.QUALITY_DEFAULT); 25543f3e6e0760ea774e479935733d8a30b724457cdIhab Awad videoCall.sendSessionModifyRequest(videoProfile); 256746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 257746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 2585b9034b5b1b48a4339dd2f893a851cc64d6279dfChristine Chen public void showDialpadClicked(boolean checked) { 2591a7f2bcab2d2023f2ee4cfb0bc57bc265b5aab87Chiao Cheng Log.v(this, "Show dialpad " + String.valueOf(checked)); 26081bcf2a2e1c197655cf4a3aaf7d9af8088cf102eSai Cheemalapati getUi().displayDialpad(checked /* show */, true /* animate */); 2615b9034b5b1b48a4339dd2f893a851cc64d6279dfChristine Chen } 2625b9034b5b1b48a4339dd2f893a851cc64d6279dfChristine Chen 26344d96c276009952b67b43ed54d27d920f8dc2b4dTyler Gunn public void changeToVideoClicked() { 264230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee VideoCall videoCall = mCall.getVideoCall(); 265230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee if (videoCall == null) { 266746ee736f255772f7da308765fab22ba7512a10eAndrew Lee return; 267746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 26844d96c276009952b67b43ed54d27d920f8dc2b4dTyler Gunn int currVideoState = mCall.getVideoState(); 26944d96c276009952b67b43ed54d27d920f8dc2b4dTyler Gunn int currUnpausedVideoState = CallUtils.getUnPausedVideoState(currVideoState); 270b586ec8d0896edf5f22099cb64f01cc046010b91Yorke Lee currUnpausedVideoState |= VideoProfile.STATE_BIDIRECTIONAL; 271746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 27244d96c276009952b67b43ed54d27d920f8dc2b4dTyler Gunn VideoProfile videoProfile = new VideoProfile(currUnpausedVideoState); 27343f3e6e0760ea774e479935733d8a30b724457cdIhab Awad videoCall.sendSessionModifyRequest(videoProfile); 274709236f18f3153d41303872cf22481b9be005a6cMatthieu Baglin mCall.setSessionModificationState(Call.SessionModificationState.WAITING_FOR_RESPONSE); 275746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 276746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 277746ee736f255772f7da308765fab22ba7512a10eAndrew Lee /** 278746ee736f255772f7da308765fab22ba7512a10eAndrew Lee * Switches the camera between the front-facing and back-facing camera. 279746ee736f255772f7da308765fab22ba7512a10eAndrew Lee * @param useFrontFacingCamera True if we should switch to using the front-facing camera, or 280746ee736f255772f7da308765fab22ba7512a10eAndrew Lee * false if we should switch to using the back-facing camera. 281746ee736f255772f7da308765fab22ba7512a10eAndrew Lee */ 282746ee736f255772f7da308765fab22ba7512a10eAndrew Lee public void switchCameraClicked(boolean useFrontFacingCamera) { 2830455402172610400a220a95e3ad8a93302a80f15Tyler Gunn InCallCameraManager cameraManager = InCallPresenter.getInstance().getInCallCameraManager(); 2840455402172610400a220a95e3ad8a93302a80f15Tyler Gunn cameraManager.setUseFrontFacingCamera(useFrontFacingCamera); 285746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 286230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee VideoCall videoCall = mCall.getVideoCall(); 287230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee if (videoCall == null) { 288746ee736f255772f7da308765fab22ba7512a10eAndrew Lee return; 289746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 290746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 2910455402172610400a220a95e3ad8a93302a80f15Tyler Gunn String cameraId = cameraManager.getActiveCameraId(); 292746ee736f255772f7da308765fab22ba7512a10eAndrew Lee if (cameraId != null) { 2938bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar final int cameraDir = cameraManager.isUsingFrontFacingCamera() 2948bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar ? Call.VideoSettings.CAMERA_DIRECTION_FRONT_FACING 2958bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar : Call.VideoSettings.CAMERA_DIRECTION_BACK_FACING; 2968bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar mCall.getVideoSettings().setCameraDir(cameraDir); 297230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee videoCall.setCamera(cameraId); 298181c11e0668ac892df10a897cd05505b342dcdc3Tyler Gunn videoCall.requestCameraCapabilities(); 299746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 300746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 301746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 3028bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar 303746ee736f255772f7da308765fab22ba7512a10eAndrew Lee /** 304746ee736f255772f7da308765fab22ba7512a10eAndrew Lee * Stop or start client's video transmission. 305746ee736f255772f7da308765fab22ba7512a10eAndrew Lee * @param pause True if pausing the local user's video, or false if starting the local user's 306746ee736f255772f7da308765fab22ba7512a10eAndrew Lee * video. 307746ee736f255772f7da308765fab22ba7512a10eAndrew Lee */ 308746ee736f255772f7da308765fab22ba7512a10eAndrew Lee public void pauseVideoClicked(boolean pause) { 309230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee VideoCall videoCall = mCall.getVideoCall(); 310230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee if (videoCall == null) { 311746ee736f255772f7da308765fab22ba7512a10eAndrew Lee return; 312746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 313746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 314746ee736f255772f7da308765fab22ba7512a10eAndrew Lee if (pause) { 315230f77ec8e790f70b0c4a475e69566c049c97a06Andrew Lee videoCall.setCamera(null); 31643f3e6e0760ea774e479935733d8a30b724457cdIhab Awad VideoProfile videoProfile = new VideoProfile( 317b586ec8d0896edf5f22099cb64f01cc046010b91Yorke Lee mCall.getVideoState() & ~VideoProfile.STATE_TX_ENABLED); 31843f3e6e0760ea774e479935733d8a30b724457cdIhab Awad videoCall.sendSessionModifyRequest(videoProfile); 319746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } else { 3200455402172610400a220a95e3ad8a93302a80f15Tyler Gunn InCallCameraManager cameraManager = InCallPresenter.getInstance(). 3210455402172610400a220a95e3ad8a93302a80f15Tyler Gunn getInCallCameraManager(); 3220455402172610400a220a95e3ad8a93302a80f15Tyler Gunn videoCall.setCamera(cameraManager.getActiveCameraId()); 32343f3e6e0760ea774e479935733d8a30b724457cdIhab Awad VideoProfile videoProfile = new VideoProfile( 324b586ec8d0896edf5f22099cb64f01cc046010b91Yorke Lee mCall.getVideoState() | VideoProfile.STATE_TX_ENABLED); 32543f3e6e0760ea774e479935733d8a30b724457cdIhab Awad videoCall.sendSessionModifyRequest(videoProfile); 3261a723f1586c812510bd0791a4ef8420d36f83cf9Tyler Gunn mCall.setSessionModificationState(Call.SessionModificationState.WAITING_FOR_RESPONSE); 327746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 328c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee getUi().setVideoPaused(pause); 329746ee736f255772f7da308765fab22ba7512a10eAndrew Lee } 330746ee736f255772f7da308765fab22ba7512a10eAndrew Lee 331bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon private void updateUi(InCallState state, Call call) { 33289fbf5c95d0f0ed345c5e5b251ead1c519144c88Andrew Lee Log.d(this, "Updating call UI for call: ", call); 33389fbf5c95d0f0ed345c5e5b251ead1c519144c88Andrew Lee 334bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon final CallButtonUi ui = getUi(); 335bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon if (ui == null) { 336bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon return; 337bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon } 338bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon 33989fbf5c95d0f0ed345c5e5b251ead1c519144c88Andrew Lee final boolean isEnabled = 34089fbf5c95d0f0ed345c5e5b251ead1c519144c88Andrew Lee state.isConnectingOrConnected() &&!state.isIncoming() && call != null; 34118db3795cd475434ee28841de75b3d85eab5fa57Ben Gilad ui.setEnabled(isEnabled); 34261b7737bc556865097f9ca846bddb562371013fdSantos Cordon 343ef05a480504fe3570550e83a5afb160bd9e49672Yorke Lee if (call == null) { 34489fbf5c95d0f0ed345c5e5b251ead1c519144c88Andrew Lee return; 34546c57f18a63d5923b0b93f1988a56bb4beb9cc5dChristine Chen } 34689fbf5c95d0f0ed345c5e5b251ead1c519144c88Andrew Lee 347ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee updateButtonsState(call); 3488bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar } 3498bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar 350eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn /** 351eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * Updates the buttons applicable for the UI. 352eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * 353eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn * @param call The active call. 354eb36b967255d32039b769ba0c78e982e988f7c1dTyler Gunn */ 355ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee private void updateButtonsState(Call call) { 35644d96c276009952b67b43ed54d27d920f8dc2b4dTyler Gunn Log.v(this, "updateButtonsState"); 3572b138f87f439c7fbc45e8e9e760af187e22725bcAndrew Lee final CallButtonUi ui = getUi(); 3582b138f87f439c7fbc45e8e9e760af187e22725bcAndrew Lee 359ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee final boolean isVideo = CallUtils.isVideoCall(call); 36052c30ebe11e132c5b00a15aabdf4a411355bf0f4Santos Cordon 361ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee // Common functionality (audio, hold, etc). 362b07ea6f65496c02b693bcc71524decc2011807d2Andrew Lee // Show either HOLD or SWAP, but not both. If neither HOLD or SWAP is available: 363b07ea6f65496c02b693bcc71524decc2011807d2Andrew Lee // (1) If the device normally can hold, show HOLD in a disabled state. 364ddb824ecb3f052551b3ea97d5f5cb3037ec4c683Andrew Lee // (2) If the device doesn't have the concept of hold/swap, remove the button. 365ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee final boolean showSwap = call.can( 366737f56760b617688aac7218021a5e615ed750810Ihab Awad android.telecom.Call.Details.CAPABILITY_SWAP_CONFERENCE); 367ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee final boolean showHold = !showSwap 368ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee && call.can(android.telecom.Call.Details.CAPABILITY_SUPPORT_HOLD) 369ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee && call.can(android.telecom.Call.Details.CAPABILITY_HOLD); 370ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee final boolean isCallOnHold = call.getState() == Call.State.ONHOLD; 371ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee 372ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee final boolean showAddCall = TelecomAdapter.getInstance().canAddCall(); 373ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee final boolean showMerge = call.can( 374ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee android.telecom.Call.Details.CAPABILITY_MERGE_CONFERENCE); 37544d96c276009952b67b43ed54d27d920f8dc2b4dTyler Gunn final boolean showUpgradeToVideo = !isVideo && 37603973468ef36ae02827c38698bde4fb772c2cb79Yorke Lee (call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL_TX) 37703973468ef36ae02827c38698bde4fb772c2cb79Yorke Lee && call.can(android.telecom.Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE_RX)); 378ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee 379ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee final boolean showMute = call.can(android.telecom.Call.Details.CAPABILITY_MUTE); 380ddb824ecb3f052551b3ea97d5f5cb3037ec4c683Andrew Lee 381ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_AUDIO, true); 382ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_SWAP, showSwap); 383ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_HOLD, showHold); 384e1d1225e90cb9f7f62c837baa1b2aa17f5fab119Andrew Lee ui.setHold(isCallOnHold); 385ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_MUTE, showMute); 386ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_ADD_CALL, showAddCall); 38703973468ef36ae02827c38698bde4fb772c2cb79Yorke Lee ui.showButton(BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo); 388ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_SWITCH_CAMERA, isVideo); 389ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_PAUSE_VIDEO, isVideo); 390ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_DIALPAD, !isVideo); 391ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.showButton(BUTTON_MERGE, showMerge); 392ddb824ecb3f052551b3ea97d5f5cb3037ec4c683Andrew Lee 393ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee ui.updateButtonStates(); 394bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon } 395bc168c4fb0638846c5076a5a35a2e75ee4947908Santos Cordon 396eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen public void refreshMuteState() { 397eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen // Restore the previous mute state 398eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen if (mAutomaticallyMuted && 399eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen AudioModeProvider.getInstance().getMute() != mPreviousMuteState) { 400eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen if (getUi() == null) { 401eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen return; 402eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen } 403eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen muteClicked(mPreviousMuteState); 404eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen } 405eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen mAutomaticallyMuted = false; 406eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen } 407eb7244f3001ca3b001b17bda99ab5c790eb1b2d3Christine Chen 4086cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee @Override 4096cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee public void onSaveInstanceState(Bundle outState) { 4106cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee super.onSaveInstanceState(outState); 4116cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee outState.putBoolean(KEY_AUTOMATICALLY_MUTED, mAutomaticallyMuted); 4126cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee outState.putBoolean(KEY_PREVIOUS_MUTE_STATE, mPreviousMuteState); 4136cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee } 4146cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee 4156cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee @Override 4166cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee public void onRestoreInstanceState(Bundle savedInstanceState) { 4176cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee mAutomaticallyMuted = 4186cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee savedInstanceState.getBoolean(KEY_AUTOMATICALLY_MUTED, mAutomaticallyMuted); 4196cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee mPreviousMuteState = 4206cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee savedInstanceState.getBoolean(KEY_PREVIOUS_MUTE_STATE, mPreviousMuteState); 4216cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee super.onRestoreInstanceState(savedInstanceState); 4226cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee } 4236cc6c432d98d552913862a6b663dc4d5dad5c145Yorke Lee 424241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng public interface CallButtonUi extends Ui { 425c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee void showButton(int buttonId, boolean show); 426c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee void enableButton(int buttonId, boolean enable); 42718db3795cd475434ee28841de75b3d85eab5fa57Ben Gilad void setEnabled(boolean on); 428241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng void setMute(boolean on); 4298193bc3df6b0726d36a5b7b889ec91c4d59f40c1Santos Cordon void setHold(boolean on); 430c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee void setCameraSwitched(boolean isBackFacingCamera); 431c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee void setVideoPaused(boolean isPaused); 432c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee void setAudio(int mode); 433c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee void setSupportedAudio(int mask); 43481bcf2a2e1c197655cf4a3aaf7d9af8088cf102eSai Cheemalapati void displayDialpad(boolean on, boolean animate); 4350f09a02be361d5bb36fac6981649204f5d6987faChristine Chen boolean isDialpadVisible(); 436ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee 437ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee /** 438ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee * Once showButton() has been called on each of the individual buttons in the UI, call 439ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee * this to configure the overflow menu appropriately. 440ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee */ 441ed0775d4fcb79868b5e86456bc757ca5f0158d91Yorke Lee void updateButtonStates(); 44235224e8ff0e3707b92626767f048f1bf83352a2dTyler Gunn Context getContext(); 443241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng } 4448bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar 4458bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar @Override 4468bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar public void onActiveCameraSelectionChanged(boolean isUsingFrontFacingCamera) { 4478bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar if (getUi() == null) { 4488bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar return; 4498bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar } 450c70a63cff0d305a9b20c37098b54f7a4cc845522Yorke Lee getUi().setCameraSwitched(!isUsingFrontFacingCamera); 4518bef461247ec597f4fbbc604ee6e37fbdbc27d1eRekha Kumar } 452241d50d5f523eb0b644d8a9c1cf7fd2eb418ab88Chiao Cheng} 453