Merge a735960b3122037352a861d3717152dc06830ef6 on remote branch
Change-Id: I37d8e3173c1a19691d2093075d041faba6a2a3d7
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index ceae8c0..b5002db 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -525,10 +525,13 @@
boolean showRx = false;
boolean showVolte = false;
- if (mEnhanceEnable && showUpgradeToVideo) {
+ if (mEnhanceEnable && hasVideoCallCapabilities(call)) {
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 +
@@ -544,7 +547,8 @@
ui.showButton(BUTTON_UPGRADE_TO_VIDEO, showUpgradeToVideo && !mEnhanceEnable);
ui.showButton(BUTTON_DOWNGRADE_TO_AUDIO, showDowngradeToAudio && !useExt);
ui.showButton(BUTTON_SWITCH_CAMERA, isVideo);
- ui.showButton(BUTTON_PAUSE_VIDEO, isVideo && !useExt && !useCustomVideoUi);
+ ui.showButton(BUTTON_PAUSE_VIDEO, isVideo && !useExt && !useCustomVideoUi &&
+ !mEnhanceEnable);
ui.showButton(BUTTON_DIALPAD, true);
ui.showButton(BUTTON_MERGE, showMerge);
ui.showButton(BUTTON_ADD_PARTICIPANT, showAddParticipant && !mEnhanceEnable);
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/res/values/qtistrings.xml b/res/values/qtistrings.xml
new file mode 100644
index 0000000..a11e5e5
--- /dev/null
+++ b/res/values/qtistrings.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ ~
+ ~ Redistribution and use in source and binary forms, with or without
+ ~ modification, are permitted provided that the following conditions are
+ ~ met:
+ ~ * Redistributions of source code must retain the above copyright
+ ~ notice, this list of conditions and the following disclaimer.
+ ~ * Redistributions in binary form must reproduce the above
+ ~ copyright notice, this list of conditions and the following
+ ~ disclaimer in the documentation and/or other materials provided
+ ~ with the distribution.
+ ~ * Neither the name of The Linux Foundation nor the names of its
+ ~ contributors may be used to endorse or promote products derived
+ ~ from this software without specific prior written permission.
+ ~
+ ~ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ ~ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ ~ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ ~ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ ~ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ ~ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ ~ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ ~ BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ ~ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ ~ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ ~ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ -->
+<!-- The xml contains Qti specific resource strings neede for any value added features. -->
+<resources>
+ <!-- OEM Key strings -->
+ <string name="oem_key_code_action"></string>
+ <string name="oem_code"></string>
+</resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 48d49af..98d9dc6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1160,7 +1160,8 @@
<string name="call_data_info_description">Voice call usage time and data usage time</string>
<string name="alert_call_over_wifi">Calls will be made over Wi-Fi.</string>
<string name="alert_call_no_cellular_coverage">No cellular network available. Connect to available Wi-Fi to make calls.</string>
- <string name="alert_user_connect_to_wifi_for_call">Connect to Wi-Fi to make calls.</string>
+ <string name="alert_user_connect_to_wifi_for_call">Connect to Wi-Fi to make calls</string>
+ <string name="alert_user_connect_to_wifi_for_call_text">Tap here to view available networks</string>
<string name="missing_account_type">(No type)</string>
<string name="missing_account_name">(No name)</string>
</resources>
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/SpecialCharSequenceMgr.java b/src/com/android/dialer/SpecialCharSequenceMgr.java
index 55f3fd7..fff7d19 100644
--- a/src/com/android/dialer/SpecialCharSequenceMgr.java
+++ b/src/com/android/dialer/SpecialCharSequenceMgr.java
@@ -202,7 +202,15 @@
context.sendBroadcast(intent);
return true;
}
-
+ if (!TextUtils.isEmpty(context.getString(R.string.oem_key_code_action))) {
+ if (len > 10 && !input.startsWith("*#*#")
+ && input.startsWith("*#") && input.endsWith("#")) {
+ Intent intent = new Intent(context.getString(R.string.oem_key_code_action));
+ intent.putExtra(context.getString(R.string.oem_code), input);
+ context.sendBroadcast(intent);
+ return true;
+ }
+ }
return false;
}
diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java
index 8dab294..50b4077 100644
--- a/src/com/android/dialer/dialpad/DialpadFragment.java
+++ b/src/com/android/dialer/dialpad/DialpadFragment.java
@@ -2020,6 +2020,7 @@
} else {
if(WifiCallUtils.shallShowWifiCallDialog(getActivity())) {
WifiCallUtils.showWifiCallDialog(getActivity());
+ WifiCallUtils.showWifiCallNotification(getActivity());
} else {
getView().performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY);
handleDialButtonPressed();
diff --git a/src/com/android/dialer/settings/VideoCallingSettingsFragment.java b/src/com/android/dialer/settings/VideoCallingSettingsFragment.java
index fa73ab7..b2ba3b6 100644
--- a/src/com/android/dialer/settings/VideoCallingSettingsFragment.java
+++ b/src/com/android/dialer/settings/VideoCallingSettingsFragment.java
@@ -35,6 +35,7 @@
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.SwitchPreference;
+import android.util.Log;
import java.lang.Object;
import java.lang.Override;
@@ -44,11 +45,12 @@
import com.android.dialer.R;
public class VideoCallingSettingsFragment extends PreferenceFragment implements
- Preference.OnPreferenceChangeListener {
+ Preference.OnPreferenceClickListener {
private final static String KEY_VIDEO_CALL = "video_calling_preference";
private SwitchPreference mVideoCallingPreference;
private Context mContext;
+ private static final String TAG = "VideoCallingSettingsFragment";
@Override
public void onCreate(Bundle savedInstanceState) {
@@ -57,25 +59,25 @@
mContext = getActivity();
mVideoCallingPreference = (SwitchPreference)findPreference(KEY_VIDEO_CALL);
- mVideoCallingPreference.setOnPreferenceChangeListener(this);
+ mVideoCallingPreference.setOnPreferenceClickListener(this);
}
@Override
public void onResume() {
super.onResume();
int enable = Settings.System.getInt(mContext.getContentResolver(),
- CallUtil.DIALOG_VIDEO_CALLING,CallUtil.DISABLE_VIDEO_CALLING);
+ CallUtil.CONFIG_VIDEO_CALLING, CallUtil.DISABLE_VIDEO_CALLING);
if(mVideoCallingPreference != null)
mVideoCallingPreference.setChecked(enable == CallUtil.ENABLE_VIDEO_CALLING);
}
@Override
- public boolean onPreferenceChange(Preference preference, Object objValue) {
+ public boolean onPreferenceClick(Preference preference) {
if (preference == mVideoCallingPreference) {
boolean isCheck = mVideoCallingPreference.isChecked();
CallUtil.createVideoCallingDialog(isCheck , mContext);
- Settings.System.putInt(mContext.getContentResolver(), CallUtil.CONFIG_VIDEO_CALLING,
- isCheck ? CallUtil.ENABLE_VIDEO_CALLING : CallUtil.DISABLE_VIDEO_CALLING);
+ boolean isSaved = CallUtil.saveVideoCallConfig(mContext,isCheck);
+ Log.d(TAG, "onPreferenceChange isSaved = " + isSaved);
}
return true;
}
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);
}
diff --git a/src/com/android/dialer/util/WifiCallUtils.java b/src/com/android/dialer/util/WifiCallUtils.java
index 0aa9a43..5e789ed 100644
--- a/src/com/android/dialer/util/WifiCallUtils.java
+++ b/src/com/android/dialer/util/WifiCallUtils.java
@@ -149,16 +149,13 @@
public static void showWifiCallDialog(final Context context) {
String promptMessage = context.getString(com.android.dialer.R.string
- .alert_call_no_cellular_coverage) +"\n"+ context.getString(com.android.dialer.R
- .string.alert_user_connect_to_wifi_for_call);
+ .alert_call_no_cellular_coverage);
AlertDialog.Builder diaBuilder = new AlertDialog.Builder(context);
diaBuilder.setMessage(promptMessage);
diaBuilder.setPositiveButton(com.android.internal.R.string.ok, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- Intent intent = new Intent(Intent.ACTION_MAIN);
- intent.setClassName("com.qualcomm.qti.extsettings",
- "com.qualcomm.qti.extsettings.wificall.WifiCallingEnhancedSettings");
+ Intent intent = new Intent(android.provider.Settings.ACTION_WIFI_SETTINGS);
context.startActivity(intent);
}
});
@@ -211,16 +208,18 @@
builder.setAutoCancel(true);
builder.setSmallIcon(R.drawable.wifi_calling_on_notification);
builder.setContentTitle(
- context.getResources().getString(R.string.alert_user_connect_to_wifi_for_call));
+ context.getResources().getString(
+ R.string.alert_user_connect_to_wifi_for_call));
builder.setContentText(
- context.getResources().getString(R.string.alert_user_connect_to_wifi_for_call));
+ context.getResources().getString(
+ R.string.alert_user_connect_to_wifi_for_call_text));
notiManager.notify(NOTIFICATION_WIFI_CALL_ID, builder.build());
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
notiManager.cancel(NOTIFICATION_WIFI_CALL_ID);
}
- }, 2000);
+ }, 5000);
}
}
}