summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Garnes <matt@cyngn.com>2015-03-04 16:17:56 -0800
committerMatt Garnes <matt@cyngn.com>2015-03-04 16:17:56 -0800
commite0fa4b84f6dba2d330c96dab3e20a81f514cf259 (patch)
tree101be2404ae67f63e5028834862ed1128d3eff4d
parent94a23c822bbcd923f0a6df3d5a6e817a0af2790f (diff)
parentfaffb01d5bb7dbb2bb067b230e280fa2f93899e2 (diff)
downloadpackages_apps_InCallUI-caf/cm-12.0.tar.gz
packages_apps_InCallUI-caf/cm-12.0.tar.bz2
packages_apps_InCallUI-caf/cm-12.0.zip
Merge CAF branch 'LA.BR.1.2.1_rb2.19' into caf/cm-12.0.caf/cm-12.0
-rw-r--r--res/layout-land/video_call_views.xml6
-rw-r--r--res/layout/video_call_views.xml6
-rw-r--r--res/values/array.xml34
-rw-r--r--res/values/strings.xml12
-rw-r--r--src/com/android/incallui/AnswerFragment.java30
-rwxr-xr-xsrc/com/android/incallui/AnswerPresenter.java42
-rw-r--r--src/com/android/incallui/Call.java48
-rw-r--r--src/com/android/incallui/CallCardPresenter.java19
-rw-r--r--src/com/android/incallui/InCallVideoCallListener.java3
-rw-r--r--src/com/android/incallui/InCallVideoCallListenerNotifier.java11
-rw-r--r--src/com/android/incallui/VideoCallPresenter.java7
-rw-r--r--src/com/android/incallui/VideoPauseController.java2
12 files changed, 195 insertions, 25 deletions
diff --git a/res/layout-land/video_call_views.xml b/res/layout-land/video_call_views.xml
index b16a324f..f6392c31 100644
--- a/res/layout-land/video_call_views.xml
+++ b/res/layout-land/video_call_views.xml
@@ -25,14 +25,16 @@
android:id="@+id/incomingVideo"
android:layout_gravity="center"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:visibility="gone" />
<!-- The width and height are replaced at runtime based on the selected camera. -->
<TextureView
android:id="@+id/previewVideo"
android:layout_gravity="bottom|right"
android:layout_margin="@dimen/video_preview_margin"
android:layout_width="70dp"
- android:layout_height="120dp" />
+ android:layout_height="120dp"
+ android:visibility="gone" />
<com.android.incallui.ZoomControlBar
android:id="@+id/zoom_control"
diff --git a/res/layout/video_call_views.xml b/res/layout/video_call_views.xml
index b16a324f..6cb71690 100644
--- a/res/layout/video_call_views.xml
+++ b/res/layout/video_call_views.xml
@@ -25,14 +25,16 @@
android:id="@+id/incomingVideo"
android:layout_gravity="center"
android:layout_width="match_parent"
- android:layout_height="match_parent" />
+ android:layout_height="match_parent"
+ android:visibility="gone"/>
<!-- The width and height are replaced at runtime based on the selected camera. -->
<TextureView
android:id="@+id/previewVideo"
android:layout_gravity="bottom|right"
android:layout_margin="@dimen/video_preview_margin"
android:layout_width="70dp"
- android:layout_height="120dp" />
+ android:layout_height="120dp"
+ android:visibility="gone"/>
<com.android.incallui.ZoomControlBar
android:id="@+id/zoom_control"
diff --git a/res/values/array.xml b/res/values/array.xml
index ef95e59b..12c226fa 100644
--- a/res/values/array.xml
+++ b/res/values/array.xml
@@ -129,7 +129,7 @@
</array>
- <!-- For upgrade to video in an active video call.
+ <!-- For upgrade to video from VOLTE to VT (Tx/Rx/Bidirectional) in an active video call.
- Accept upgrade to video request (drag right)
- Decline upgrade to video request (drag left)
- Answer as audio call (drag down) -->
@@ -154,6 +154,38 @@
<item>@null</item>
</array>
+ <!-- For accept/reject upgrade to video in active video call
+ - Accept upgrade to video request (drag right)
+ - Decline upgrade to video request (drag left)-->
+ <array name="incoming_call_widget_bidirectional_video_accept_reject_request_targets">
+ <item>@drawable/ic_lockscreen_answer_video</item>
+ <item>@drawable/ic_lockscreen_decline</item>
+ </array>
+
+ <!-- For accept/reject upgrade to video transmit in active video call
+ - Accept upgrade to video request (drag right)
+ - Decline upgrade to video request (drag left)-->
+ <array name="incoming_call_widget_video_transmit_accept_reject_request_targets">
+ <item>@drawable/ic_lockscreen_answer_tx_video</item>
+ <item>@drawable/ic_lockscreen_decline</item>
+ </array>
+ <array name="incoming_call_widget_video_transmit_request_target_descriptions">
+ <item>@string/description_target_accept_upgrade_to_video_transmit_request</item>
+ <item>@string/description_target_decline_upgrade_to_video_transmit_request</item>
+ </array>
+
+ <!-- For accept/reject upgrade to video receive in active video call
+ - Accept upgrade to video request (drag right)
+ - Decline upgrade to video request (drag left)-->
+ <array name="incoming_call_widget_video_receive_accept_reject_request_targets">
+ <item>@drawable/ic_lockscreen_answer_rx_video</item>
+ <item>@drawable/ic_lockscreen_decline</item>
+ </array>
+ <array name="incoming_call_widget_video_receive_request_target_descriptions">
+ <item>@string/description_target_accept_upgrade_to_video_receive_request</item>
+ <item>@string/description_target_decline_upgrade_to_video_receive_request</item>
+ </array>
+
<array name="sim_icons">
<item>@drawable/ic_sim_icon_1</item>
<item>@drawable/ic_sim_icon_2</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fe134f6b..08d881f7 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -524,6 +524,18 @@
<!-- Description of the target to decline a request to upgrade from an audio call to a video call.
[CHAR LIMIT=NONE] -->
<string name="description_target_decline_upgrade_to_video_request">Decline video request</string>
+ <!-- Description of the target to accept a request to upgrade from any call to a video transmit call.
+ [CHAR LIMIT=NONE] -->
+ <string name="description_target_accept_upgrade_to_video_transmit_request">Accept video transmit request</string>
+ <!-- Description of the target to decline a request to upgrade from any call to a video transmit call.
+ [CHAR LIMIT=NONE] -->
+ <string name="description_target_decline_upgrade_to_video_transmit_request">Decline video transmit request</string>
+ <!-- Description of the target to accept a request to upgrade from any call to a video receive call.
+ [CHAR LIMIT=NONE] -->
+ <string name="description_target_accept_upgrade_to_video_receive_request">Accept video receive request</string>
+ <!-- Description of the target to decline a request to upgrade from any call to a video receive call.
+ [CHAR LIMIT=NONE] -->
+ <string name="description_target_decline_upgrade_to_video_receive_request">Decline video receive request</string>
<!-- Description of the up direction in which one can to slide the handle in the phone answer screen. [CHAR LIMIT=NONE] -->
<string name="description_direction_up">Slide up for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
diff --git a/src/com/android/incallui/AnswerFragment.java b/src/com/android/incallui/AnswerFragment.java
index ffeddb5f..094fcf02 100644
--- a/src/com/android/incallui/AnswerFragment.java
+++ b/src/com/android/incallui/AnswerFragment.java
@@ -50,6 +50,9 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
public static final int TARGET_SET_FOR_VIDEO_WITHOUT_SMS = 2;
public static final int TARGET_SET_FOR_VIDEO_WITH_SMS = 3;
public static final int TARGET_SET_FOR_VIDEO_UPGRADE_REQUEST = 4;
+ public static final int TARGET_SET_FOR_BIDIRECTIONAL_VIDEO_ACCEPT_REJECT_REQUEST = 5;
+ public static final int TARGET_SET_FOR_VIDEO_TRANSMIT_ACCEPT_REJECT_REQUEST = 6;
+ public static final int TARGET_SET_FOR_VIDEO_RECEIVE_ACCEPT_REJECT_REQUEST = 7;
/**
* The popup showing the list of canned responses.
@@ -168,6 +171,33 @@ public class AnswerFragment extends BaseFragment<AnswerPresenter, AnswerPresente
.incoming_call_widget_video_upgrade_request_target_direction_descriptions;
handleDrawableResourceId = R.drawable.ic_incall_video_handle;
break;
+ case TARGET_SET_FOR_BIDIRECTIONAL_VIDEO_ACCEPT_REJECT_REQUEST:
+ targetResourceId =
+ R.array.incoming_call_widget_bidirectional_video_accept_reject_request_targets;
+ targetDescriptionsResourceId =
+ R.array.incoming_call_widget_video_upgrade_request_target_descriptions;
+ directionDescriptionsResourceId = R.array
+ .incoming_call_widget_video_upgrade_request_target_direction_descriptions;
+ handleDrawableResourceId = R.drawable.ic_incall_video_handle;
+ break;
+ case TARGET_SET_FOR_VIDEO_TRANSMIT_ACCEPT_REJECT_REQUEST:
+ targetResourceId =
+ R.array.incoming_call_widget_video_transmit_accept_reject_request_targets;
+ targetDescriptionsResourceId =
+ R.array.incoming_call_widget_video_transmit_request_target_descriptions;
+ directionDescriptionsResourceId = R.array
+ .incoming_call_widget_video_upgrade_request_target_direction_descriptions;
+ handleDrawableResourceId = R.drawable.ic_incall_video_handle;
+ break;
+ case TARGET_SET_FOR_VIDEO_RECEIVE_ACCEPT_REJECT_REQUEST:
+ targetResourceId =
+ R.array.incoming_call_widget_video_receive_accept_reject_request_targets;
+ targetDescriptionsResourceId =
+ R.array.incoming_call_widget_video_receive_request_target_descriptions;
+ directionDescriptionsResourceId = R.array
+ .incoming_call_widget_video_upgrade_request_target_direction_descriptions;
+ handleDrawableResourceId = R.drawable.ic_incall_video_handle;
+ break;
case TARGET_SET_FOR_AUDIO_WITHOUT_SMS:
default:
targetResourceId = R.array.incoming_call_widget_audio_without_sms_targets;
diff --git a/src/com/android/incallui/AnswerPresenter.java b/src/com/android/incallui/AnswerPresenter.java
index 1985d941..9aa70a4e 100755
--- a/src/com/android/incallui/AnswerPresenter.java
+++ b/src/com/android/incallui/AnswerPresenter.java
@@ -20,6 +20,7 @@ import android.telecom.PhoneCapabilities;
import android.app.KeyguardManager;
import android.content.Context;
import android.os.SystemProperties;
+import android.telecom.VideoProfile;
import java.util.List;
@@ -165,6 +166,14 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
return;
}
+ final int currentVideoState = call.getVideoState();
+ final int modifyToVideoState = call.getModifyToVideoState();
+
+ if (currentVideoState == modifyToVideoState) {
+ Log.w(this, "processVideoUpgradeRequestCall: Video states are same. Return.");
+ return;
+ }
+
Log.d(this, " processVideoUpgradeRequestCall show glowpad");
long subId = call.getSubId();
int phoneId = CallList.getInstance().getPhoneId(subId);
@@ -173,8 +182,37 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
// Listen for call updates for the current call.
CallList.getInstance().addCallUpdateListener(mCallId[phoneId], this);
- getUi().showAnswerUi(true);
- getUi().showTargets(AnswerFragment.TARGET_SET_FOR_VIDEO_UPGRADE_REQUEST);
+ AnswerUi ui = getUi();
+
+ if (ui == null) {
+ Log.e(this, "Ui is null. Can't process upgrade request");
+ return;
+ }
+ ui.showAnswerUi(true);
+ ui.showTargets(getUiTarget(currentVideoState, modifyToVideoState));
+
+ }
+
+ private int getUiTarget(int currentVideoState, int modifyToVideoState) {
+ if (showVideoUpgradeOptions(currentVideoState, modifyToVideoState)) {
+ return AnswerFragment.TARGET_SET_FOR_VIDEO_UPGRADE_REQUEST;
+ } else if (isEnabled(modifyToVideoState, VideoProfile.VideoState.BIDIRECTIONAL)) {
+ return AnswerFragment.TARGET_SET_FOR_BIDIRECTIONAL_VIDEO_ACCEPT_REJECT_REQUEST;
+ } else if (isEnabled(modifyToVideoState, VideoProfile.VideoState.TX_ENABLED)) {
+ return AnswerFragment.TARGET_SET_FOR_VIDEO_TRANSMIT_ACCEPT_REJECT_REQUEST;
+ } else if (isEnabled(modifyToVideoState, VideoProfile.VideoState.RX_ENABLED)) {
+ return AnswerFragment.TARGET_SET_FOR_VIDEO_RECEIVE_ACCEPT_REJECT_REQUEST;
+ }
+ return AnswerFragment.TARGET_SET_FOR_VIDEO_UPGRADE_REQUEST;
+ }
+
+ private boolean showVideoUpgradeOptions(int currentVideoState, int modifyToVideoState) {
+ return currentVideoState == VideoProfile.VideoState.AUDIO_ONLY &&
+ isEnabled(modifyToVideoState, VideoProfile.VideoState.BIDIRECTIONAL);
+ }
+
+ private boolean isEnabled(int videoState, int mask) {
+ return (videoState & mask) == mask;
}
@Override
diff --git a/src/com/android/incallui/Call.java b/src/com/android/incallui/Call.java
index 71e747ce..94b92da9 100644
--- a/src/com/android/incallui/Call.java
+++ b/src/com/android/incallui/Call.java
@@ -246,6 +246,7 @@ public final class Call {
private int mSessionModificationState;
private final List<String> mChildCallIds = new ArrayList<>();
private final VideoSettings mVideoSettings = new VideoSettings();
+ private int mModifyToVideoState = VideoProfile.VideoState.AUDIO_ONLY;
private InCallVideoCallListener mVideoCallListener;
@@ -514,21 +515,60 @@ public final class Call {
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.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
- CallList.getInstance().onUpgradeToVideo(this);
+ 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;
diff --git a/src/com/android/incallui/CallCardPresenter.java b/src/com/android/incallui/CallCardPresenter.java
index 4f17d50f..3b24399a 100644
--- a/src/com/android/incallui/CallCardPresenter.java
+++ b/src/com/android/incallui/CallCardPresenter.java
@@ -276,11 +276,24 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
maybeShowManageConferenceCallButton();
+ //Note that both primary and secondary calls can be modified
+ final boolean isModifyRequest = isPendingModifyRequest(mPrimary) ||
+ isPendingModifyRequest(mSecondary);
+
final boolean enableEndCallButton = Call.State.isConnectingOrConnected(callState) &&
- callState != Call.State.INCOMING && mPrimary != null;
- // Hide the end call button instantly if we're receiving an incoming call.
+ callState != Call.State.INCOMING && mPrimary != null && !isModifyRequest;
+ /* Hide the end call button instantly if we're receiving an incoming call
+ or when receiving a modify request */
getUi().setEndCallButtonEnabled(
- enableEndCallButton, callState != Call.State.INCOMING /* animate */);
+ enableEndCallButton, callState != Call.State.INCOMING &&
+ !isModifyRequest /* animate */);
+ }
+
+ //Return TRUE if there is a modify request pending user action
+ boolean isPendingModifyRequest(Call call) {
+ return (call != null && call.getSessionModificationState() ==
+ Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST);
+
}
@Override
diff --git a/src/com/android/incallui/InCallVideoCallListener.java b/src/com/android/incallui/InCallVideoCallListener.java
index 4f2c25de..bbd33ca6 100644
--- a/src/com/android/incallui/InCallVideoCallListener.java
+++ b/src/com/android/incallui/InCallVideoCallListener.java
@@ -59,7 +59,8 @@ public class InCallVideoCallListener extends VideoCall.Listener {
if (wasVideoCall && !isVideoCall) {
InCallVideoCallListenerNotifier.getInstance().downgradeToAudio(mCall);
} else if (previousVideoState != newVideoState) {
- InCallVideoCallListenerNotifier.getInstance().upgradeToVideoRequest(mCall);
+ InCallVideoCallListenerNotifier.getInstance().upgradeToVideoRequest(mCall,
+ newVideoState);
}
}
diff --git a/src/com/android/incallui/InCallVideoCallListenerNotifier.java b/src/com/android/incallui/InCallVideoCallListenerNotifier.java
index 8ad20d9a..126fa488 100644
--- a/src/com/android/incallui/InCallVideoCallListenerNotifier.java
+++ b/src/com/android/incallui/InCallVideoCallListenerNotifier.java
@@ -123,13 +123,13 @@ public class InCallVideoCallListenerNotifier {
/**
* Inform listeners of an upgrade to video request for a call.
- *
* @param call The call.
+ * @param videoState The video state we want to upgrade to.
*/
- public void upgradeToVideoRequest(Call call) {
- Log.d(this, "upgradeToVideoRequest call=" + call);
+ public void upgradeToVideoRequest(Call call, int videoState) {
+ Log.d(this, "upgradeToVideoRequest call = " + call + " new video state = " + videoState);
for (SessionModificationListener listener : mSessionModificationListeners) {
- listener.onUpgradeToVideoRequest(call);
+ listener.onUpgradeToVideoRequest(call, videoState);
}
}
@@ -259,8 +259,9 @@ public class InCallVideoCallListenerNotifier {
* Called when a peer request is received to upgrade an audio-only call to a video call.
*
* @param call The call the request was received for.
+ * @param videoState The video state that the request wants to upgrade to.
*/
- public void onUpgradeToVideoRequest(Call call);
+ public void onUpgradeToVideoRequest(Call call, int videoState);
/**
* Called when a request to a peer to upgrade an audio-only call to a video call is
diff --git a/src/com/android/incallui/VideoCallPresenter.java b/src/com/android/incallui/VideoCallPresenter.java
index f7aad05e..b12b8187 100644
--- a/src/com/android/incallui/VideoCallPresenter.java
+++ b/src/com/android/incallui/VideoCallPresenter.java
@@ -959,8 +959,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
}
@Override
- public void onUpgradeToVideoRequest(Call call) {
- Log.d(this, "onUpgradeToVideoRequest call=" + call);
+ public void onUpgradeToVideoRequest(Call call, int videoState) {
+ Log.d(this, "onUpgradeToVideoRequest call = " + call + " new video state = " + videoState);
if (mPrimaryCall == null || !Call.areSame(mPrimaryCall, call)) {
Log.w(this, "UpgradeToVideoRequest received for non-primary call");
}
@@ -969,8 +969,7 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
return;
}
- call.setSessionModificationState(
- Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST);
+ call.setSessionModificationTo(videoState);
}
@Override
diff --git a/src/com/android/incallui/VideoPauseController.java b/src/com/android/incallui/VideoPauseController.java
index e17d8a0b..727780e8 100644
--- a/src/com/android/incallui/VideoPauseController.java
+++ b/src/com/android/incallui/VideoPauseController.java
@@ -259,7 +259,7 @@ class VideoPauseController implements InCallStateListener, IncomingCallListener,
}
@Override
- public void onUpgradeToVideoRequest(Call call) {
+ public void onUpgradeToVideoRequest(Call call, int videoState) {
}
@Override