diff options
author | roldenburg <roldenburg@google.com> | 2017-06-23 10:50:03 -0700 |
---|---|---|
committer | Usman Abdullah <uabdullah@google.com> | 2017-06-23 13:23:31 -0700 |
commit | 9b9fcc08d21054fc322f0936aebc90c31b51389c (patch) | |
tree | d9a66016b8eaaaa18275f8cc8fa14b03ae56dd09 /java | |
parent | 02d5c178016f94bb3da1349e325d3cc2ce7fc11d (diff) |
Ensure IMS video calling is enabled before offering video upgrade
By not checking CallUtil.isVideoEnabled, we were offering upgrading even after the user had disabled it.
I also tried to make the isAvailable method a bit more readable.
PiperOrigin-RevId: 159966735
Change-Id: Ibf828a561654e0e9521a6d86ad18269da426bba4
Diffstat (limited to 'java')
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoTech.java | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index 3d73e4e7d..4e7443960 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -27,6 +27,7 @@ import com.android.dialer.common.Assert; import com.android.dialer.common.LogUtil; import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.LoggingBindings; +import com.android.dialer.util.CallUtil; import com.android.incallui.video.protocol.VideoCallScreen; import com.android.incallui.video.protocol.VideoCallScreenDelegate; import com.android.incallui.videotech.VideoTech; @@ -56,12 +57,31 @@ public class ImsVideoTech implements VideoTech { return false; } - boolean hasCapabilities = - call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL_TX) - && call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE_RX); + if (call.getVideoCall() == null) { + return false; + } + + // We are already in an IMS video call + if (VideoProfile.isVideo(call.getDetails().getVideoState())) { + return true; + } + + // The user has disabled IMS video calling in system settings + if (!CallUtil.isVideoEnabled(context)) { + return false; + } + + // The current call doesn't support transmitting video + if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_LOCAL_TX)) { + return false; + } + + // The current call remote device doesn't support receiving video + if (!call.getDetails().can(Call.Details.CAPABILITY_SUPPORTS_VT_REMOTE_RX)) { + return false; + } - return call.getVideoCall() != null - && (hasCapabilities || VideoProfile.isVideo(call.getDetails().getVideoState())); + return true; } @Override |