summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNivedita Sarkar <nsarkar@codeaurora.org>2015-01-15 11:25:40 -0800
committerNivedita Sarkar <nsarkar@codeaurora.org>2015-01-28 12:01:28 -0800
commit19cc652ea059fd905f2f7ee67008fc717d1e255b (patch)
treef94cfdd6a430d98c72d43a5ae4fd5cbae8b2be2d
parent16ab43938b0a434acec84b5a1ad1c88c2508d78a (diff)
downloadpackages_apps_InCallUI-19cc652ea059fd905f2f7ee67008fc717d1e255b.tar.gz
packages_apps_InCallUI-19cc652ea059fd905f2f7ee67008fc717d1e255b.tar.bz2
packages_apps_InCallUI-19cc652ea059fd905f2f7ee67008fc717d1e255b.zip
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 CRs-Fixed: 779208
-rw-r--r--res/values/array.xml34
-rw-r--r--res/values/strings.xml12
-rw-r--r--src/com/android/incallui/AnswerFragment.java30
-rw-r--r--src/com/android/incallui/AnswerPresenter.java42
-rw-r--r--src/com/android/incallui/Call.java48
-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
9 files changed, 171 insertions, 18 deletions
diff --git a/res/values/array.xml b/res/values/array.xml
index 456ed2f5..57f01c33 100644
--- a/res/values/array.xml
+++ b/res/values/array.xml
@@ -117,7 +117,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) -->
@@ -142,6 +142,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 56a4e62d..45898540 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -522,6 +522,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 fd0df068..0b62519d 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.
@@ -163,6 +166,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 90dcff84..252cae02 100644
--- 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;
@@ -159,6 +160,14 @@ public class AnswerPresenter extends Presenter<AnswerPresenter.AnswerUi>
private void processVideoUpgradeRequestCall(Call call) {
Log.d(this, " processVideoUpgradeRequestCall call=" + call);
+ final int currentVideoState = call.getVideoState();
+ final int modifyToVideoState = call.getModifyToVideoState();
+
+ if (currentVideoState == modifyToVideoState) {
+ Log.w(this, "processVideoUpgradeRequestCall: Video states are same. Return.");
+ return;
+ }
+
long subId = call.getSubId();
int phoneId = CallList.getInstance().getPhoneId(subId);
mCallId[phoneId] = call.getId();
@@ -166,8 +175,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 0eea40b7..70a223e2 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;
@@ -486,21 +487,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/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 f3e871ad..25b57475 100644
--- a/src/com/android/incallui/VideoCallPresenter.java
+++ b/src/com/android/incallui/VideoCallPresenter.java
@@ -958,8 +958,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");
}
@@ -968,8 +968,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