summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNancy Chen <nancychen@google.com>2014-09-04 11:31:56 -0700
committerNancy Chen <nancychen@google.com>2014-09-04 11:58:21 -0700
commit5ea0dcd39ff1f29d09d7bb146d7eb20f24b32201 (patch)
treec6a737bf01faa4c25e6559943e8ea46b4d0f0aad
parent00f1764215e6bb44f2cde2f46f9e7d2a39e53893 (diff)
downloadpackages_apps_InCallUI-5ea0dcd39ff1f29d09d7bb146d7eb20f24b32201.tar.gz
packages_apps_InCallUI-5ea0dcd39ff1f29d09d7bb146d7eb20f24b32201.tar.bz2
packages_apps_InCallUI-5ea0dcd39ff1f29d09d7bb146d7eb20f24b32201.zip
Check for voicemail number earlier so it can be set at caller.
Currently the InCallUI is started before TelephonyConnectionService can set the voicemail number, which means that a lookup of the voicemail number will come up as null. We can check earlier in the process whether a call is a voicemail call by looking at the scheme of the call uri ("voicemail:") this allows the caller name to be set as "Voice Mail" before Telephony supplies additional info. Bug: 17363355 Change-Id: I9a1539a02e15da43bcd067fe7b70163720cb9bec
-rw-r--r--src/com/android/incallui/CallerInfoAsyncQuery.java17
-rw-r--r--src/com/android/incallui/CallerInfoUtils.java12
2 files changed, 19 insertions, 10 deletions
diff --git a/src/com/android/incallui/CallerInfoAsyncQuery.java b/src/com/android/incallui/CallerInfoAsyncQuery.java
index fd95458c..652788d8 100644
--- a/src/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/src/com/android/incallui/CallerInfoAsyncQuery.java
@@ -318,7 +318,7 @@ public class CallerInfoAsyncQuery {
}
/**
- * Factory method to start the query based on a number.
+ * Factory method to start the query based on a CallerInfo object.
*
* Note: if the number contains an "@" character we treat it
* as a SIP address, and look it up directly in the Data table
@@ -328,18 +328,18 @@ public class CallerInfoAsyncQuery {
* PhoneUtils.startGetCallerInfo() decide which one to call based on
* the phone type of the incoming connection.
*/
- public static CallerInfoAsyncQuery startQuery(int token, Context context, String number,
+ public static CallerInfoAsyncQuery startQuery(int token, Context context, CallerInfo info,
OnQueryCompleteListener listener, Object cookie) {
Log.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####");
- Log.d(LOG_TAG, "- number: " + number);
+ Log.d(LOG_TAG, "- number: " + info.phoneNumber);
Log.d(LOG_TAG, "- cookie: " + cookie);
// Construct the URI object and query params, and start the query.
final Uri contactRef = PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI.buildUpon()
- .appendPath(number)
+ .appendPath(info.phoneNumber)
.appendQueryParameter(PhoneLookup.QUERY_PARAMETER_SIP_ADDRESS,
- String.valueOf(PhoneNumberHelper.isUriNumber(number)))
+ String.valueOf(PhoneNumberHelper.isUriNumber(info.phoneNumber)))
.build();
if (DBG) {
@@ -353,12 +353,13 @@ public class CallerInfoAsyncQuery {
CookieWrapper cw = new CookieWrapper();
cw.listener = listener;
cw.cookie = cookie;
- cw.number = number;
+ cw.number = info.phoneNumber;
// check to see if these are recognized numbers, and use shortcuts if we can.
- if (PhoneNumberHelper.isLocalEmergencyNumber(number, context)) {
+ if (PhoneNumberHelper.isLocalEmergencyNumber(info.phoneNumber, context)) {
cw.event = EVENT_EMERGENCY_NUMBER;
- } else if (PhoneNumberUtils.isVoiceMailNumber(number)) {
+ } else if (info.isVoiceMailNumber()
+ || PhoneNumberUtils.isVoiceMailNumber(info.phoneNumber)) {
cw.event = EVENT_VOICEMAIL_NUMBER;
} else {
cw.event = EVENT_NEW_QUERY;
diff --git a/src/com/android/incallui/CallerInfoUtils.java b/src/com/android/incallui/CallerInfoUtils.java
index 9745c18e..08afcaf3 100644
--- a/src/com/android/incallui/CallerInfoUtils.java
+++ b/src/com/android/incallui/CallerInfoUtils.java
@@ -8,6 +8,7 @@ import android.telecomm.PropertyPresentation;
import android.text.TextUtils;
import android.util.Log;
+import com.android.contacts.common.CallUtil;
import com.android.contacts.common.model.Contact;
import com.android.contacts.common.model.ContactLoader;
@@ -37,14 +38,13 @@ public class CallerInfoUtils {
public static CallerInfo getCallerInfoForCall(Context context, Call call,
CallerInfoAsyncQuery.OnQueryCompleteListener listener) {
CallerInfo info = buildCallerInfo(context, call);
- String number = info.phoneNumber;
// TODO: Have phoneapp send a Uri when it knows the contact that triggered this call.
if (info.numberPresentation == PropertyPresentation.ALLOWED) {
// Start the query with the number provided from the call.
Log.d(TAG, "==> Actually starting CallerInfoAsyncQuery.startQuery()...");
- CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context, number, listener, call);
+ CallerInfoAsyncQuery.startQuery(QUERY_TOKEN, context, info, listener, call);
}
return info;
}
@@ -70,6 +70,14 @@ public class CallerInfoUtils {
number = modifyForSpecialCnapCases(context, info, number, info.numberPresentation);
info.phoneNumber = number;
}
+
+ // Because the InCallUI is immediately launched before the call is connected, occasionally
+ // a voicemail call will be passed to InCallUI as a "voicemail:" URI without a number.
+ // This call should still be handled as a voicemail call.
+ if (CallUtil.SCHEME_VOICEMAIL.equals(call.getHandle().getScheme())) {
+ info.markAsVoiceMail(context);
+ }
+
return info;
}