diff options
author | Yorke Lee <yorkelee@google.com> | 2015-04-17 17:40:40 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-04-17 17:48:35 -0700 |
commit | b337928d730a578a55f13a322e6f87e74c24a088 (patch) | |
tree | 6d90bf650c229e8f5f2da97606f1c38db8e21741 | |
parent | 5dd8fd1d2c3055c6b14e9d21e9999fe91e39beca (diff) |
Remove use of VideoProfile.VideoState.isVideo
Don't further increase API surface, make this a utility method
in our own package instead.
Change-Id: Ib7036b20980afcb5d0fdb1c03c6d943ab9d7ece7
5 files changed, 14 insertions, 8 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java index e26c04794..a12b985ee 100644 --- a/InCallUI/src/com/android/incallui/Call.java +++ b/InCallUI/src/com/android/incallui/Call.java @@ -468,7 +468,7 @@ public class Call { public boolean isVideoCall(Context context) { return CallUtil.isVideoEnabled(context) && - VideoProfile.VideoState.isVideo(getVideoState()); + CallUtils.isVideoCall(getVideoState()); } /** diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java index 5e1c26a30..57fc4b713 100644 --- a/InCallUI/src/com/android/incallui/CallCardFragment.java +++ b/InCallUI/src/com/android/incallui/CallCardFragment.java @@ -557,7 +557,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr mCallStateIcon.setVisibility(View.GONE); } - if (VideoProfile.VideoState.isVideo(videoState) + if (CallUtils.isVideoCall(videoState) || (state == Call.State.ACTIVE && sessionModificationState == Call.SessionModificationState.WAITING_FOR_RESPONSE)) { mCallStateVideoCallIcon.setVisibility(View.VISIBLE); @@ -687,7 +687,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr } else if (sessionModificationState == Call.SessionModificationState.WAITING_FOR_RESPONSE) { callStateLabel = context.getString(R.string.card_title_video_call_requesting); - } else if (VideoProfile.VideoState.isVideo(videoState) && + } else if (CallUtils.isVideoCall(videoState) && VideoProfile.VideoState.isPaused(videoState)) { callStateLabel = context.getString(R.string.card_title_video_call_paused); } else if (VideoProfile.VideoState.isBidirectional(videoState)) { diff --git a/InCallUI/src/com/android/incallui/CallUtils.java b/InCallUI/src/com/android/incallui/CallUtils.java index 80b553aa7..51913d4d2 100644 --- a/InCallUI/src/com/android/incallui/CallUtils.java +++ b/InCallUI/src/com/android/incallui/CallUtils.java @@ -35,7 +35,13 @@ import com.google.common.base.Preconditions; public class CallUtils { public static boolean isVideoCall(Call call) { - return call != null && VideoProfile.VideoState.isVideo(call.getVideoState()); + return call != null && isVideoCall(call.getVideoState()); + } + + public static boolean isVideoCall(int videoState) { + return VideoProfile.VideoState.isBidirectional(videoState) + && VideoProfile.VideoState.isTransmissionEnabled(videoState) + && VideoProfile.VideoState.isReceptionEnabled(videoState); } public static boolean isIncomingVideoCall(Call call) { diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java index f868b3baf..ba4ab660d 100644 --- a/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java +++ b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java @@ -52,8 +52,8 @@ public class InCallVideoCallCallback extends VideoCall.Callback { int previousVideoState = CallUtils.getUnPausedVideoState(mCall.getVideoState()); int newVideoState = CallUtils.getUnPausedVideoState(videoProfile.getVideoState()); - boolean wasVideoCall = VideoProfile.VideoState.isVideo(previousVideoState); - boolean isVideoCall = VideoProfile.VideoState.isVideo(newVideoState); + boolean wasVideoCall = CallUtils.isVideoCall(previousVideoState); + boolean isVideoCall = CallUtils.isVideoCall(newVideoState); // Check for upgrades to video and downgrades to audio. if (wasVideoCall && !isVideoCall) { @@ -84,7 +84,7 @@ public class InCallVideoCallCallback extends VideoCall.Callback { } else if (requestedProfile != null && responseProfile != null) { boolean modifySucceeded = requestedProfile.getVideoState() == responseProfile.getVideoState(); - boolean isVideoCall = VideoProfile.VideoState.isVideo(responseProfile.getVideoState()); + boolean isVideoCall = CallUtils.isVideoCall(responseProfile.getVideoState()); if (modifySucceeded && isVideoCall) { InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoSuccess(mCall); } else if (!modifySucceeded && isVideoCall) { diff --git a/InCallUI/src/com/android/incallui/VideoPauseController.java b/InCallUI/src/com/android/incallui/VideoPauseController.java index 14e43b175..54e31f8d9 100644 --- a/InCallUI/src/com/android/incallui/VideoPauseController.java +++ b/InCallUI/src/com/android/incallui/VideoPauseController.java @@ -407,7 +407,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener, * @return {@code true} if the call is a video call, {@code false} otherwise. */ private static boolean isVideoCall(CallContext callContext) { - return callContext != null && VideoProfile.VideoState.isVideo(callContext.getVideoState()); + return callContext != null && CallUtils.isVideoCall(callContext.getVideoState()); } /** |