diff options
author | Nancy Chen <nancychen@google.com> | 2014-09-04 11:31:56 -0700 |
---|---|---|
committer | Nancy Chen <nancychen@google.com> | 2014-09-04 11:58:21 -0700 |
commit | c8ba254b3383810c61786aec1269d2beac263483 (patch) | |
tree | 02ec8bafa50d7bc1739f0c1d09718c3ba689f23f | |
parent | 53822896feb84415af3d3e4e7229fffafd680fdd (diff) |
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-- | InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java | 17 | ||||
-rw-r--r-- | InCallUI/src/com/android/incallui/CallerInfoUtils.java | 12 |
2 files changed, 19 insertions, 10 deletions
diff --git a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java index fd95458c8..652788d8c 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java +++ b/InCallUI/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/InCallUI/src/com/android/incallui/CallerInfoUtils.java b/InCallUI/src/com/android/incallui/CallerInfoUtils.java index 9745c18e7..08afcaf32 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoUtils.java +++ b/InCallUI/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; } |