diff options
author | Nancy Chen <nancychen@google.com> | 2014-09-04 22:54:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-04 22:54:02 +0000 |
commit | 19740915793f6aff39e1b1d45bcd90cf67915791 (patch) | |
tree | 8cfa5922b20bbed65213acb19a35b43f782ea64b /InCallUI | |
parent | a556465b9bbfcd89e446a89d4d9b91da5b68897e (diff) | |
parent | c8ba254b3383810c61786aec1269d2beac263483 (diff) |
Merge "Check for voicemail number earlier so it can be set at caller." into lmp-dev
Diffstat (limited to 'InCallUI')
-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; } |