summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Gunn <tgunn@google.com>2015-12-06 21:49:50 -0800
committerTyler Gunn <tgunn@google.com>2015-12-06 22:05:12 -0800
commit0175dc9a647e1b9b013ad5c3b855a7594d7fbedb (patch)
tree15220f479ae4033a76a223b1e16d5158c66ec82a
parent3490c8125aaf1aaf5e4d9cc3713386db6723d613 (diff)
Code cleanup.
1. Renamed some Call methods and cleaned up comments. 2. Renamed Incall CallUtils to VideoUtils. 3. Fixed some improper licenses. Bug: 20089489 Change-Id: Ia503db3b65d9aa990e562411de783f38dd08a9c2
-rw-r--r--InCallUI/src/com/android/incallui/AnswerPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/Call.java60
-rw-r--r--InCallUI/src/com/android/incallui/CallButtonPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/CallCardFragment.java6
-rw-r--r--InCallUI/src/com/android/incallui/CallList.java3
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java11
-rw-r--r--InCallUI/src/com/android/incallui/InCallVideoCallCallback.java10
-rw-r--r--InCallUI/src/com/android/incallui/VideoCallPresenter.java44
-rw-r--r--InCallUI/src/com/android/incallui/VideoPauseController.java49
-rw-r--r--InCallUI/src/com/android/incallui/VideoUtils.java (renamed from InCallUI/src/com/android/incallui/CallUtils.java)44
10 files changed, 119 insertions, 116 deletions
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java
index a44249b2c..76ca4a90d 100644
--- a/InCallUI/src/com/android/incallui/AnswerPresenter.java
+++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java
@@ -176,7 +176,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
CallList.getInstance().addCallUpdateListener(mCallId, this);
final int currentVideoState = call.getVideoState();
- final int modifyToVideoState = call.getModifyToVideoState();
+ final int modifyToVideoState = call.getRequestedVideoState();
if (currentVideoState == modifyToVideoState) {
Log.w(this, "processVideoUpgradeRequestCall: Video states are same. Return.");
@@ -282,7 +282,7 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
// Only present the user with the option to answer as a video call if the incoming call is
// a bi-directional video call.
- if (CallUtils.isBidirectionalVideoCall(call)) {
+ if (VideoUtils.isBidirectionalVideoCall(call)) {
if (withSms) {
getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_WITH_SMS);
getUi().configureMessageDialog(textMsgs);
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index e866b4b63..9526e7d5e 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -367,9 +367,9 @@ public class Call {
private int mVideoState;
/**
- * mModifyToVideoState is used to store requested upgrade / downgrade video state
+ * mRequestedVideoState is used to store requested upgrade / downgrade video state
*/
- private int mModifyToVideoState = VideoProfile.STATE_AUDIO_ONLY;
+ private int mRequestedVideoState = VideoProfile.STATE_AUDIO_ONLY;
private InCallVideoCallCallback mVideoCallCallback;
private String mChildNumber;
@@ -742,35 +742,41 @@ public class Call {
public boolean isVideoCall(Context context) {
return CallUtil.isVideoEnabled(context) &&
- CallUtils.isVideoCall(getVideoState());
+ VideoUtils.isVideoCall(getVideoState());
}
/**
- * This method is called when we request for a video upgrade or downgrade. This handles the
- * session modification state RECEIVED_UPGRADE_TO_VIDEO_REQUEST and sets the video state we
- * want to upgrade/downgrade to.
+ * Handles incoming session modification requests. Stores the pending video request and sets
+ * the session modification state to
+ * {@link SessionModificationState#RECEIVED_UPGRADE_TO_VIDEO_REQUEST} so that we can keep track
+ * of the fact the request was received. Only upgrade requests require user confirmation and
+ * will be handled by this method. The remote user can turn off their own camera without
+ * confirmation.
+ *
+ * @param videoState The requested video state.
*/
- public void setSessionModificationTo(int videoState) {
- Log.d(this, "setSessionModificationTo - video state= " + videoState);
+ public void setRequestedVideoState(int videoState) {
+ Log.d(this, "setRequestedVideoState - video state= " + videoState);
if (videoState == getVideoState()) {
mSessionModificationState = Call.SessionModificationState.NO_REQUEST;
- Log.w(this,"setSessionModificationTo - Clearing session modification state");
- } else {
- mSessionModificationState =
- Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST;
- setModifyToVideoState(videoState);
- CallList.getInstance().onUpgradeToVideo(this);
+ Log.w(this,"setRequestedVideoState - Clearing session modification state");
+ return;
}
- Log.d(this, "setSessionModificationTo - mSessionModificationState="
+ mSessionModificationState = Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST;
+ mRequestedVideoState = videoState;
+ CallList.getInstance().onUpgradeToVideo(this);
+
+ Log.d(this, "setRequestedVideoState - mSessionModificationState="
+ mSessionModificationState + " video state= " + videoState);
update();
}
/**
- * This method is called to handle any other session modification states other than
- * RECEIVED_UPGRADE_TO_VIDEO_REQUEST. We set the modification state and reset the video state
- * when an upgrade request has been completed or failed.
+ * Set the session modification state. Used to keep track of pending video session modification
+ * operations and to inform listeners of these changes.
+ *
+ * @param state the new session modification state.
*/
public void setSessionModificationState(int state) {
boolean hasChanged = mSessionModificationState != state;
@@ -790,12 +796,13 @@ public class Call {
mIsEmergencyCall = TelecomCallUtil.isEmergencyCall(mTelecomCall);
}
- private void setModifyToVideoState(int newVideoState) {
- mModifyToVideoState = newVideoState;
- }
-
- public int getModifyToVideoState() {
- return mModifyToVideoState;
+ /**
+ * Gets the video state which was requested via a session modification request.
+ *
+ * @return The video state.
+ */
+ public int getRequestedVideoState() {
+ return mRequestedVideoState;
}
public static boolean areSame(Call call1, Call call2) {
@@ -820,6 +827,11 @@ public class Call {
return TextUtils.equals(call1.getNumber(), call2.getNumber());
}
+ /**
+ * Gets the current video session modification state.
+ *
+ * @return The session modification state.
+ */
public int getSessionModificationState() {
return mSessionModificationState;
}
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index ca186b34d..b0adafdb9 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -266,7 +266,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
return;
}
int currVideoState = mCall.getVideoState();
- int currUnpausedVideoState = CallUtils.getUnPausedVideoState(currVideoState);
+ int currUnpausedVideoState = VideoUtils.getUnPausedVideoState(currVideoState);
currUnpausedVideoState |= VideoProfile.STATE_BIDIRECTIONAL;
VideoProfile videoProfile = new VideoProfile(currUnpausedVideoState);
@@ -356,7 +356,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
Log.v(this, "updateButtonsState");
final CallButtonUi ui = getUi();
- final boolean isVideo = CallUtils.isVideoCall(call);
+ final boolean isVideo = VideoUtils.isVideoCall(call);
// Common functionality (audio, hold, etc).
// Show either HOLD or SWAP, but not both. If neither HOLD or SWAP is available:
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index e06d8d0eb..dbb2c9dff 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -784,7 +784,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
mCallStateIcon.setVisibility(View.GONE);
}
- if (CallUtils.isVideoCall(videoState)
+ if (VideoUtils.isVideoCall(videoState)
|| (state == Call.State.ACTIVE && sessionModificationState
== Call.SessionModificationState.WAITING_FOR_RESPONSE)) {
mCallStateVideoCallIcon.setVisibility(View.VISIBLE);
@@ -1036,7 +1036,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
} else if (sessionModificationState
== Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
callStateLabel = context.getString(R.string.card_title_video_call_requesting);
- } else if (CallUtils.isVideoCall(videoState)) {
+ } else if (VideoUtils.isVideoCall(videoState)) {
callStateLabel = context.getString(R.string.card_title_video_call);
}
break;
@@ -1060,7 +1060,7 @@ public class CallCardFragment extends BaseFragment<CallCardPresenter, CallCardPr
callStateLabel = label;
} else if (isAccount) {
callStateLabel = context.getString(R.string.incoming_via_template, label);
- } else if (CallUtils.isVideoCall(videoState)) {
+ } else if (VideoUtils.isVideoCall(videoState)) {
callStateLabel = context.getString(R.string.notification_incoming_video_call);
} else {
callStateLabel = context.getString(R.string.card_title_incoming_call);
diff --git a/InCallUI/src/com/android/incallui/CallList.java b/InCallUI/src/com/android/incallui/CallList.java
index 37ae14b1a..0f31f72aa 100644
--- a/InCallUI/src/com/android/incallui/CallList.java
+++ b/InCallUI/src/com/android/incallui/CallList.java
@@ -569,9 +569,10 @@ public class CallList {
// Second, ensure a VideoCall is set on the call so that the change can be sent to the
// provider (a VideoCall can be present for a call that does not currently have video,
// but can be upgraded to video).
+
// NOTE: is it necessary to use this order because getVideoCall references the class
// VideoProfile which is not available on APIs <23 (M).
- if (CallUtils.isVideoCall(call) && call.getVideoCall() != null) {
+ if (VideoUtils.isVideoCall(call) && call.getVideoCall() != null) {
call.getVideoCall().setDeviceOrientation(rotation);
}
}
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index ab6c24221..7d6409c45 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -939,17 +939,26 @@ public class InCallPresenter implements CallList.Listener,
return mIsActivityPreviouslyStarted;
}
+ /**
+ * Determines if the In-Call app is currently changing configuration.
+ *
+ * @return {@code true} if the In-Call app is changing configuration.
+ */
public boolean isChangingConfigurations() {
return mIsChangingConfigurations;
}
+ /**
+ * Tracks whether the In-Call app is currently in the process of changing configuration (i.e.
+ * screen orientation).
+ */
/*package*/
void updateIsChangingConfigurations() {
mIsChangingConfigurations = false;
if (mInCallActivity != null) {
mIsChangingConfigurations = mInCallActivity.isChangingConfigurations();
}
- Log.d(this, "IsChangingConfigurations=" + mIsChangingConfigurations);
+ Log.v(this, "updateIsChangingConfigurations = " + mIsChangingConfigurations);
}
diff --git a/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java
index 87b886d81..76f8c09fc 100644
--- a/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java
+++ b/InCallUI/src/com/android/incallui/InCallVideoCallCallback.java
@@ -49,11 +49,11 @@ public class InCallVideoCallCallback extends VideoCall.Callback {
@Override
public void onSessionModifyRequestReceived(VideoProfile videoProfile) {
Log.d(this, " onSessionModifyRequestReceived videoProfile=" + videoProfile);
- int previousVideoState = CallUtils.getUnPausedVideoState(mCall.getVideoState());
- int newVideoState = CallUtils.getUnPausedVideoState(videoProfile.getVideoState());
+ int previousVideoState = VideoUtils.getUnPausedVideoState(mCall.getVideoState());
+ int newVideoState = VideoUtils.getUnPausedVideoState(videoProfile.getVideoState());
- boolean wasVideoCall = CallUtils.isVideoCall(previousVideoState);
- boolean isVideoCall = CallUtils.isVideoCall(newVideoState);
+ boolean wasVideoCall = VideoUtils.isVideoCall(previousVideoState);
+ boolean isVideoCall = VideoUtils.isVideoCall(newVideoState);
// Check for upgrades to video and downgrades to audio.
if (wasVideoCall && !isVideoCall) {
@@ -97,7 +97,7 @@ public class InCallVideoCallCallback extends VideoCall.Callback {
} else if (requestedProfile != null && responseProfile != null) {
boolean modifySucceeded = requestedProfile.getVideoState() ==
responseProfile.getVideoState();
- boolean isVideoCall = CallUtils.isVideoCall(responseProfile.getVideoState());
+ boolean isVideoCall = VideoUtils.isVideoCall(responseProfile.getVideoState());
if (modifySucceeded && isVideoCall) {
InCallVideoCallCallbackNotifier.getInstance().upgradeToVideoSuccess(mCall);
} else if (!modifySucceeded && isVideoCall) {
diff --git a/InCallUI/src/com/android/incallui/VideoCallPresenter.java b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
index 3df0b8123..621c699a9 100644
--- a/InCallUI/src/com/android/incallui/VideoCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/VideoCallPresenter.java
@@ -24,7 +24,6 @@ import android.os.AsyncTask;
import android.os.Handler;
import android.os.Looper;
import android.provider.ContactsContract;
-import android.telecom.CallAudioState;
import android.telecom.Connection;
import android.telecom.InCallService.VideoCall;
import android.telecom.VideoProfile;
@@ -426,7 +425,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
// change the camera or UI unless the waiting VT call becomes active.
primary = callList.getActiveCall();
currentCall = callList.getIncomingCall();
- if (!CallUtils.isActiveVideoCall(primary)) {
+ if (!VideoUtils.isActiveVideoCall(primary)) {
primary = callList.getIncomingCall();
}
} else if (newState == InCallPresenter.InCallState.OUTGOING) {
@@ -482,7 +481,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
private void checkForVideoStateChange(Call call) {
- final boolean isVideoCall = CallUtils.isVideoCall(call);
+ final boolean isVideoCall = VideoUtils.isVideoCall(call);
final boolean hasVideoStateChanged = mCurrentVideoState != call.getVideoState();
Log.d(this, "checkForVideoStateChange: isVideoCall= " + isVideoCall
@@ -505,7 +504,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
private void checkForCallStateChange(Call call) {
- final boolean isVideoCall = CallUtils.isVideoCall(call);
+ final boolean isVideoCall = VideoUtils.isVideoCall(call);
final boolean hasCallStateChanged = mCurrentCallState != call.getState();
Log.d(this, "checkForCallStateChange: isVideoCall= " + isVideoCall
@@ -524,7 +523,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
updateCameraSelection(call);
String newCameraId = cameraManager.getActiveCameraId();
- if (!Objects.equals(prevCameraId, newCameraId) && CallUtils.isActiveVideoCall(call)) {
+ if (!Objects.equals(prevCameraId, newCameraId) && VideoUtils.isActiveVideoCall(call)) {
enableCamera(call.getVideoCall(), true);
}
}
@@ -543,7 +542,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
private void onPrimaryCallChanged(Call newPrimaryCall) {
- final boolean isVideoCall = CallUtils.isVideoCall(newPrimaryCall);
+ final boolean isVideoCall = VideoUtils.isVideoCall(newPrimaryCall);
final boolean isVideoMode = isVideoMode();
Log.d(this, "onPrimaryCallChanged: isVideoCall=" + isVideoCall + " isVideoMode="
@@ -596,7 +595,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
// If the details change is not for the currently active call no update is required.
if (!call.equals(mPrimaryCall)) {
- Log.d(this," onDetailsChanged: Details not for current active call so returning. ");
+ Log.d(this, " onDetailsChanged: Details not for current active call so returning. ");
return;
}
@@ -613,7 +612,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
private void checkForOrientationAllowedChange(Call call) {
- InCallPresenter.getInstance().setInCallAllowsOrientationChange(CallUtils.isVideoCall(call));
+ InCallPresenter.getInstance().setInCallAllowsOrientationChange(
+ VideoUtils.isVideoCall(call));
}
/**
@@ -652,7 +652,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return;
}
- if (CallUtils.isVideoCall(call) && hasChanged) {
+ if (VideoUtils.isVideoCall(call) && hasChanged) {
enterVideoMode(call);
}
}
@@ -990,6 +990,12 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
ui.setPreviewRotation(mDeviceOrientation);
}
+ /**
+ * Handles an incoming upgrade to video request.
+ *
+ * @param call The call the request was received for.
+ * @param videoState The video state that the request wants to upgrade to.
+ */
@Override
public void onUpgradeToVideoRequest(Call call, int videoState) {
Log.d(this, "onUpgradeToVideoRequest call = " + call + " new video state = " + videoState);
@@ -1001,7 +1007,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return;
}
- call.setSessionModificationTo(videoState);
+ call.setRequestedVideoState(videoState);
}
@Override
@@ -1103,7 +1109,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return;
}
- if (!CallUtils.isVideoCall(call) || call.getState() == Call.State.INCOMING) {
+ if (!VideoUtils.isVideoCall(call) || call.getState() == Call.State.INCOMING) {
InCallPresenter.getInstance().setFullScreen(false);
}
}
@@ -1125,7 +1131,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
if (call == null || (
call != null && (call.getState() != Call.State.ACTIVE ||
- !CallUtils.isVideoCall(call)) ||
+ !VideoUtils.isVideoCall(call)) ||
InCallPresenter.getInstance().isFullscreen())) {
// Ensure any previously scheduled attempt to enter fullscreen is cancelled.
cancelAutoFullScreen();
@@ -1173,7 +1179,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
// Clear camera direction if this is not a video call.
- else if (CallUtils.isAudioCall(call)) {
+ else if (VideoUtils.isAudioCall(call)) {
cameraDir = Call.VideoSettings.CAMERA_DIRECTION_UNKNOWN;
call.getVideoSettings().setCameraDir(cameraDir);
}
@@ -1181,33 +1187,33 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
// If this is a waiting video call, default to active call's camera,
// since we don't want to change the current camera for waiting call
// without user's permission.
- else if (CallUtils.isVideoCall(activeCall) && CallUtils.isIncomingVideoCall(call)) {
+ else if (VideoUtils.isVideoCall(activeCall) && VideoUtils.isIncomingVideoCall(call)) {
cameraDir = activeCall.getVideoSettings().getCameraDir();
}
// Infer the camera direction from the video state and store it,
// if this is an outgoing video call.
- else if (CallUtils.isOutgoingVideoCall(call) && !isCameraDirectionSet(call) ) {
+ else if (VideoUtils.isOutgoingVideoCall(call) && !isCameraDirectionSet(call) ) {
cameraDir = toCameraDirection(call.getVideoState());
call.getVideoSettings().setCameraDir(cameraDir);
}
// Use the stored camera dir if this is an outgoing video call for which camera direction
// is set.
- else if (CallUtils.isOutgoingVideoCall(call)) {
+ else if (VideoUtils.isOutgoingVideoCall(call)) {
cameraDir = call.getVideoSettings().getCameraDir();
}
// Infer the camera direction from the video state and store it,
// if this is an active video call and camera direction is not set.
- else if (CallUtils.isActiveVideoCall(call) && !isCameraDirectionSet(call)) {
+ else if (VideoUtils.isActiveVideoCall(call) && !isCameraDirectionSet(call)) {
cameraDir = toCameraDirection(call.getVideoState());
call.getVideoSettings().setCameraDir(cameraDir);
}
// Use the stored camera dir if this is an active video call for which camera direction
// is set.
- else if (CallUtils.isActiveVideoCall(call)) {
+ else if (VideoUtils.isActiveVideoCall(call)) {
cameraDir = call.getVideoSettings().getCameraDir();
}
@@ -1232,7 +1238,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
private static boolean isCameraDirectionSet(Call call) {
- return CallUtils.isVideoCall(call) && call.getVideoSettings().getCameraDir()
+ return VideoUtils.isVideoCall(call) && call.getVideoSettings().getCameraDir()
!= Call.VideoSettings.CAMERA_DIRECTION_UNKNOWN;
}
diff --git a/InCallUI/src/com/android/incallui/VideoPauseController.java b/InCallUI/src/com/android/incallui/VideoPauseController.java
index 54e31f8d9..070448ee9 100644
--- a/InCallUI/src/com/android/incallui/VideoPauseController.java
+++ b/InCallUI/src/com/android/incallui/VideoPauseController.java
@@ -1,34 +1,21 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/*
+ * Copyright (C) 2015 The Android Open Source Project
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * 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
*
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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
*/
package com.android.incallui;
-import android.telecom.VideoProfile;
import com.android.incallui.Call.State;
import com.android.incallui.InCallPresenter.InCallState;
import com.android.incallui.InCallPresenter.InCallStateListener;
@@ -42,7 +29,7 @@ import com.google.common.base.Preconditions;
*/
class VideoPauseController implements InCallStateListener, IncomingCallListener,
SessionModificationListener {
- private static final String TAG = "VideoPauseController:";
+ private static final String TAG = "VideoPauseController";
/**
* Keeps track of the current active/foreground call.
@@ -168,7 +155,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener,
}
boolean hasPrimaryCallChanged = !areSame(call, mPrimaryCallContext);
- boolean canVideoPause = CallUtils.canVideoPause(call);
+ boolean canVideoPause = VideoUtils.canVideoPause(call);
log("onStateChange, hasPrimaryCallChanged=" + hasPrimaryCallChanged);
log("onStateChange, canVideoPause=" + canVideoPause);
log("onStateChange, IsInBackground=" + mIsInBackground);
@@ -206,7 +193,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener,
log("onPrimaryCallChanged, IsInBackground=" + mIsInBackground);
Preconditions.checkState(!areSame(call, mPrimaryCallContext));
- final boolean canVideoPause = CallUtils.canVideoPause(call);
+ final boolean canVideoPause = VideoUtils.canVideoPause(call);
if ((isIncomingCall(mPrimaryCallContext) || isDialing(mPrimaryCallContext))
&& canVideoPause && !mIsInBackground) {
@@ -366,10 +353,10 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener,
if (resume) {
log("sending resume request, call=" + call);
call.getVideoCall()
- .sendSessionModifyRequest(CallUtils.makeVideoUnPauseProfile(call));
+ .sendSessionModifyRequest(VideoUtils.makeVideoUnPauseProfile(call));
} else {
log("sending pause request, call=" + call);
- call.getVideoCall().sendSessionModifyRequest(CallUtils.makeVideoPauseProfile(call));
+ call.getVideoCall().sendSessionModifyRequest(VideoUtils.makeVideoPauseProfile(call));
}
}
@@ -407,7 +394,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 && CallUtils.isVideoCall(callContext.getVideoState());
+ return callContext != null && VideoUtils.isVideoCall(callContext.getVideoState());
}
/**
diff --git a/InCallUI/src/com/android/incallui/CallUtils.java b/InCallUI/src/com/android/incallui/VideoUtils.java
index 6eb1a057f..73eb3a990 100644
--- a/InCallUI/src/com/android/incallui/CallUtils.java
+++ b/InCallUI/src/com/android/incallui/VideoUtils.java
@@ -1,29 +1,17 @@
-/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+/*
+ * Copyright (C) 2015 The Android Open Source Project
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of The Linux Foundation nor the names of its
- * contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
+ * 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
*
- * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
- * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * 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
*/
package com.android.incallui;
@@ -34,7 +22,7 @@ import com.android.dialer.compat.DialerCompatUtils;
import com.google.common.base.Preconditions;
-public class CallUtils {
+public class VideoUtils {
public static boolean isVideoCall(Call call) {
return call != null && isVideoCall(call.getVideoState());
@@ -58,7 +46,7 @@ public class CallUtils {
}
public static boolean isIncomingVideoCall(Call call) {
- if (!CallUtils.isVideoCall(call)) {
+ if (!VideoUtils.isVideoCall(call)) {
return false;
}
final int state = call.getState();
@@ -66,11 +54,11 @@ public class CallUtils {
}
public static boolean isActiveVideoCall(Call call) {
- return CallUtils.isVideoCall(call) && call.getState() == Call.State.ACTIVE;
+ return VideoUtils.isVideoCall(call) && call.getState() == Call.State.ACTIVE;
}
public static boolean isOutgoingVideoCall(Call call) {
- if (!CallUtils.isVideoCall(call)) {
+ if (!VideoUtils.isVideoCall(call)) {
return false;
}
final int state = call.getState();