summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMakoto Onuki <omakoto@google.com>2014-07-08 17:56:03 -0700
committerMakoto Onuki <omakoto@google.com>2014-07-10 11:22:47 -0700
commit76855c20de037a38b02716642cd27be674772f2d (patch)
tree31455880d2abf7a3ea271c468f6f68f9c7f7907e
parent05d1440049e389568a9357a8b59bdfff05f26375 (diff)
Use enterprise caller-id in incall.
- Use PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI for caller-id. - Removed a bunch of unused code. - Renamed fields that will have different semantics. e.g. contactId now will be 0 and lookupUri null for corp contacts. - Simplify the sip caller-id lookup. The regular caller-id lookup can also do SIP. The original code (http://ag/70555) was written before CP2 supported it (http://ag/147367). This needs QAing. - Instead of passing around a contact-id to later load a contact picture, use the picture URI returned from the API. Bug 15779911 Change-Id: Ia755b9079d03d9236f824c2f1102a6fa902b2097
-rw-r--r--InCallUI/src/com/android/incallui/CallCardPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfo.java112
-rw-r--r--InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java111
-rw-r--r--InCallUI/src/com/android/incallui/ContactInfoCache.java39
-rw-r--r--InCallUI/src/com/android/incallui/ContactsAsyncHelper.java97
-rw-r--r--InCallUI/src/com/android/incallui/Log.java2
6 files changed, 83 insertions, 282 deletions
diff --git a/InCallUI/src/com/android/incallui/CallCardPresenter.java b/InCallUI/src/com/android/incallui/CallCardPresenter.java
index 9d3148a8c..9a233f533 100644
--- a/InCallUI/src/com/android/incallui/CallCardPresenter.java
+++ b/InCallUI/src/com/android/incallui/CallCardPresenter.java
@@ -271,8 +271,8 @@ public class CallCardPresenter extends Presenter<CallCardPresenter.CallCardUi>
if (entry.name != null) {
Log.d(TAG, "Contact found: " + entry);
}
- if (entry.personUri != null) {
- CallerInfoUtils.sendViewNotification(mContext, entry.personUri);
+ if (entry.contactUri != null) {
+ CallerInfoUtils.sendViewNotification(mContext, entry.contactUri);
}
}
diff --git a/InCallUI/src/com/android/incallui/CallerInfo.java b/InCallUI/src/com/android/incallui/CallerInfo.java
index 1650fbb05..a5ab07c64 100644
--- a/InCallUI/src/com/android/incallui/CallerInfo.java
+++ b/InCallUI/src/com/android/incallui/CallerInfo.java
@@ -90,11 +90,19 @@ public class CallerInfo {
public String numberLabel;
public int photoResource;
- public long person_id;
- public String lookupKey;
+
+ // Contact ID, which will be 0 if a contact comes from the corp CP2.
+ public long contactIdOrZero;
+ public String lookupKeyOrNull;
public boolean needUpdate;
public Uri contactRefUri;
+ /**
+ * Contact display photo URI. If a contact has no display photo but a thumbnail, it'll be
+ * the thumbnail URI instead.
+ */
+ public Uri contactDisplayPhotoUri;
+
// fields to hold individual contact preference data,
// including the send to voicemail flag and the ringtone
// uri reference.
@@ -204,15 +212,13 @@ public class CallerInfo {
// Look for the person_id.
columnIndex = getColumnIndexForPersonId(contactRef, cursor);
if (columnIndex != -1) {
- info.person_id = cursor.getLong(columnIndex);
- Log.v(TAG, "==> got info.person_id: " + info.person_id);
+ info.contactIdOrZero = cursor.getLong(columnIndex);
+ Log.v(TAG, "==> got info.contactIdOrZero: " + info.contactIdOrZero);
// cache the lookup key for later use with person_id to create lookup URIs
columnIndex = cursor.getColumnIndex(PhoneLookup.LOOKUP_KEY);
- if ((columnIndex != -1) && (cursor.getString(columnIndex) != null)) {
- info.lookupKey = cursor.getString(columnIndex);
- } else {
- info.lookupKey = null;
+ if (columnIndex != -1) {
+ info.lookupKeyOrNull = cursor.getString(columnIndex);
}
} else {
// No valid columnIndex, so we can't look up person_id.
@@ -222,6 +228,14 @@ public class CallerInfo {
// the in-call UI, for example.)
}
+ // Display photo URI.
+ columnIndex = cursor.getColumnIndex(PhoneLookup.PHOTO_URI);
+ if ((columnIndex != -1) && (cursor.getString(columnIndex) != null)) {
+ info.contactDisplayPhotoUri = Uri.parse(cursor.getString(columnIndex));
+ } else {
+ info.contactDisplayPhotoUri = null;
+ }
+
// look for the custom ringtone, create from the string stored
// in the database.
columnIndex = cursor.getColumnIndex(PhoneLookup.CUSTOM_RINGTONE);
@@ -256,53 +270,13 @@ public class CallerInfo {
* @return the CallerInfo which contains the caller id for the given
* number. The returned CallerInfo is null if no number is supplied.
*/
- public static CallerInfo getCallerInfo(Context context, Uri contactRef) {
+ private static CallerInfo getCallerInfo(Context context, Uri contactRef) {
return getCallerInfo(context, contactRef,
context.getContentResolver().query(contactRef, null, null, null, null));
}
/**
- * getCallerInfo given a phone number, look up in the call-log database
- * for the matching caller id info.
- * @param context the context used to get the ContentResolver
- * @param number the phone number used to lookup caller id
- * @return the CallerInfo which contains the caller id for the given
- * number. The returned CallerInfo is null if no number is supplied. If
- * a matching number is not found, then a generic caller info is returned,
- * with all relevant fields empty or null.
- */
- public static CallerInfo getCallerInfo(Context context, String number) {
- Log.v(TAG, "getCallerInfo() based on number...");
-
- if (TextUtils.isEmpty(number)) {
- return null;
- }
-
- // Change the callerInfo number ONLY if it is an emergency number
- // or if it is the voicemail number. If it is either, take a
- // shortcut and skip the query.
- if (PhoneNumberHelper.isLocalEmergencyNumber(number, context)) {
- return new CallerInfo().markAsEmergency(context);
- } else if (PhoneNumberUtils.isVoiceMailNumber(number)) {
- return new CallerInfo().markAsVoiceMail(context);
- }
-
- Uri contactUri = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
-
- CallerInfo info = getCallerInfo(context, contactUri);
- info = doSecondaryLookupIfNecessary(context, number, info);
-
- // if no query results were returned with a viable number,
- // fill in the original number value we used to query with.
- if (TextUtils.isEmpty(info.phoneNumber)) {
- info.phoneNumber = number;
- }
-
- return info;
- }
-
- /**
* Performs another lookup if previous lookup fails and it's a SIP call
* and the peer's username is all numeric. Look up the username as it
* could be a PSTN number in the contact database.
@@ -319,46 +293,13 @@ public class CallerInfo {
String username = PhoneNumberHelper.getUsernameFromUriNumber(number);
if (PhoneNumberUtils.isGlobalPhoneNumber(username)) {
previousResult = getCallerInfo(context,
- Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI,
+ Uri.withAppendedPath(PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI,
Uri.encode(username)));
}
}
return previousResult;
}
- /**
- * getCallerId: a convenience method to get the caller id for a given
- * number.
- *
- * @param context the context used to get the ContentResolver.
- * @param number a phone number.
- * @return if the number belongs to a contact, the contact's name is
- * returned; otherwise, the number itself is returned.
- *
- * TODO NOTE: This MAY need to refer to the Asynchronous Query API
- * [startQuery()], instead of getCallerInfo, but since it looks like
- * it is only being used by the provider calls in the messaging app:
- * 1. android.provider.Telephony.Mms.getDisplayAddress()
- * 2. android.provider.Telephony.Sms.getDisplayAddress()
- * We may not need to make the change.
- */
- public static String getCallerId(Context context, String number) {
- CallerInfo info = getCallerInfo(context, number);
- String callerID = null;
-
- if (info != null) {
- String name = info.name;
-
- if (!TextUtils.isEmpty(name)) {
- callerID = name;
- } else {
- callerID = number;
- }
- }
-
- return callerID;
- }
-
// Accessors
/**
@@ -589,10 +530,11 @@ public class CallerInfo {
.append("\nnumberType: " + numberType)
.append("\nnumberLabel: " + numberLabel)
.append("\nphotoResource: " + photoResource)
- .append("\nperson_id: " + person_id)
+ .append("\ncontactIdOrZero: " + contactIdOrZero)
.append("\nneedUpdate: " + needUpdate)
.append("\ncontactRefUri: " + contactRefUri)
- .append("\ncontactRingtoneUri: " + contactRefUri)
+ .append("\ncontactRingtoneUri: " + contactRingtoneUri)
+ .append("\ncontactDisplayPhotoUri: " + contactDisplayPhotoUri)
.append("\nshouldSendToVoicemail: " + shouldSendToVoicemail)
.append("\ncachedPhoto: " + cachedPhoto)
.append("\nisCachedPhotoCurrent: " + isCachedPhotoCurrent)
diff --git a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
index 4a2b4fbf0..fd95458c8 100644
--- a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
+++ b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java
@@ -24,8 +24,7 @@ import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
-import android.provider.ContactsContract.CommonDataKinds.SipAddress;
-import android.provider.ContactsContract.Data;
+import android.provider.ContactsContract;
import android.provider.ContactsContract.PhoneLookup;
import android.telephony.PhoneNumberUtils;
import android.text.TextUtils;
@@ -33,6 +32,7 @@ import android.text.TextUtils;
import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.contacts.common.util.TelephonyManagerUtils;
+import java.util.Arrays;
import java.util.Locale;
/**
@@ -95,6 +95,20 @@ public class CallerInfoAsyncQuery {
*/
private class CallerInfoAsyncQueryHandler extends AsyncQueryHandler {
+ @Override
+ public void startQuery(int token, Object cookie, Uri uri, String[] projection,
+ String selection, String[] selectionArgs, String orderBy) {
+ if (DBG) {
+ // Show stack trace with the arguments.
+ android.util.Log.d(LOG_TAG, "InCall: startQuery: url=" + uri +
+ " projection=[" + Arrays.toString(projection) + "]" +
+ " selection=" + selection + " " +
+ " args=[" + Arrays.toString(selectionArgs) + "]",
+ new RuntimeException("STACKTRACE"));
+ }
+ super.startQuery(token, cookie, uri, projection, selection, selectionArgs, orderBy);
+ }
+
/**
* The information relevant to each CallerInfo query. Each query may have multiple
* listeners, so each AsyncCursorInfo is associated with 2 or more CookieWrapper
@@ -303,29 +317,6 @@ public class CallerInfoAsyncQuery {
private CallerInfoAsyncQuery() {
}
-
- /**
- * Factory method to start query with a Uri query spec
- */
- public static CallerInfoAsyncQuery startQuery(int token, Context context, Uri contactRef,
- OnQueryCompleteListener listener, Object cookie) {
-
- CallerInfoAsyncQuery c = new CallerInfoAsyncQuery();
- c.allocate(context, contactRef);
-
- Log.d(LOG_TAG, "starting query for URI: " + contactRef + " handler: " + c.toString());
-
- //create cookieWrapper, start query
- CookieWrapper cw = new CookieWrapper();
- cw.listener = listener;
- cw.cookie = cookie;
- cw.event = EVENT_NEW_QUERY;
-
- c.mHandler.startQuery(token, cw, contactRef, null, null, null, null);
-
- return c;
- }
-
/**
* Factory method to start the query based on a number.
*
@@ -340,56 +331,19 @@ public class CallerInfoAsyncQuery {
public static CallerInfoAsyncQuery startQuery(int token, Context context, String number,
OnQueryCompleteListener listener, Object cookie) {
Log.d(LOG_TAG, "##### CallerInfoAsyncQuery startQuery()... #####");
- Log.d(LOG_TAG, "- number: " + /* number */"xxxxxxx");
+ Log.d(LOG_TAG, "- number: " + number);
Log.d(LOG_TAG, "- cookie: " + cookie);
// Construct the URI object and query params, and start the query.
- Uri contactRef;
- String selection;
- String[] selectionArgs;
-
- if (PhoneNumberHelper.isUriNumber(number)) {
- // "number" is really a SIP address.
- Log.d(LOG_TAG, " - Treating number as a SIP address: " + /* number */"xxxxxxx");
-
- // We look up SIP addresses directly in the Data table:
- contactRef = Data.CONTENT_URI;
-
- // Note Data.DATA1 and SipAddress.SIP_ADDRESS are equivalent.
- //
- // Also note we use "upper(data1)" in the WHERE clause, and
- // uppercase the incoming SIP address, in order to do a
- // case-insensitive match.
- //
- // TODO: need to confirm that the use of upper() doesn't
- // prevent us from using the index! (Linear scan of the whole
- // contacts DB can be very slow.)
- //
- // TODO: May also need to normalize by adding "sip:" as a
- // prefix, if we start storing SIP addresses that way in the
- // database.
-
- selection = "upper(" + Data.DATA1 + ")=?"
- + " AND "
- + Data.MIMETYPE + "='" + SipAddress.CONTENT_ITEM_TYPE + "'";
- selectionArgs = new String[] { number.toUpperCase() };
-
- } else {
- // "number" is a regular phone number. Use the PhoneLookup table:
- contactRef = Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, Uri.encode(number));
- selection = null;
- selectionArgs = null;
- }
+ final Uri contactRef = PhoneLookup.ENTERPRISE_CONTENT_FILTER_URI.buildUpon()
+ .appendPath(number)
+ .appendQueryParameter(PhoneLookup.QUERY_PARAMETER_SIP_ADDRESS,
+ String.valueOf(PhoneNumberHelper.isUriNumber(number)))
+ .build();
if (DBG) {
Log.d(LOG_TAG, "==> contactRef: " + sanitizeUriToString(contactRef));
- Log.d(LOG_TAG, "==> selection: " + selection);
- if (selectionArgs != null) {
- for (int i = 0; i < selectionArgs.length; i++) {
- Log.d(LOG_TAG, "==> selectionArgs[" + i + "]: " + selectionArgs[i]);
- }
- }
}
CallerInfoAsyncQuery c = new CallerInfoAsyncQuery();
@@ -414,30 +368,13 @@ public class CallerInfoAsyncQuery {
cw, // cookie
contactRef, // uri
null, // projection
- selection, // selection
- selectionArgs, // selectionArgs
+ null, // selection
+ null, // selectionArgs
null); // orderBy
return c;
}
/**
- * Method to add listeners to a currently running query
- */
- public void addQueryListener(int token, OnQueryCompleteListener listener, Object cookie) {
-
- Log.d(this, "adding listener to query: " + sanitizeUriToString(mHandler.mQueryUri) +
- " handler: " + mHandler.toString());
-
- //create cookieWrapper, add query request to end of queue.
- CookieWrapper cw = new CookieWrapper();
- cw.listener = listener;
- cw.cookie = cookie;
- cw.event = EVENT_ADD_LISTENER;
-
- mHandler.startQuery(token, cw, null, null, null, null, null);
- }
-
- /**
* Method to create a new CallerInfoAsyncQueryHandler object, ensuring correct
* state of context and uri.
*/
diff --git a/InCallUI/src/com/android/incallui/ContactInfoCache.java b/InCallUI/src/com/android/incallui/ContactInfoCache.java
index 7015d2bd3..22ca88e4e 100644
--- a/InCallUI/src/com/android/incallui/ContactInfoCache.java
+++ b/InCallUI/src/com/android/incallui/ContactInfoCache.java
@@ -16,7 +16,6 @@
package com.android.incallui;
-import android.content.ContentUris;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
@@ -32,14 +31,12 @@ import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.incallui.service.PhoneNumberService;
import com.android.incalluibind.ServiceFactory;
import com.android.services.telephony.common.MoreStrings;
-import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.common.base.Objects;
import com.google.common.base.Preconditions;
import java.util.HashMap;
-import java.util.List;
import java.util.Set;
/**
@@ -173,12 +170,12 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
final PhoneNumberServiceListener listener = new PhoneNumberServiceListener(callId);
mPhoneNumberService.getPhoneNumberInfo(cacheEntry.number, listener, listener,
isIncoming);
- } else if (cacheEntry.personUri != null) {
+ } else if (cacheEntry.displayPhotoUri != null) {
Log.d(TAG, "Contact lookup. Local contact found, starting image load");
// Load the image with a callback to update the image state.
// When the load is finished, onImageLoadComplete() will be called.
ContactsAsyncHelper.startObtainPhotoAsync(TOKEN_UPDATE_PHOTO_FOR_CALL_STATE,
- mContext, cacheEntry.personUri, ContactInfoCache.this, callId);
+ mContext, cacheEntry.displayPhotoUri, ContactInfoCache.this, callId);
} else {
if (callerInfo.contactExists) {
Log.d(TAG, "Contact lookup done. Local contact found, no image.");
@@ -317,26 +314,17 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
} else {
photo = context.getResources().getDrawable(R.drawable.picture_unknown);
}
- } else if (info.person_id == 0) {
+ } else if (info.contactDisplayPhotoUri == null) {
photo = context.getResources().getDrawable(R.drawable.picture_unknown);
} else {
- Uri personUri = ContentUris.withAppendedId(Contacts.CONTENT_URI, info.person_id);
- Log.d(TAG, "- got personUri: '" + personUri + "', based on info.person_id: " +
- info.person_id);
-
- if (personUri == null) {
- Log.v(TAG, "personUri is null. Just use unknown picture.");
- photo = context.getResources().getDrawable(R.drawable.picture_unknown);
- } else {
- cce.personUri = personUri;
- }
+ cce.displayPhotoUri = info.contactDisplayPhotoUri;
+ }
- if (info.lookupKey == null) {
- Log.v(TAG, "lookup key is null. Don't create a lookup uri.");
- cce.lookupUri = null;
- } else {
- cce.lookupUri = Contacts.getLookupUri(info.person_id, info.lookupKey);
- }
+ if (info.lookupKeyOrNull == null || info.contactIdOrZero == 0) {
+ Log.v(TAG, "lookup key is null or contact ID is 0. Don't create a lookup uri.");
+ cce.lookupUri = null;
+ } else {
+ cce.lookupUri = Contacts.getLookupUri(info.contactIdOrZero, info.lookupKeyOrNull);
}
cce.photo = photo;
@@ -511,7 +499,10 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
public String label;
public Drawable photo;
public boolean isSipCall;
- public Uri personUri; // Used for local photo load
+ /** This will be used for the "view" notification. */
+ public Uri contactUri;
+ /** Either a display photo or a thumbnail URI. */
+ public Uri displayPhotoUri;
public Uri lookupUri; // Sent to NotificationMananger
@Override
@@ -523,6 +514,8 @@ public class ContactInfoCache implements ContactsAsyncHelper.OnImageLoadComplete
.add("label", label)
.add("photo", photo)
.add("isSipCall", isSipCall)
+ .add("contactUri", contactUri)
+ .add("displayPhotoUri", displayPhotoUri)
.toString();
}
}
diff --git a/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java b/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java
index 395fbfdde..011eef2ac 100644
--- a/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java
+++ b/InCallUI/src/com/android/incallui/ContactsAsyncHelper.java
@@ -19,6 +19,7 @@ package com.android.incallui;
import android.app.Notification;
import android.content.ContentUris;
import android.content.Context;
+import android.content.res.AssetFileDescriptor;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
@@ -68,7 +69,7 @@ public class ContactsAsyncHelper {
case EVENT_LOAD_IMAGE:
if (args.listener != null) {
Log.d(this, "Notifying listener: " + args.listener.toString() +
- " image: " + args.uri + " completed");
+ " image: " + args.displayPhotoUri + " completed");
args.listener.onImageLoadComplete(msg.what, args.photo, args.photoIcon,
args.cookie);
}
@@ -91,7 +92,7 @@ public class ContactsAsyncHelper {
private static final class WorkerArgs {
public Context context;
- public Uri uri;
+ public Uri displayPhotoUri;
public Drawable photo;
public Bitmap photoIcon;
public Object cookie;
@@ -99,78 +100,6 @@ public class ContactsAsyncHelper {
}
/**
- * public inner class to help out the ContactsAsyncHelper callers
- * with tracking the state of the CallerInfo Queries and image
- * loading.
- *
- * Logic contained herein is used to remove the race conditions
- * that exist as the CallerInfo queries run and mix with the image
- * loads, which then mix with the Phone state changes.
- */
- public static class ImageTracker {
-
- // Image display states
- public static final int DISPLAY_UNDEFINED = 0;
- public static final int DISPLAY_IMAGE = -1;
- public static final int DISPLAY_DEFAULT = -2;
-
- // State of the image on the imageview.
- private CallerInfo mCurrentCallerInfo;
- private int displayMode;
-
- public ImageTracker() {
- mCurrentCallerInfo = null;
- displayMode = DISPLAY_UNDEFINED;
- }
-
- /**
- * Used to see if the requested call / connection has a
- * different caller attached to it than the one we currently
- * have in the CallCard.
- */
- public boolean isDifferentImageRequest(CallerInfo ci) {
- // note, since the connections are around for the lifetime of the
- // call, and the CallerInfo-related items as well, we can
- // definitely use a simple != comparison.
- return (mCurrentCallerInfo != ci);
- }
-
- /**
- * Simple setter for the CallerInfo object.
- */
- public void setPhotoRequest(CallerInfo info) {
- mCurrentCallerInfo = info;
- }
-
- /**
- * Convenience method used to retrieve the URI
- * representing the Photo file recorded in the attached
- * CallerInfo Object.
- */
- public Uri getPhotoUri() {
- if (mCurrentCallerInfo != null) {
- return ContentUris.withAppendedId(Contacts.CONTENT_URI,
- mCurrentCallerInfo.person_id);
- }
- return null;
- }
-
- /**
- * Simple setter for the Photo state.
- */
- public void setPhotoState(int state) {
- displayMode = state;
- }
-
- /**
- * Simple getter for the Photo state.
- */
- public int getPhotoState() {
- return displayMode;
- }
- }
-
- /**
* Thread worker class that handles the task of opening the stream and loading
* the images.
*/
@@ -188,27 +117,27 @@ public class ContactsAsyncHelper {
InputStream inputStream = null;
try {
try {
- inputStream = Contacts.openContactPhotoInputStream(
- args.context.getContentResolver(), args.uri, true);
+ inputStream = args.context.getContentResolver()
+ .openInputStream(args.displayPhotoUri);
} catch (Exception e) {
Log.e(this, "Error opening photo input stream", e);
}
if (inputStream != null) {
args.photo = Drawable.createFromStream(inputStream,
- args.uri.toString());
+ args.displayPhotoUri.toString());
// This assumes Drawable coming from contact database is usually
// BitmapDrawable and thus we can have (down)scaled version of it.
args.photoIcon = getPhotoIconWhenAppropriate(args.context, args.photo);
Log.d(ContactsAsyncHelper.this, "Loading image: " + msg.arg1 +
- " token: " + msg.what + " image URI: " + args.uri);
+ " token: " + msg.what + " image URI: " + args.displayPhotoUri);
} else {
args.photo = null;
args.photoIcon = null;
Log.d(ContactsAsyncHelper.this, "Problem with image: " + msg.arg1 +
- " token: " + msg.what + " image URI: " + args.uri +
+ " token: " + msg.what + " image URI: " + args.displayPhotoUri +
", using default image.");
}
} finally {
@@ -284,7 +213,7 @@ public class ContactsAsyncHelper {
* @param token Arbitrary integer which will be returned as the first argument of
* {@link OnImageLoadCompleteListener#onImageLoadComplete(int, Drawable, Bitmap, Object)}
* @param context Context object used to do the time-consuming operation.
- * @param personUri Uri to be used to fetch the photo
+ * @param displayPhotoUri Uri to be used to fetch the photo
* @param listener Callback object which will be used when the asynchronous load is done.
* Can be null, which means only the asynchronous load is done while there's no way to
* obtain the loaded photos.
@@ -292,11 +221,11 @@ public class ContactsAsyncHelper {
* fourth argument of {@link OnImageLoadCompleteListener#onImageLoadComplete(int, Drawable,
* Bitmap, Object)}. Can be null, at which the callback will also has null for the argument.
*/
- public static final void startObtainPhotoAsync(int token, Context context, Uri personUri,
+ public static final void startObtainPhotoAsync(int token, Context context, Uri displayPhotoUri,
OnImageLoadCompleteListener listener, Object cookie) {
// in case the source caller info is null, the URI will be null as well.
// just update using the placeholder image in this case.
- if (personUri == null) {
+ if (displayPhotoUri == null) {
Log.wtf("startObjectPhotoAsync", "Uri is missing");
return;
}
@@ -308,7 +237,7 @@ public class ContactsAsyncHelper {
WorkerArgs args = new WorkerArgs();
args.cookie = cookie;
args.context = context;
- args.uri = personUri;
+ args.displayPhotoUri = displayPhotoUri;
args.listener = listener;
// setup message arguments
@@ -316,7 +245,7 @@ public class ContactsAsyncHelper {
msg.arg1 = EVENT_LOAD_IMAGE;
msg.obj = args;
- Log.d("startObjectPhotoAsync", "Begin loading image: " + args.uri +
+ Log.d("startObjectPhotoAsync", "Begin loading image: " + args.displayPhotoUri +
", displaying default image for now.");
// notify the thread to begin working
diff --git a/InCallUI/src/com/android/incallui/Log.java b/InCallUI/src/com/android/incallui/Log.java
index c859e5c6a..6bf993a49 100644
--- a/InCallUI/src/com/android/incallui/Log.java
+++ b/InCallUI/src/com/android/incallui/Log.java
@@ -22,7 +22,7 @@ package com.android.incallui;
public class Log {
// Generic tag for all In Call logging
- private static final String TAG = "InCall";
+ public static final String TAG = "InCall";
public static final boolean DEBUG = android.util.Log.isLoggable(TAG, android.util.Log.DEBUG);
public static final boolean VERBOSE = android.util.Log.isLoggable(TAG,