Promotion of atel.lnx.2.0-00049.
CRs Change ID Subject
--------------------------------------------------------------------------------------------------------------
1113519 If1523b626995ed6de1aa4ff93e9378fe81063281 IMS: Support Call deflect and ECT with static number
Change-Id: Ic3eb29f1aa15d1c20b78d2b514d2da42722e4962
CRs-Fixed: 1113519
diff --git a/InCallUI/res/values/qticonfig.xml b/InCallUI/res/values/qticonfig.xml
index 7cf7410..41c6298 100644
--- a/InCallUI/res/values/qticonfig.xml
+++ b/InCallUI/res/values/qticonfig.xml
@@ -50,4 +50,6 @@
<bool name="config_show_hd2">false</bool>
<!-- Config to enalbe call record -->
<bool name="enable_call_record">false</bool>
+ <!-- Config to enable call deflect or ECT with static number -->
+ <bool name="config_ims_call_deflect_static_number_enable">false</bool>
</resources>
diff --git a/InCallUI/src/com/android/incallui/AnswerFragment.java b/InCallUI/src/com/android/incallui/AnswerFragment.java
index 11cdfda..bde346b 100644
--- a/InCallUI/src/com/android/incallui/AnswerFragment.java
+++ b/InCallUI/src/com/android/incallui/AnswerFragment.java
@@ -278,14 +278,18 @@
}
public void onDeflectNumberSelect(Context context) {
- getPresenter().setDeflectCallId();
- Intent dialogIntent = new Intent("com.qti.editnumber.INTENT_ACTION_LAUNCH_DIALOG");
- dialogIntent.putExtra(QtiCallUtils.INTENT_EXTRA_DIALOG_TITLE,
- getResources().getString(R.string.qti_deflect_title));
- try {
- startActivityForResult(dialogIntent, QtiCallUtils.ACTIVITY_REQUEST_ENTER_NUMBER);
- } catch (ActivityNotFoundException e) {
- Log.e(this, "Unable to launch EditNumberUI Dialog");
+ if (QtiCallUtils.useStaticNumberForCallDeflectOrTranfer(context)) {
+ getPresenter().onDeflect(getContext(), null);
+ } else {
+ getPresenter().setDeflectCallId();
+ Intent dialogIntent = new Intent("com.qti.editnumber.INTENT_ACTION_LAUNCH_DIALOG");
+ dialogIntent.putExtra(QtiCallUtils.INTENT_EXTRA_DIALOG_TITLE,
+ getResources().getString(R.string.qti_deflect_title));
+ try {
+ startActivityForResult(dialogIntent, QtiCallUtils.ACTIVITY_REQUEST_ENTER_NUMBER);
+ } catch (ActivityNotFoundException e) {
+ Log.e(this, "Unable to launch EditNumberUI Dialog");
+ }
}
}
diff --git a/InCallUI/src/com/android/incallui/AnswerPresenter.java b/InCallUI/src/com/android/incallui/AnswerPresenter.java
index ca08b52..006f863 100644
--- a/InCallUI/src/com/android/incallui/AnswerPresenter.java
+++ b/InCallUI/src/com/android/incallui/AnswerPresenter.java
@@ -365,6 +365,16 @@
return;
}
+ if (QtiCallUtils.useStaticNumberForCallDeflectOrTranfer(context)) {
+ deflectCallNumber = QtiImsExtUtils.getCallDeflectNumber(
+ context.getContentResolver());
+ /* If not set properly, inform user via toast */
+ if (deflectCallNumber == null) {
+ Log.w(this, "getCallDeflectNumber is null or Empty.");
+ QtiCallUtils.displayToast(context, R.string.qti_description_deflect_error);
+ return;
+ }
+ }
Log.d(this, "onDeflect mCallId:" + mCallId + "deflectCallNumber:" + deflectCallNumber);
int phoneId = 0;
diff --git a/InCallUI/src/com/android/incallui/CallButtonFragment.java b/InCallUI/src/com/android/incallui/CallButtonFragment.java
index bd76096..83ad213 100644
--- a/InCallUI/src/com/android/incallui/CallButtonFragment.java
+++ b/InCallUI/src/com/android/incallui/CallButtonFragment.java
@@ -327,14 +327,20 @@
}
public void onCallTransferNumberSelect(Context context) {
- getPresenter().setCallTransferCallId();
- Intent dialogIntent = new Intent("com.qti.editnumber.INTENT_ACTION_LAUNCH_DIALOG");
- dialogIntent.putExtra(QtiCallUtils.INTENT_EXTRA_DIALOG_TITLE,
- getResources().getString(R.string.qti_call_transfer_title));
- try {
- startActivityForResult(dialogIntent, QtiCallUtils.ACTIVITY_REQUEST_ENTER_NUMBER);
- } catch (ActivityNotFoundException e) {
- Log.e(this, "Unable to launch EditNumberUI Dialog");
+ if (QtiCallUtils.useStaticNumberForCallDeflectOrTranfer(context)) {
+ if (mCallTransferType != INVALID_CALL_TRANSFER_TYPE) {
+ getPresenter().callTransferClicked(mCallTransferType, null);
+ }
+ } else {
+ getPresenter().setCallTransferCallId();
+ Intent dialogIntent = new Intent("com.qti.editnumber.INTENT_ACTION_LAUNCH_DIALOG");
+ dialogIntent.putExtra(QtiCallUtils.INTENT_EXTRA_DIALOG_TITLE,
+ getResources().getString(R.string.qti_call_transfer_title));
+ try {
+ startActivityForResult(dialogIntent, QtiCallUtils.ACTIVITY_REQUEST_ENTER_NUMBER);
+ } catch (ActivityNotFoundException e) {
+ Log.e(this, "Unable to launch EditNumberUI Dialog");
+ }
}
}
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
index f94f81a..de49fff 100644
--- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java
@@ -453,6 +453,13 @@
public void callTransferClicked(int type, String number) {
Context mContext = getUi().getContext();
+ if (QtiCallUtils.useStaticNumberForCallDeflectOrTranfer(mContext)) {
+ number = QtiImsExtUtils.getCallDeflectNumber(mContext.getContentResolver());
+ if (number == null) {
+ QtiCallUtils.displayToast(mContext, R.string.qti_ims_transfer_num_error);
+ return;
+ }
+ }
boolean status = mCall.sendCallTransferRequest(type, number);
if (!status) {
QtiCallUtils.displayToast(mContext, R.string.qti_ims_transfer_request_error);
diff --git a/InCallUI/src/com/android/incallui/QtiCallUtils.java b/InCallUI/src/com/android/incallui/QtiCallUtils.java
index 21c9fc2..395fdfe 100644
--- a/InCallUI/src/com/android/incallui/QtiCallUtils.java
+++ b/InCallUI/src/com/android/incallui/QtiCallUtils.java
@@ -605,4 +605,17 @@
public static void setDeflectOrTransferCallId(String CallId) {
mEditNumberCallId = CallId;
}
+
+ /**
+ * Checks the boolean flag in config file to enable call deflect or ECT
+ * feature with static number in ims settings
+ */
+ public static boolean useStaticNumberForCallDeflectOrTranfer(Context context) {
+ if (context == null) {
+ Log.w(context, "Context is null...");
+ return false;
+ }
+ return context.getResources().getBoolean(
+ R.bool.config_ims_call_deflect_static_number_enable);
+ }
}