diff options
author | roldenburg <roldenburg@google.com> | 2017-10-09 10:32:05 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-10-09 11:32:15 -0700 |
commit | 7bb9623e6be4c0e5e8a4b013af90dda7b1c574b8 (patch) | |
tree | 3e7cd062edfe951a39705a75908e658c2f721f73 /java | |
parent | 63e639710cb131bf93699fc409299724ede9b473 (diff) |
Partial revert of cl/170369554 to fix video call ringing screen
Tracking bug to fix the refactoring: http://b/67512378
Bug: 67470678
Test: manual
PiperOrigin-RevId: 171553078
Change-Id: Ib83e4240d6024347f97d246f9b526c3ccbf02057
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index d393b4211..2511bb8ca 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -153,7 +153,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa // Times when a second call is received but AnswerAndRelease button is not shown // since it's not supported. private int secondCallWithoutAnswerAndReleasedButtonTimes = 0; - private VideoTech videoTech = new EmptyVideoTech(); + private VideoTech videoTech; private com.android.dialer.logging.VideoTech.Type selectedAvailableVideoTechType = com.android.dialer.logging.VideoTech.Type.NONE; @@ -452,15 +452,10 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa private void update() { Trace.beginSection("DialerCall.update"); int oldState = getState(); + // Clear any cache here that could potentially change on update. + videoTech = null; // We want to potentially register a video call callback here. updateFromTelecomCall(); - // Only store the first video tech type found to be available during the life of the call. - if (selectedAvailableVideoTechType == com.android.dialer.logging.VideoTech.Type.NONE) { - // Update the video tech. - videoTech = mVideoTechManager.findBestAvailableVideoTech(); - videoTech.becomePrimary(); - selectedAvailableVideoTechType = videoTech.getVideoTechType(); - } if (oldState != getState() && getState() == DialerCall.State.DISCONNECTED) { for (DialerCallListener listener : mListeners) { listener.onDialerCallDisconnect(); @@ -1166,6 +1161,15 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa } public VideoTech getVideoTech() { + if (videoTech == null) { + videoTech = mVideoTechManager.getVideoTech(); + + // Only store the first video tech type found to be available during the life of the call. + if (selectedAvailableVideoTechType == com.android.dialer.logging.VideoTech.Type.NONE) { + // Update the video tech. + selectedAvailableVideoTechType = videoTech.getVideoTechType(); + } + } return videoTech; } @@ -1538,6 +1542,7 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa private final Context context; private final EmptyVideoTech emptyVideoTech = new EmptyVideoTech(); private final List<VideoTech> videoTechs; + private VideoTech savedTech; VideoTechManager(DialerCall call) { this.context = call.mContext; @@ -1570,10 +1575,17 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa phoneNumber)); } - VideoTech findBestAvailableVideoTech() { + VideoTech getVideoTech() { + if (savedTech != null) { + return savedTech; + } + for (VideoTech tech : videoTechs) { if (tech.isAvailable(context)) { - return tech; + // Remember the first VideoTech that becomes available and always use it + savedTech = tech; + savedTech.becomePrimary(); + return savedTech; } } |