diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-01-10 00:20:06 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-01-10 00:20:06 +0000 |
commit | e428c77d2c47ff975d3585666fe70fd45d08a3e3 (patch) | |
tree | 2a3f62b230500a564791f9ed84217a3b2db24c73 /java/com/android/incallui | |
parent | ca19e2a139c6f3ffb279718efb2c540c0a8eb5e8 (diff) | |
parent | d7490db984a6a84efd7ef58328c2abde4a031aeb (diff) |
Merge "Let RCS Video Share take over Duo as the active video tech for a call"
Diffstat (limited to 'java/com/android/incallui')
-rw-r--r-- | java/com/android/incallui/call/DialerCall.java | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/java/com/android/incallui/call/DialerCall.java b/java/com/android/incallui/call/DialerCall.java index 5d71d0aac..dd7535e20 100644 --- a/java/com/android/incallui/call/DialerCall.java +++ b/java/com/android/incallui/call/DialerCall.java @@ -1635,13 +1635,17 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa } } - private static class VideoTechManager { + /** Coordinates the available VideoTech implementations for a call. */ + @VisibleForTesting + public static class VideoTechManager { private final Context context; private final EmptyVideoTech emptyVideoTech = new EmptyVideoTech(); + private final VideoTech rcsVideoShare; private final List<VideoTech> videoTechs; private VideoTech savedTech; - VideoTechManager(DialerCall call) { + @VisibleForTesting + public VideoTechManager(DialerCall call) { this.context = call.context; String phoneNumber = call.getNumber(); @@ -1653,40 +1657,47 @@ public class DialerCall implements VideoTechListener, StateChangedListener, Capa videoTechs.add(new ImsVideoTech(Logger.get(call.context), call, call.telecomCall)); - VideoTech rcsVideoTech = + rcsVideoShare = EnrichedCallComponent.get(call.context) .getRcsVideoShareFactory() .newRcsVideoShare( EnrichedCallComponent.get(call.context).getEnrichedCallManager(), call, phoneNumber); - if (rcsVideoTech != null) { - videoTechs.add(rcsVideoTech); + if (rcsVideoShare != null) { + videoTechs.add(rcsVideoShare); } videoTechs.add( new DuoVideoTech( DuoComponent.get(call.context).getDuo(), call, call.telecomCall, phoneNumber)); - } - VideoTech getVideoTech() { - if (savedTech != null) { - return savedTech; - } + savedTech = emptyVideoTech; + } - for (VideoTech tech : videoTechs) { - if (tech.isAvailable(context)) { - // Remember the first VideoTech that becomes available and always use it - savedTech = tech; - savedTech.becomePrimary(); - return savedTech; + @VisibleForTesting + public VideoTech getVideoTech() { + if (savedTech == emptyVideoTech) { + for (VideoTech tech : videoTechs) { + if (tech.isAvailable(context)) { + savedTech = tech; + savedTech.becomePrimary(); + break; + } } + } else if (savedTech instanceof DuoVideoTech && rcsVideoShare.isAvailable(context)) { + // RCS Video Share will become available after the capability exchange which is slower than + // Duo reading local contacts for reachability. If Video Share becomes available and we are + // not in the middle of any session changes, let it take over. + savedTech = rcsVideoShare; + rcsVideoShare.becomePrimary(); } - return emptyVideoTech; + return savedTech; } - void dispatchCallStateChanged(int newState) { + @VisibleForTesting + public void dispatchCallStateChanged(int newState) { for (VideoTech videoTech : videoTechs) { videoTech.onCallStateChanged(context, newState); } |