summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroldenburg <roldenburg@google.com>2018-01-09 13:51:29 -0800
committerCopybara-Service <copybara-piper@google.com>2018-01-09 15:51:16 -0800
commitd7490db984a6a84efd7ef58328c2abde4a031aeb (patch)
tree2a3f62b230500a564791f9ed84217a3b2db24c73
parentca19e2a139c6f3ffb279718efb2c540c0a8eb5e8 (diff)
Let RCS Video Share take over Duo as the active video tech for a call
Bug: 67005309 Test: VideoTechManagerTest PiperOrigin-RevId: 181368613 Change-Id: I8a13bd04d3ac342a06febb7437a0e0dd3d25affd
-rw-r--r--java/com/android/dialer/app/res/values-v27/styles.xml23
-rw-r--r--java/com/android/incallui/call/DialerCall.java47
2 files changed, 52 insertions, 18 deletions
diff --git a/java/com/android/dialer/app/res/values-v27/styles.xml b/java/com/android/dialer/app/res/values-v27/styles.xml
new file mode 100644
index 000000000..5a946b6a0
--- /dev/null
+++ b/java/com/android/dialer/app/res/values-v27/styles.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2017 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+<resources>
+ <style name="DialtactsTheme" parent="DialtactsThemeBase">
+ <item name="android:windowLightNavigationBar">true</item>
+ <item name="android:navigationBarColor">?android:windowBackground</item>
+ <item name="android:navigationBarDividerColor">#E0E0E0</item>
+ </style>
+</resources>
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);
}