Merge "IMS-VT: Device does not wake up during VT upgrade scenario." into atel.lnx.2.0-dev
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index 83ad213..9c48a13 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -400,10 +400,13 @@
boolean isChecked = button.isChecked();
if (isChecked) Log.d(this, "updateColors: button:" + button + " is in checked state");
button.setChecked(false);
+ boolean isSelected = button.isSelected();
+ button.setSelected(false);
final LayerDrawable layers = (LayerDrawable) button.getBackground();
final RippleDrawable btnCompoundDrawable = compoundBackgroundDrawable(themeColors);
layers.setDrawableByLayerId(R.id.compoundBackgroundItem, btnCompoundDrawable);
button.setChecked(isChecked);
+ button.setSelected(isSelected);
button.requestLayout();
}
diff --git a/InCallUI/src/com/android/incallui/CallCardFragment.java b/InCallUI/src/com/android/incallui/CallCardFragment.java
index 1c4890b..4bf94fd 100644
--- a/InCallUI/src/com/android/incallui/CallCardFragment.java
+++ b/InCallUI/src/com/android/incallui/CallCardFragment.java
@@ -44,6 +44,7 @@
import android.media.AudioManager;
import android.provider.Settings;
import android.telecom.DisconnectCause;
+import android.telecom.VideoProfile;
import android.telephony.PhoneNumberUtils;
import android.telephony.SubscriptionManager;
import android.text.TextUtils;
@@ -1140,6 +1141,20 @@
return bitmap;
}
+ private boolean isDowngrading(int videoState) {
+ boolean isDowngrade = false;
+ if ((videoState == VideoProfile.STATE_BIDIRECTIONAL
+ && QtiCallUtils.getRequestedVideoState()
+ != VideoProfile.STATE_BIDIRECTIONAL)
+ || ((videoState == VideoProfile.STATE_TX_ENABLED
+ || videoState == VideoProfile.STATE_RX_ENABLED)
+ && QtiCallUtils.getRequestedVideoState()
+ == VideoProfile.STATE_AUDIO_ONLY)) {
+ isDowngrade = true;
+ }
+ return isDowngrade;
+ }
+
/**
* Gets the call state label based on the state of the call or cause of disconnect.
*
@@ -1179,7 +1194,12 @@
isAutoDismissing = true;
} else if (sessionModificationState
== Call.SessionModificationState.WAITING_FOR_RESPONSE) {
- callStateLabel = context.getString(R.string.card_title_video_call_requesting);
+ if (isDowngrading(videoState)) {
+ callStateLabel = context.getString(R.string.card_title_video_call);
+ } else {
+ callStateLabel = context.getString(
+ R.string.card_title_video_call_requesting);
+ }
} else if (sessionModificationState
== Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) {
callStateLabel = context.getString(R.string.card_title_video_call_requesting);
diff --git a/InCallUI/src/com/android/incallui/QtiCallUtils.java b/InCallUI/src/com/android/incallui/QtiCallUtils.java
index faf518c..4e5b203 100644
--- a/InCallUI/src/com/android/incallui/QtiCallUtils.java
+++ b/InCallUI/src/com/android/incallui/QtiCallUtils.java
@@ -73,6 +73,7 @@
public static final String INTENT_ACTION_DIALOG_DISMISS =
"com.qti.editnumber.INTENT_ACTION_DIALOG_DISMISS";
private static String mEditNumberCallId;
+ private static int mRequestedVideoState = -1;
static {
VIDEO_QUALITY_TABLE.put(new Size(320,240), VideoProfile.QUALITY_LOW);
@@ -229,6 +230,7 @@
final int selCallType = itemToCallType.get(item);
Log.v(this, "Videocall: ModifyCall: upgrade/downgrade to "
+ callTypeToString(selCallType));
+ mRequestedVideoState = selCallType;
VideoProfile videoProfile = new VideoProfile(selCallType);
changeToVideoClicked(call, videoProfile, context);
dialog.dismiss();
@@ -241,6 +243,10 @@
alert.show();
}
+ public static int getRequestedVideoState() {
+ return mRequestedVideoState;
+ }
+
public static void changeToVideoCall(Call call, VideoProfile videoProfile, Context context) {
changeToVideoClicked(call, videoProfile, context);
}