diff options
author | roldenburg <roldenburg@google.com> | 2017-10-09 20:17:32 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-10-09 20:17:32 +0000 |
commit | 3502faa3be78ddb2d5373af54d32b3a9969a2e7b (patch) | |
tree | f093da93b49eec5f3f3a6778526e7efda222a286 | |
parent | 18ee8219aaaae0c93e3696e1ae66e0f692756d8c (diff) | |
parent | 589db3a4b38d36bafed4c36423008ee060db4366 (diff) |
Merge "Partial revert of cl/170369554 to fix video call ringing screen"
am: 589db3a4b3
Change-Id: I36fd15a3ccf7fb43019f40519fbae58ae9f8cfa0
-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; } } |