Dialer: fix the display issue for VT Call.
- VT welcome dialog should pop up in the first launch.
- Hide "show me" when device is in two way video call.
Change-Id: I2d436d592b3dba3c286631fe53f0b2842e567664
CRs-fixed: 1078574
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index ceae8c0..999f33e 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -528,7 +528,10 @@
if (mEnhanceEnable && showUpgradeToVideo) {
boolean isAudioAndVtCap = (VideoProfile.isAudioOnly(mCall.getVideoState()) &&
PresenceHelper.getVTCapability(call.getNumber()));
- showRxTx = (VideoProfile.isReceptionEnabled(mCall.getVideoState()) || isAudioAndVtCap);
+ showRxTx = ((VideoProfile.isReceptionEnabled(mCall.getVideoState()) &&
+ !VideoProfile.isBidirectional(mCall.getVideoState())) || isAudioAndVtCap);
+ //"hide me" show be show if call is video call or voice call only, "hide me"
+ //is mean that call can upgrade to Rx video call for voice call only.
showRx = (VideoProfile.isBidirectional(mCall.getVideoState()) || isAudioAndVtCap);
showVolte = VideoProfile.isVideo(mCall.getVideoState());
Log.v(this, "updateButtonsState showRxTx = " + showRxTx +
diff --git a/InCallUI/src/com/android/incallui/GlowPadAnswerFragment.java b/InCallUI/src/com/android/incallui/GlowPadAnswerFragment.java
index d9b4dda..98e797e 100644
--- a/InCallUI/src/com/android/incallui/GlowPadAnswerFragment.java
+++ b/InCallUI/src/com/android/incallui/GlowPadAnswerFragment.java
@@ -104,7 +104,12 @@
handleDrawableResourceId = R.drawable.ic_incall_audio_handle;
break;
case TARGET_SET_FOR_VIDEO_WITHOUT_SMS:
- targetResourceId = R.array.incoming_call_widget_video_without_sms_targets;
+ if (isEnhanceUIEnabled) {
+ targetResourceId =
+ R.array.enhance_incoming_call_widget_video_without_sms_targets;
+ } else {
+ targetResourceId = R.array.incoming_call_widget_video_without_sms_targets;
+ }
targetDescriptionsResourceId =
R.array.incoming_call_widget_video_without_sms_target_descriptions;
directionDescriptionsResourceId =
@@ -112,7 +117,11 @@
handleDrawableResourceId = R.drawable.ic_incall_video_handle;
break;
case TARGET_SET_FOR_VIDEO_WITH_SMS:
- targetResourceId = R.array.incoming_call_widget_video_with_sms_targets;
+ if (isEnhanceUIEnabled) {
+ targetResourceId = R.array.enhance_incoming_call_widget_video_with_sms_targets;
+ } else {
+ targetResourceId = R.array.incoming_call_widget_video_with_sms_targets;
+ }
targetDescriptionsResourceId =
R.array.incoming_call_widget_video_with_sms_target_descriptions;
directionDescriptionsResourceId =
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index d7bb71f..6142d52 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -1553,7 +1553,7 @@
}
private void showVideoCallWelcomeDialog() {
- if (DialerUtils.canShowWelcomeScreen(this)) {
+ if (DialerUtils.canShowWelcomeScreen(this) || DialerUtils.isFirstLaunch(this)) {
final Intent intent = new Intent(this, VideoCallWelcomeActivity.class);
startActivity(intent);
}
diff --git a/src/com/android/dialer/util/DialerUtils.java b/src/com/android/dialer/util/DialerUtils.java
index 08827df..a71e287 100644
--- a/src/com/android/dialer/util/DialerUtils.java
+++ b/src/com/android/dialer/util/DialerUtils.java
@@ -51,6 +51,7 @@
private static final String PREFS_MESSAGE = "video_call_welcome";
private static final String KEY_STATE = "message-repeat";
+ private static final String KEY_FIRST_LAUNCH = "first-launch";
/**
* Attempts to start an activity and displays a toast with the default error message if the
* activity is not found, instead of throwing an exception.
@@ -198,12 +199,25 @@
/**
+ * @return true if it is the first launch.
+ */
+ public static boolean isFirstLaunch(Context context) {
+ final SharedPreferences prefs = context.getSharedPreferences(
+ PREFS_MESSAGE, Context.MODE_PRIVATE);
+ boolean isFirstLaunch = prefs.getBoolean(KEY_FIRST_LAUNCH, true);
+ if (isFirstLaunch) {
+ prefs.edit().putBoolean(KEY_FIRST_LAUNCH, false).apply();
+ }
+ return isFirstLaunch;
+ }
+
+ /**
* @return true if the Welcome Screen shall be presented to the user, false otherwise.
*/
public static boolean canShowWelcomeScreen(Context context) {
final SharedPreferences prefs = context.getSharedPreferences(
PREFS_MESSAGE, Context.MODE_PRIVATE);
- return prefs.getBoolean(KEY_STATE, true);
+ return prefs.getBoolean(KEY_STATE, false);
}