diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-08-31 16:17:04 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-08-31 16:17:04 +0000 |
commit | c39ea3c55fac807c0b98aabdf56c70dc8a49036c (patch) | |
tree | e282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/incallui/CallButtonPresenter.java | |
parent | 68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff) | |
parent | 2ca4318cc1ee57dda907ba2069bd61d162b1baef (diff) |
Merge "Update Dialer source to latest internal Google revision."
Diffstat (limited to 'java/com/android/incallui/CallButtonPresenter.java')
-rw-r--r-- | java/com/android/incallui/CallButtonPresenter.java | 56 |
1 files changed, 42 insertions, 14 deletions
diff --git a/java/com/android/incallui/CallButtonPresenter.java b/java/com/android/incallui/CallButtonPresenter.java index b0c3a99ea..658ae649b 100644 --- a/java/com/android/incallui/CallButtonPresenter.java +++ b/java/com/android/incallui/CallButtonPresenter.java @@ -18,6 +18,7 @@ package com.android.incallui; import android.content.Context; import android.os.Bundle; +import android.os.Trace; import android.support.v4.app.Fragment; import android.support.v4.os.UserManagerCompat; import android.telecom.CallAudioState; @@ -101,6 +102,7 @@ public class CallButtonPresenter @Override public void onStateChange(InCallState oldState, InCallState newState, CallList callList) { + Trace.beginSection("CallButtonPresenter.onStateChange"); if (newState == InCallState.OUTGOING) { mCall = callList.getOutgoingCall(); } else if (newState == InCallState.INCALL) { @@ -124,6 +126,7 @@ public class CallButtonPresenter mCall = null; } updateUi(newState, mCall); + Trace.endSection(); } /** @@ -249,11 +252,21 @@ public class CallButtonPresenter @Override public void mergeClicked() { + Logger.get(mContext) + .logCallImpression( + DialerImpression.Type.IN_CALL_MERGE_BUTTON_PRESSED, + mCall.getUniqueCallId(), + mCall.getTimeAddedMs()); TelecomAdapter.getInstance().merge(mCall.getId()); } @Override public void addCallClicked() { + Logger.get(mContext) + .logCallImpression( + DialerImpression.Type.IN_CALL_ADD_CALL_BUTTON_PRESSED, + mCall.getUniqueCallId(), + mCall.getTimeAddedMs()); // Automatically mute the current call mAutomaticallyMuted = true; mPreviousMuteState = AudioModeProvider.getInstance().getAudioState().isMuted(); @@ -264,6 +277,11 @@ public class CallButtonPresenter @Override public void showDialpadClicked(boolean checked) { + Logger.get(mContext) + .logCallImpression( + DialerImpression.Type.IN_CALL_SHOW_DIALPAD_BUTTON_PRESSED, + mCall.getUniqueCallId(), + mCall.getTimeAddedMs()); LogUtil.v("CallButtonPresenter", "show dialpad " + String.valueOf(checked)); getActivity().showDialpadFragment(checked /* show */, true /* animate */); } @@ -300,23 +318,15 @@ public class CallButtonPresenter */ @Override public void switchCameraClicked(boolean useFrontFacingCamera) { - InCallCameraManager cameraManager = InCallPresenter.getInstance().getInCallCameraManager(); - cameraManager.setUseFrontFacingCamera(useFrontFacingCamera); - - String cameraId = cameraManager.getActiveCameraId(); - if (cameraId != null) { - final int cameraDir = - cameraManager.isUsingFrontFacingCamera() - ? CameraDirection.CAMERA_DIRECTION_FRONT_FACING - : CameraDirection.CAMERA_DIRECTION_BACK_FACING; - mCall.setCameraDir(cameraDir); - mCall.getVideoTech().setCamera(cameraId); - } + updateCamera(useFrontFacingCamera); } @Override public void toggleCameraClicked() { LogUtil.i("CallButtonPresenter.toggleCameraClicked", ""); + if (mCall == null) { + return; + } Logger.get(mContext) .logCallImpression( DialerImpression.Type.IN_CALL_SCREEN_SWAP_CAMERA, @@ -345,8 +355,11 @@ public class CallButtonPresenter mCall.getTimeAddedMs()); if (pause) { + mCall.getVideoTech().setCamera(null); mCall.getVideoTech().stopTransmission(); } else { + updateCamera( + InCallPresenter.getInstance().getInCallCameraManager().isUsingFrontFacingCamera()); mCall.getVideoTech().resumeTransmission(); } @@ -354,8 +367,23 @@ public class CallButtonPresenter mInCallButtonUi.enableButton(InCallButtonIds.BUTTON_PAUSE_VIDEO, false); } + private void updateCamera(boolean useFrontFacingCamera) { + InCallCameraManager cameraManager = InCallPresenter.getInstance().getInCallCameraManager(); + cameraManager.setUseFrontFacingCamera(useFrontFacingCamera); + + String cameraId = cameraManager.getActiveCameraId(); + if (cameraId != null) { + final int cameraDir = + cameraManager.isUsingFrontFacingCamera() + ? CameraDirection.CAMERA_DIRECTION_FRONT_FACING + : CameraDirection.CAMERA_DIRECTION_BACK_FACING; + mCall.setCameraDir(cameraDir); + mCall.getVideoTech().setCamera(cameraId); + } + } + private void updateUi(InCallState state, DialerCall call) { - LogUtil.v("CallButtonPresenter", "updating call UI for call: ", call); + LogUtil.v("CallButtonPresenter", "updating call UI for call: %s", call); if (mInCallButtonUi == null) { return; @@ -404,7 +432,7 @@ public class CallButtonPresenter final boolean showMute = call.can(android.telecom.Call.Details.CAPABILITY_MUTE); final boolean hasCameraPermission = - isVideo && VideoUtils.hasCameraPermissionAndAllowedByUser(mContext); + isVideo && VideoUtils.hasCameraPermissionAndShownPrivacyToast(mContext); // Disabling local video doesn't seem to work when dialing. See b/30256571. final boolean showPauseVideo = isVideo |