diff options
author | Eric Erfanian <erfanian@google.com> | 2017-08-31 06:57:16 -0700 |
---|---|---|
committer | Eric Erfanian <erfanian@google.com> | 2017-08-31 16:13:53 +0000 |
commit | 2ca4318cc1ee57dda907ba2069bd61d162b1baef (patch) | |
tree | e282668a9587cf6c1ec7b604dea860400c75c6c7 /java/com/android/incallui/videotech/lightbringer/LightbringerTech.java | |
parent | 68038172793ee0e2ab3e2e56ddfbeb82879d1f58 (diff) |
Update Dialer source to latest internal Google revision.
Previously, Android's Dialer app was developed in an internal Google
source control system and only exported to public during AOSP drops.
The Dialer team is now switching to a public development model similar
to the telephony team.
This CL represents all internal Google changes that were committed to
Dialer between the public O release and today's tip of tree on internal
master. This CL squashes those changes into a single commit.
In subsequent changes, changes will be exported on a per-commit basis.
Test: make, flash install, run
Merged-In: I45270eaa8ce732d71a1bd84b08c7fa0e99af3160
Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8
PiperOrigin-RevId: 167068436
Diffstat (limited to 'java/com/android/incallui/videotech/lightbringer/LightbringerTech.java')
-rw-r--r-- | java/com/android/incallui/videotech/lightbringer/LightbringerTech.java | 59 |
1 files changed, 51 insertions, 8 deletions
diff --git a/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java b/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java index e49d0b84d..4882ba879 100644 --- a/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java +++ b/java/com/android/incallui/videotech/lightbringer/LightbringerTech.java @@ -17,11 +17,17 @@ 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.LogUtil; +import com.android.dialer.configprovider.ConfigProviderBindings; import com.android.dialer.lightbringer.Lightbringer; import com.android.dialer.lightbringer.LightbringerListener; +import com.android.dialer.logging.DialerImpression; import com.android.incallui.video.protocol.VideoCallScreen; import com.android.incallui.video.protocol.VideoCallScreenDelegate; import com.android.incallui.videotech.VideoTech; @@ -30,15 +36,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); @@ -46,7 +55,33 @@ public class LightbringerTech implements VideoTech, LightbringerListener { @Override public boolean isAvailable(Context context) { - return callState == Call.STATE_ACTIVE && lightbringer.isReachable(context, callingNumber); + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { + LogUtil.v("LightbringerTech.isAvailable", "upgrade unavailable, only supported on O+"); + return false; + } + + if (!ConfigProviderBindings.get(context) + .getBoolean("enable_lightbringer_video_upgrade", true)) { + LogUtil.v("LightbringerTech.isAvailable", "upgrade disabled by flag"); + return false; + } + + if (callState != Call.STATE_ACTIVE) { + LogUtil.v("LightbringerTech.isAvailable", "upgrade unavailable, call must be active"); + return false; + } + + if (!TelecomManagerCompat.supportsHandover()) { + LogUtil.v("LightbringerTech.isAvailable", "upgrade unavailable, telephony support missing"); + return false; + } + + if (!lightbringer.supportsUpgrade(context, callingNumber)) { + LogUtil.v("LightbringerTech.isAvailable", "upgrade unavailable, number does not support it"); + return false; + } + + return true; } @Override @@ -80,13 +115,19 @@ public class LightbringerTech implements VideoTech, LightbringerListener { } @Override + public void onRemovedFromCallList() { + lightbringer.unregisterListener(this); + } + + @Override public int getSessionModificationState() { return SessionModificationState.NO_REQUEST; } @Override public void upgradeToVideo() { - // TODO: upgrade to a video call + listener.onImpressionLoggingNeeded(DialerImpression.Type.LIGHTBRINGER_UPGRADE_REQUESTED); + lightbringer.requestUpgrade(call); } @Override @@ -120,18 +161,20 @@ public class LightbringerTech implements VideoTech, LightbringerListener { } @Override - public void pause() { - throw Assert.createUnsupportedOperationFailException(); - } + public void pause() {} + + @Override + public void unpause() {} @Override - public void unpause() { + public void setCamera(@Nullable String cameraId) { throw Assert.createUnsupportedOperationFailException(); } @Override - public void setCamera(String cameraId) { - throw Assert.createUnsupportedOperationFailException(); + public void becomePrimary() { + listener.onImpressionLoggingNeeded( + DialerImpression.Type.UPGRADE_TO_VIDEO_CALL_BUTTON_SHOWN_FOR_LIGHTBRINGER); } @Override |