Fixes in responding call via sms
* Fix wrong message sent toast when rejected a call
When a call was rejected with an empty text message,
Telecomm displaying Message Sent toast message, but Mms
application discarding empty message. Display toast message
if message is not empty only.
* Fix display contact name in toast while responding call via sms
Send contact number to sms application instead of contact
name when number saved in contacts while responding
call via sms
Bug: 34870111
Change-Id: I5ae152482c5c467cd5748571effb69042532c5fe
diff --git a/src/com/android/server/telecom/RespondViaSmsManager.java b/src/com/android/server/telecom/RespondViaSmsManager.java
index 6b2a39e..a42513d 100644
--- a/src/com/android/server/telecom/RespondViaSmsManager.java
+++ b/src/com/android/server/telecom/RespondViaSmsManager.java
@@ -38,6 +38,7 @@
import android.telephony.TelephonyManager;
import android.text.Spannable;
import android.text.SpannableString;
+import android.text.TextUtils;
import android.widget.Toast;
import java.util.ArrayList;
@@ -137,7 +138,7 @@
int subId = mCallsManager.getPhoneAccountRegistrar().getSubscriptionIdForPhoneAccount(
call.getTargetPhoneAccount());
rejectCallWithMessage(call.getContext(), call.getHandle().getSchemeSpecificPart(),
- textMessage, subId);
+ textMessage, subId, call.getName());
}
}
@@ -176,8 +177,8 @@
* Reject the call with the specified message. If message is null this call is ignored.
*/
private void rejectCallWithMessage(Context context, String phoneNumber, String textMessage,
- int subId) {
- if (textMessage != null) {
+ int subId, String contactName) {
+ if (!TextUtils.isEmpty(textMessage)) {
final ComponentName component =
SmsApplication.getDefaultRespondViaMessageApplication(context,
true /*updateIfNeeded*/);
@@ -191,7 +192,7 @@
}
SomeArgs args = SomeArgs.obtain();
- args.arg1 = phoneNumber;
+ args.arg1 = !TextUtils.isEmpty(contactName) ? contactName : phoneNumber;
args.arg2 = context;
mHandler.obtainMessage(MSG_SHOW_SENT_TOAST, args).sendToTarget();
intent.setComponent(component);