summaryrefslogtreecommitdiff
path: root/InCallUI/src/com/android/incallui/Call.java
diff options
context:
space:
mode:
authorRekha Kumar <rekhak@codeaurora.org>2015-03-18 09:55:55 -0700
committerRekha Kumar <rekhak@quicinc.com>2015-03-26 22:56:33 +0000
commit18c0feda76fe333f3db1bf7bd307458a9e6b6005 (patch)
tree61c6fcc9baa269a3c81298ae13c8e4a9ac909144 /InCallUI/src/com/android/incallui/Call.java
parent22875bb1d3fa4f023e6ca127a77159ab42bbbabc (diff)
IMS-VT: Add support for video calls
IMS-VT: Upgrade downgrade and hold resume video calls -Add support for upgrade downgrade video calls. -Add support for hold resume and call waiting IMS-VT: Fixed surface caching. Fixed surface caching. IMS-VT: Fixes InCallUI/Dialer crash when there is a VT call. -Fixes InCallUI/Dialer crash when UE is rotated. -Fixes InCallUI/Dialer crash when UE VoLTE call is upgraded to VT. Don't default to speaker phone for VT when speaker is disabled - The adb property persist.radio.ims.audio.output indicates whether speaker is disabled explicitly or not. - If the above property is set to 1, don't enable speaker phone by default in VT call. IMS-VT: Fix CVO, surface and resource related issues. - Send initial orientation to VT Service. - Detect if Activity is being destroyed due to confugration changes. - Close the camera when InCallUI is pushed to background. - Fix surface and VT service related issues when Fragment and Presenter gets destroyed. IMS-VT: Peer Resolution Feature Implementation Change display video size based on peer resolution values received from far end. IMS-VT: Answering calls and upgrade requests as VT_TX and VT_RX -Support for showing one way options for incoming upgrade request -Fix issue where incoming video popup stays on screen even after rejecting the request. -Fix issue where incoming video popup stays on even after it has been timed out by lower layers. - Answer with different calltypes support. Notify listeners of video quality changed event and display message on UI - Add methods to notify listeners of type VideoEventListener when video quality changes. - Display a notification on the UI when video quality changes. IMS-VT: Enable SIP based video multitasking. Enable SIP based video multitasking. IMS-VT: Call data usage feature - Add support for call data usage callback - Request for call data usage stats - Log call data usage stats when IMS layers send update Change-Id: I3f0dde0d82698085fa5d3f110720f10326eca768 IMS-VT: When TTY is ON, do not allow upgrade to VT call When TTY mode is ON, the user SHOULD NOT be allowed to upgrade a call from VOLTE to VT/VT-TX/VT-RX and an UI alert message will be displayed explaining upgrade to VT call cannot be initiated. IMS-VT: Add null check in call upgrade fail scenario Crash is observed if call is ended in the interval wherein handler is started to change state from REQUEST_FAILED to NO_REQUEST after an interval. Added null check to change state only when call exists Propagate call substate message and display a notification on the UI Ims: Reject upgrade request 1. If there is waiting call that is pending user action and 2. Before offering a waiting call IMS-VT: Provide Player State indication to user. Change to display "player started/stopped" toast message whenever video starts/stops flowing IMS-VT: Cleanup video views when not required - Hide video views when not required. Set display size as per current TextureView size - Using TextureView height and width to calculate the display size. - When ever there is change in display make sure that center the display. IMS-VT: Exit VT call full screen mode. If the call is no longer a VT call, then exit full screen mode Change-Id: Ibc4ad8f9a4c38e467820028cdc2c7e68d65fd93c CRs-Fixed: 760925 IMS-VT: Upgrade button fix -Show upgrade/downgrade button only when call is in ACTIVE or ONHOLD state IMS-VT: Show correct call types during video pause -In paused state, upgrade downgrade button does not list the calltypes dropdown box -Remove the paused bit to calculate call type during video paused state. IMS-VT: Move strings for video quality changed indication to resource files IMS-VT: Clean up the showCallSubstateChanged API - Make the code more readable. IMS-VT: Set audio route to Speaker if current route is not bluetooth or headset - We always set the audio route to speaker when we enter video mode. - That is not correct. We should check if headset or bluetooth is connected before defaulting to speaker. IMS-VT: Turn speaker on/off for video calls based on call state changes - Turn speaker on only when video call is active or dialing - Switch back to the previous audio mode when there are no more calls - Make the previous audio mode static so that information persists when the class is recreated (e.g. when UE is rotated or multitasking happens) IMS-VT: Use back camera instead of front camera for VT-TX Set back camera for below cases 1) VOLTE to VT-TX 2) VT to VT-TX 3) Waiting call over Vt-TX call. IMS-VT: Fix upgrade in call waiting scenarios -When one VoLTE call is active and another VoLTE call is on hold and upgrade button is hit, call ends. Fix this upgrade issue. IMS-VT: Enter video mode when the primary video call changes - We only enter video mode when we have any video state changes - Enter video mode should also be called when the video call changes. e.g. When we have a second call with the same video state, we don't enter video mode which is incorrect. This change fixes the issue Add null check for InCallActivity in setInCallAllowsOrientationChange - In some cases, this API is called when InCallActivity is null. This causes a null pointer exception. Fix is to add a null check. IMS-VT: Fix check for VOLTE call (AND to OR) when turning speaker on IMS-VT: Check if call is video before enabling speaker in updateAudioMode - Moved the video call check to the correct block where we are enabling speaker IMS-VT: Get call substate values correctly from the bit mask - We were getting the call substate incorrectly as an int. - Fixed that by getting it from the bit mask and using the possible multiple values to display the call substate message. IMS-VT: Keep the screen on during video calls. UI screens times out after some time. During video calls the screen must be kept on. Change-Id: Icaa8662210b2dd323b29f4a472869a9ed1e01d00 IMS-VT: Open front facing camera for VT calls. Open front facing camera for VT calls. IMS-VT: Show manage conference button for Video Call - We show the manage conference in a separate section for VOLTE Calls. - In the case of Video Call, the entire screen is occupied by the far end video. So we display manage conference in the overflow section of the call button fragment. IMS-VT: Fix camera preview freeze for CONF video calls. Fix camera preview freeze for CONF video calls. IMS-VT: Move persist.radio.ims.audio.output to frameworks Move persist.radio.ims.audio.output and related constants to TelephonyProperties and PhoneConstants so that these can be accessed from multiple git projects instead of redefining. IMS-VT: Multiple video call fixes/optimizations. -Current implementation clears primary call cache upon exiting video mode. This will remove video call provider interface as well, which will prevent further communication with the backend. Don't clear primary call cache upon exiting video mode. -Unregister call details listener when UI transitions into unready state -Send surface of incoming video to video call provider before opening camera. IMS: Cleanup all listener objects Clean all stale listener objects to avoid the memory leak. IMS: Fix speaker icon display issue in Call UI. In few devices, InCall UI can show upto five buttons in a row. Modify code to display at most five buttons in a row. Show overflow menu if number of buttons is more than five. IMS-VT: Show glowpad view with accept/reject for most video upgrade cases - Show the glowpad view with all options only when upgrading from Volte to VT - For all other cases, show the glowpad with accept/reject only Change-Id: I41ecbda40db7c3c69428fc4272f8bfbd258e2980
Diffstat (limited to 'InCallUI/src/com/android/incallui/Call.java')
-rw-r--r--InCallUI/src/com/android/incallui/Call.java143
1 files changed, 133 insertions, 10 deletions
diff --git a/InCallUI/src/com/android/incallui/Call.java b/InCallUI/src/com/android/incallui/Call.java
index fd06e53b3..3d6f2032e 100644
--- a/InCallUI/src/com/android/incallui/Call.java
+++ b/InCallUI/src/com/android/incallui/Call.java
@@ -17,8 +17,10 @@
package com.android.incallui;
import com.android.contacts.common.CallUtil;
+import com.android.incallui.CallList.Listener;
import android.content.Context;
+import android.hardware.camera2.CameraCharacteristics;
import android.net.Uri;
import android.telecom.CallProperties;
import android.telecom.DisconnectCause;
@@ -118,8 +120,51 @@ public final class Call {
public static final int WAITING_FOR_RESPONSE = 1;
public static final int REQUEST_FAILED = 2;
public static final int RECEIVED_UPGRADE_TO_VIDEO_REQUEST = 3;
+ public static final int UPGRADE_TO_VIDEO_REQUEST_TIMED_OUT = 4;
+ }
+
+ public static class VideoSettings {
+ public static final int CAMERA_DIRECTION_UNKNOWN = -1;
+ public static final int CAMERA_DIRECTION_FRONT_FACING =
+ CameraCharacteristics.LENS_FACING_FRONT;
+ public static final int CAMERA_DIRECTION_BACK_FACING =
+ CameraCharacteristics.LENS_FACING_BACK;
+
+ private int mCameraDirection = CAMERA_DIRECTION_UNKNOWN;
+
+ /**
+ * Sets the camera direction. if camera direction is set to CAMERA_DIRECTION_UNKNOWN,
+ * the video state of the call should be used to infer the camera direction.
+ *
+ * @see {@link CameraCharacteristics#LENS_FACING_FRONT}
+ * @see {@link CameraCharacteristics#LENS_FACING_BACK}
+ */
+ public void setCameraDir(int cameraDirection) {
+ if (cameraDirection == CAMERA_DIRECTION_FRONT_FACING
+ || cameraDirection == CAMERA_DIRECTION_BACK_FACING) {
+ mCameraDirection = cameraDirection;
+ } else {
+ mCameraDirection = CAMERA_DIRECTION_UNKNOWN;
+ }
+ }
+
+ /**
+ * Gets the camera direction. if camera direction is set to CAMERA_DIRECTION_UNKNOWN,
+ * the video state of the call should be used to infer the camera direction.
+ *
+ * @see {@link CameraCharacteristics#LENS_FACING_FRONT}
+ * @see {@link CameraCharacteristics#LENS_FACING_BACK}
+ */
+ public int getCameraDir() {
+ return mCameraDirection;
+ }
+
+ public String toString() {
+ return "(CameraDir:" + getCameraDir() + ")";
+ }
}
+
private static final String ID_PREFIX = Call.class.getSimpleName() + "_";
private static int sIdCounter = 0;
@@ -127,12 +172,16 @@ public final class Call {
new android.telecom.Call.Listener() {
@Override
public void onStateChanged(android.telecom.Call call, int newState) {
+ Log.d(this, "TelecommCallListener onStateChanged call=" + call + " newState="
+ + newState);
update();
}
@Override
public void onParentChanged(android.telecom.Call call,
android.telecom.Call newParent) {
+ Log.d(this, "TelecommCallListener onParentChanged call=" + call + " newParent="
+ + newParent);
update();
}
@@ -145,29 +194,38 @@ public final class Call {
@Override
public void onDetailsChanged(android.telecom.Call call,
android.telecom.Call.Details details) {
+ Log.d(this, "TelecommCallListener onStateChanged call=" + call + " details="
+ + details);
update();
}
@Override
public void onCannedTextResponsesLoaded(android.telecom.Call call,
List<String> cannedTextResponses) {
+ Log.d(this, "TelecommCallListener onStateChanged call=" + call
+ + " cannedTextResponses=" + cannedTextResponses);
update();
}
@Override
public void onPostDialWait(android.telecom.Call call,
String remainingPostDialSequence) {
+ Log.d(this, "TelecommCallListener onStateChanged call=" + call
+ + " remainingPostDialSequence=" + remainingPostDialSequence);
update();
}
@Override
public void onVideoCallChanged(android.telecom.Call call,
VideoCall videoCall) {
+ Log.d(this, "TelecommCallListener onStateChanged call=" + call + " videoCall="
+ + videoCall);
update();
}
@Override
public void onCallDestroyed(android.telecom.Call call) {
+ Log.d(this, "TelecommCallListener onStateChanged call=" + call);
call.removeListener(mTelecommCallListener);
}
@@ -184,6 +242,11 @@ public final class Call {
private DisconnectCause mDisconnectCause;
private int mSessionModificationState;
private final List<String> mChildCallIds = new ArrayList<>();
+ private final VideoSettings mVideoSettings = new VideoSettings();
+ /**
+ * mModifyToVideoState is used to store requested upgrade / downgrade video state
+ */
+ private int mModifyToVideoState = VideoProfile.VideoState.AUDIO_ONLY;
private InCallVideoCallListener mVideoCallListener;
@@ -198,6 +261,14 @@ public final class Call {
return mTelecommCall;
}
+ /**
+ * @return video settings of the call, null if the call is not a video call.
+ * @see VideoProfile
+ */
+ public VideoSettings getVideoSettings() {
+ return mVideoSettings;
+ }
+
private void update() {
int oldState = getState();
updateFromTelecommCall();
@@ -209,7 +280,7 @@ public final class Call {
}
private void updateFromTelecommCall() {
- Log.d(this, "updateFromTelecommCall: " + mTelecommCall);
+ Log.d(this, "updateFromTelecommCall: " + mTelecommCall.toString());
setState(translateState(mTelecommCall.getState()));
setDisconnectCause(mTelecommCall.getDetails().getDisconnectCause());
@@ -370,24 +441,69 @@ public final class Call {
return mTelecommCall.getDetails().getVideoState();
}
+ public int getCallSubstate() {
+ return mTelecommCall.getDetails().getCallSubstate();
+ }
+
public boolean isVideoCall(Context context) {
- // We want to show Video call buttons even if only one direction is enabled
- // (That is what is happening when we receive a video call for example)
- return CallUtil.isVideoEnabled(context) && (
- VideoProfile.VideoState.isBidirectional(getVideoState()) ||
- VideoProfile.VideoState.isReceptionEnabled(getVideoState()) ||
- VideoProfile.VideoState.isTransmissionEnabled(getVideoState()));
+ return CallUtil.isVideoEnabled(context) &&
+ VideoProfile.VideoState.isVideo(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.
+ */
+ public void setSessionModificationTo(int videoState) {
+ Log.d(this, "setSessionModificationTo - 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.d(this, "setSessionModificationTo - 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.
+ */
public void setSessionModificationState(int state) {
+ if (state == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
+ Log.e(this,
+ "setSessionModificationState not to be called for RECEIVED_UPGRADE_TO_VIDEO_REQUEST");
+ return;
+ }
+
boolean hasChanged = mSessionModificationState != state;
mSessionModificationState = state;
-
+ Log.d(this, "setSessionModificationState " + state + " mSessionModificationState="
+ + mSessionModificationState);
+ if (state != Call.SessionModificationState.WAITING_FOR_RESPONSE) {
+ setModifyToVideoState(VideoProfile.VideoState.AUDIO_ONLY);
+ }
if (hasChanged) {
update();
}
}
+ private void setModifyToVideoState(int newVideoState) {
+ mModifyToVideoState = newVideoState;
+ }
+
+ public int getModifyToVideoState() {
+ return mModifyToVideoState;
+ }
+
public static boolean areSame(Call call1, Call call2) {
if (call1 == null && call2 == null) {
return true;
@@ -406,7 +522,7 @@ public final class Call {
@Override
public String toString() {
return String.format(Locale.US, "[%s, %s, %s, children:%s, parent:%s, conferenceable:%s, " +
- "videoState:%d]",
+ "videoState:%d, callSubState:%d, mSessionModificationState:%d, VideoSettings:%s]",
mId,
State.toString(getState()),
android.telecom.Call.Details
@@ -414,6 +530,13 @@ public final class Call {
mChildCallIds,
getParentId(),
this.mTelecommCall.getConferenceableCalls(),
- mTelecommCall.getDetails().getVideoState());
+ mTelecommCall.getDetails().getVideoState(),
+ mTelecommCall.getDetails().getCallSubstate(),
+ mSessionModificationState,
+ getVideoSettings());
+ }
+
+ public String toSimpleString() {
+ return super.toString();
}
}