diff options
Diffstat (limited to 'java/com/android/incallui/videotech/lightbringer/LightbringerTech.java')
-rw-r--r-- | java/com/android/incallui/videotech/lightbringer/LightbringerTech.java | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java b/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java index 386afdc45..55ee2db21 100644 --- a/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java +++ b/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java @@ -17,10 +17,13 @@ package com.android.incallui.videotech.lightbringer; import android.content.Context; +import android.os.Build; import android.support.annotation.NonNull; +import android.support.annotation.Nullable; import android.telecom.Call; +import com.android.contacts.common.compat.telecom.TelecomManagerCompat; import com.android.dialer.common.Assert; -import com.android.dialer.common.ConfigProviderBindings; +import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.lightbringer.Lightbringer; import com.android.dialer.lightbringer.LightbringerListener; import com.android.incallui.video.protocol.VideoCallScreen; @@ -31,15 +34,18 @@ import com.android.incallui.videotech.utils.SessionModificationState; public class LightbringerTech implements VideoTech, LightbringerListener { private final Lightbringer lightbringer; private final VideoTechListener listener; + private final Call call; private final String callingNumber; private int callState = Call.STATE_NEW; public LightbringerTech( @NonNull Lightbringer lightbringer, @NonNull VideoTechListener listener, + @NonNull Call call, @NonNull String callingNumber) { this.lightbringer = Assert.isNotNull(lightbringer); this.listener = Assert.isNotNull(listener); + this.call = Assert.isNotNull(call); this.callingNumber = Assert.isNotNull(callingNumber); lightbringer.registerListener(this); @@ -47,10 +53,11 @@ public class LightbringerTech implements VideoTech, LightbringerListener { @Override public boolean isAvailable(Context context) { - return ConfigProviderBindings.get(context) - .getBoolean("enable_lightbringer_video_upgrade", false) + return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O + && ConfigProviderBindings.get(context).getBoolean("enable_lightbringer_video_upgrade", true) && callState == Call.STATE_ACTIVE - && lightbringer.isReachable(context, callingNumber); + && lightbringer.supportsUpgrade(context, callingNumber) + && TelecomManagerCompat.supportsHandover(); } @Override @@ -84,13 +91,16 @@ public class LightbringerTech implements VideoTech, LightbringerListener { } @Override + public void onRemovedFromCallList() {} + + @Override public int getSessionModificationState() { return SessionModificationState.NO_REQUEST; } @Override public void upgradeToVideo() { - // TODO: upgrade to a video call + lightbringer.requestUpgrade(call); } @Override @@ -124,17 +134,13 @@ public class LightbringerTech implements VideoTech, LightbringerListener { } @Override - public void pause() { - throw Assert.createUnsupportedOperationFailException(); - } + public void pause() {} @Override - public void unpause() { - throw Assert.createUnsupportedOperationFailException(); - } + public void unpause() {} @Override - public void setCamera(String cameraId) { + public void setCamera(@Nullable String cameraId) { throw Assert.createUnsupportedOperationFailException(); } |