diff options
author | Andrew Lee <anwlee@google.com> | 2014-08-01 20:48:34 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-08-01 20:48:34 +0000 |
commit | 94c85890542ab58f1a995369de27f2570938d123 (patch) | |
tree | 2c16d7b8272bf92e9a369c99a41589f5ea2e7aca /InCallUI | |
parent | 7d0d6843546cd988e2b305e87506a05cb3704fde (diff) | |
parent | bcded397d2f606258265464a09f2c49b7772812d (diff) |
am 70e91df3: am a112c5d7: am 4b0d8622: Change audio to speakerphone for video call.
* commit '70e91df39830b9e36f32d366a32f4d2b5ba831fd':
Change audio to speakerphone for video call.
Diffstat (limited to 'InCallUI')
-rw-r--r-- | InCallUI/src/com/android/incallui/CallCardPresenter.java | 22 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/VideoCallPresenter.java | 40 |
2 files changed, 25 insertions, 37 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java index e01a4bc07..99d7f33f1 100644 --- a/InCallUI/src/com/android/incallui/CallCardPresenter.java +++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java @@ -35,7 +35,6 @@ import android.telephony.TelephonyManager; import android.text.TextUtils; import android.text.format.DateUtils; -import com.android.incallui.AudioModeProvider.AudioModeListener; import com.android.incallui.ContactInfoCache.ContactCacheEntry; import com.android.incallui.ContactInfoCache.ContactInfoCacheCallback; import com.android.incallui.InCallPresenter.InCallDetailsListener; @@ -54,9 +53,8 @@ import com.google.common.base.Preconditions; * This class listens for changes to InCallState and passes it along to the fragment. */ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> - implements InCallStateListener, AudioModeListener, IncomingCallListener, - InCallDetailsListener, InCallEventListener, - InCallVideoCallListenerNotifier.SessionModificationListener { + implements InCallStateListener, IncomingCallListener, InCallDetailsListener, + InCallEventListener, InCallVideoCallListenerNotifier.SessionModificationListener { private static final String TAG = CallCardPresenter.class.getSimpleName(); private static final long CALL_TIME_UPDATE_INTERVAL_MS = 1000; @@ -129,8 +127,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> public void onUiReady(CallCardUi ui) { super.onUiReady(ui); - AudioModeProvider.getInstance().addListener(this); - // Contact search may have completed before ui is ready. if (mPrimaryContactInfo != null) { updatePrimaryDisplayInfo(mPrimaryContactInfo, isConference(mPrimary)); @@ -157,8 +153,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> InCallPresenter.getInstance().removeDetailsListener(this); InCallPresenter.getInstance().removeInCallEventListener(this); - AudioModeProvider.getInstance().removeListener(this); - mPrimary = null; mPrimaryContactInfo = null; mSecondaryContactInfo = null; @@ -343,18 +337,6 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi> getUi().setCallbackNumber(callbackNumber, isEmergencyCall); } - @Override - public void onAudioMode(int mode) { - } - - @Override - public void onSupportedAudioMode(int mask) { - } - - @Override - public void onMute(boolean muted) { - } - public void updateCallTime() { final CallCardUi ui = getUi(); diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java index 0aea18cd9..1d3e62b5b 100644 --- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java +++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java @@ -29,12 +29,14 @@ import android.content.res.Configuration; import android.telecomm.InCallService.VideoCall; import android.view.Surface; +import com.android.services.telephony.common.AudioMode; + import java.util.Objects; /** * Logic related to the {@link VideoCallFragment} and for managing changes to the video calling * surfaces based on other user interface events and incoming events from the - * {@class CallVideoClient}. + * {@class VideoCallListener}. * <p> * When a call's video state changes to bi-directional video, the * {@link com.android.incallui.VideoCallPresenter} performs the following negotiation with the @@ -164,7 +166,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi InCallPresenter.getInstance().addIncomingCallListener(this); InCallPresenter.getInstance().addOrientationListener(this); - // Register for surface and video events from {@link InCallVideoProvider}s. + // Register for surface and video events from {@link InCallVideoCallListener}s. InCallVideoCallListenerNotifier.getInstance().addSurfaceChangeListener(this); InCallVideoCallListenerNotifier.getInstance().addVideoEventListener(this); @@ -285,7 +287,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi @Override public void onStateChange(InCallPresenter.InCallState state, CallList callList) { if (state == InCallPresenter.InCallState.NO_CALLS) { - exitVideoState(); + exitVideoMode(); } // Determine the primary active call). @@ -303,16 +305,16 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi mPrimaryCall = primary; if (primary != null) { - checkForCallVideoProviderChange(); + checkForVideoCallChange(); mIsVideoCall = mPrimaryCall.isVideoCall(); if (mIsVideoCall) { - enterVideoState(); + enterVideoMode(); } else { - exitVideoState(); + exitVideoMode(); } } else if (primary == null) { // If no primary call, ensure we exit video state and clean up the video surfaces. - exitVideoState(); + exitVideoMode(); } } } @@ -335,9 +337,9 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi } /** - * Checks for a change to the call video provider and changes it if required. + * Checks for a change to the video call and changes it if required. */ - private void checkForCallVideoProviderChange() { + private void checkForVideoCallChange() { VideoCall videoCall = mPrimaryCall.getTelecommCall().getVideoCall(); if (!Objects.equals(videoCall, mVideoCall)) { changeVideoCall(videoCall); @@ -355,21 +357,21 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi mIsVideoCall = newVideoState; if (mIsVideoCall) { - enterVideoState(); + enterVideoMode(); } else { - exitVideoState(); + exitVideoMode(); } } } /** * Handles a change to the video call. Sets the surfaces on the previous call to null and sets - * the surfaces on the new provider accordingly. + * the surfaces on the new video call accordingly. * * @param videoCall The new video call. */ private void changeVideoCall(VideoCall videoCall) { - // Null out the surfaces on the previous provider + // Null out the surfaces on the previous video call. if (mVideoCall != null) { mVideoCall.setDisplaySurface(null); mVideoCall.setPreviewSurface(null); @@ -379,10 +381,10 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi } /** - * Enters video mode by showing the video surfaces. + * Enters video mode by showing the video surfaces and making other adjustments (eg. audio). * TODO(vt): Need to adjust size and orientation of preview surface here. */ - private void enterVideoState() { + private void enterVideoMode() { VideoCallUi ui = getUi(); if (ui == null) { return; @@ -407,18 +409,22 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi mVideoCall.setDisplaySurface(ui.getDisplayVideoSurface()); } } + + TelecommAdapter.getInstance().setAudioRoute(AudioMode.SPEAKER); } /** - * Exits video mode by hiding the video surfaces. + * Exits video mode by hiding the video surfaces and making other adjustments (eg. audio). */ - private void exitVideoState() { + private void exitVideoMode() { VideoCallUi ui = getUi(); if (ui == null) { return; } InCallPresenter.getInstance().setInCallAllowsOrientationChange(false); ui.showVideoUi(false); + + TelecommAdapter.getInstance().setAudioRoute(AudioMode.WIRED_OR_EARPIECE); } /** |