diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-10-09 20:07:49 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-10-09 20:07:49 +0000 |
commit | 589db3a4b38d36bafed4c36423008ee060db4366 (patch) | |
tree | 3e7cd062edfe951a39705a75908e658c2f721f73 /java/com/android/incallui/call/DialerCall.java | |
parent | 63e639710cb131bf93699fc409299724ede9b473 (diff) | |
parent | 7bb9623e6be4c0e5e8a4b013af90dda7b1c574b8 (diff) |
Merge "Partial revert of cl/170369554 to fix video call ringing screen"
Diffstat (limited to 'java/com/android/incallui/call/DialerCall.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; } } |