diff options
Diffstat (limited to 'java')
4 files changed, 16 insertions, 12 deletions
diff --git a/java/com/android/incallui/InCallPresenter.java b/java/com/android/incallui/InCallPresenter.java index ed7b2c290..6c1c13027 100644 --- a/java/com/android/incallui/InCallPresenter.java +++ b/java/com/android/incallui/InCallPresenter.java @@ -28,6 +28,7 @@ import android.support.annotation.Nullable; import android.support.annotation.VisibleForTesting; import android.support.v4.os.UserManagerCompat; import android.telecom.Call.Details; +import android.telecom.CallAudioState; import android.telecom.DisconnectCause; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; @@ -55,6 +56,7 @@ import com.android.dialer.telecom.TelecomUtil; import com.android.dialer.util.TouchPointManager; import com.android.incallui.InCallOrientationEventListener.ScreenOrientation; import com.android.incallui.answerproximitysensor.PseudoScreenState; +import com.android.incallui.audiomode.AudioModeProvider; import com.android.incallui.call.CallList; import com.android.incallui.call.DialerCall; import com.android.incallui.call.ExternalCallList; @@ -83,7 +85,7 @@ import java.util.concurrent.atomic.AtomicBoolean; * presenters that want to listen in on the in-call state changes. TODO: This class has become more * of a state machine at this point. Consider renaming. */ -public class InCallPresenter implements CallList.Listener { +public class InCallPresenter implements CallList.Listener, AudioModeProvider.AudioModeListener { private static final String PIXEL2017_SYSTEM_FEATURE = "com.google.android.feature.PIXEL_2017_EXPERIENCE"; private static final String EXTRA_FIRST_TIME_SHOWN = @@ -387,6 +389,8 @@ public class InCallPresenter implements CallList.Listener { .getSystemService(TelephonyManager.class) .listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); + AudioModeProvider.getInstance().addListener(this); + LogUtil.d("InCallPresenter.setUp", "Finished InCallPresenter.setUp"); Trace.endSection(); } @@ -410,6 +414,7 @@ public class InCallPresenter implements CallList.Listener { attemptCleanup(); VideoPauseController.getInstance().tearDown(); + AudioModeProvider.getInstance().removeListener(this); } private void attemptFinishActivity() { @@ -1720,6 +1725,13 @@ public class InCallPresenter implements CallList.Listener { } } + @Override + public void onAudioStateChanged(CallAudioState audioState) { + if (mStatusBarNotifier != null) { + mStatusBarNotifier.updateNotification(); + } + } + /** All the main states of InCallActivity. */ public enum InCallState { // InCall Screen is off and there are no calls diff --git a/java/com/android/incallui/StatusBarNotifier.java b/java/com/android/incallui/StatusBarNotifier.java index bb3ef4333..db416d861 100644 --- a/java/com/android/incallui/StatusBarNotifier.java +++ b/java/com/android/incallui/StatusBarNotifier.java @@ -94,7 +94,6 @@ import java.util.Objects; public class StatusBarNotifier implements InCallPresenter.InCallStateListener, EnrichedCallManager.StateChangedListener, - AudioModeProvider.AudioModeListener, ContactInfoCacheCallback { private static final int NOTIFICATION_ID = 1; @@ -136,7 +135,6 @@ public class StatusBarNotifier new InCallTonePlayer(new ToneGeneratorFactory(), new PausableExecutorImpl()), CallList.getInstance()); mCurrentNotification = NOTIFICATION_NONE; - AudioModeProvider.getInstance().addListener(this); Trace.endSection(); } @@ -1028,11 +1026,6 @@ public class StatusBarNotifier } @Override - public void onAudioStateChanged(CallAudioState audioState) { - updateNotification(); - } - - @Override @RequiresPermission(Manifest.permission.READ_PHONE_STATE) public void onContactInfoComplete(String callId, ContactCacheEntry entry) { DialerCall call = CallList.getInstance().getCallById(callId); diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java index 954dfcd8b..d254d6df6 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java @@ -134,6 +134,7 @@ public class ImsVideoCallCallback extends VideoCall.Callback { CLEAR_FAILED_REQUEST_TIMEOUT_MILLIS); } else if (videoTech.getSessionModificationState() == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { + requestedVideoState = VideoProfile.STATE_AUDIO_ONLY; videoTech.setSessionModificationState(SessionModificationState.NO_REQUEST); } else if (videoTech.getSessionModificationState() == SessionModificationState.WAITING_FOR_RESPONSE) { diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index 0310a90ac..17bad5588 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -20,6 +20,7 @@ import android.content.Context; import android.os.Build; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import android.telecom.Call; import android.telecom.Call.Details; import android.telecom.VideoProfile; @@ -38,7 +39,7 @@ public class ImsVideoTech implements VideoTech { private final LoggingBindings logger; private final Call call; private final VideoTechListener listener; - private ImsVideoCallCallback callback; + @VisibleForTesting ImsVideoCallCallback callback; private @SessionModificationState int sessionModificationState = SessionModificationState.NO_REQUEST; private int previousVideoState = VideoProfile.STATE_AUDIO_ONLY; @@ -188,7 +189,6 @@ public class ImsVideoTech implements VideoTech { Assert.checkArgument(requestedVideoState != VideoProfile.STATE_AUDIO_ONLY); LogUtil.i("ImsVideoTech.acceptUpgradeRequest", "videoState: " + requestedVideoState); call.getVideoCall().sendSessionModifyResponse(new VideoProfile(requestedVideoState)); - setSessionModificationState(SessionModificationState.NO_REQUEST); // Telecom manages audio route for us listener.onUpgradedToVideo(false /* switchToSpeaker */); logger.logImpression(DialerImpression.Type.IMS_VIDEO_REQUEST_ACCEPTED); @@ -198,7 +198,6 @@ public class ImsVideoTech implements VideoTech { public void acceptVideoRequestAsAudio() { LogUtil.enterBlock("ImsVideoTech.acceptVideoRequestAsAudio"); call.getVideoCall().sendSessionModifyResponse(new VideoProfile(VideoProfile.STATE_AUDIO_ONLY)); - setSessionModificationState(SessionModificationState.NO_REQUEST); logger.logImpression(DialerImpression.Type.IMS_VIDEO_REQUEST_ACCEPTED_AS_AUDIO); } @@ -207,7 +206,6 @@ public class ImsVideoTech implements VideoTech { LogUtil.enterBlock("ImsVideoTech.declineUpgradeRequest"); call.getVideoCall() .sendSessionModifyResponse(new VideoProfile(call.getDetails().getVideoState())); - setSessionModificationState(SessionModificationState.NO_REQUEST); logger.logImpression(DialerImpression.Type.IMS_VIDEO_REQUEST_DECLINED); } |