Adding ContactLoader support to suppress contact photo loading.

Bug: 17308163
Change-Id: I9d21c0d7d159bc4d81511c174480a422fac90853
diff --git a/src/com/android/contacts/common/model/ContactLoader.java b/src/com/android/contacts/common/model/ContactLoader.java
index eba825b..bea7210 100644
--- a/src/com/android/contacts/common/model/ContactLoader.java
+++ b/src/com/android/contacts/common/model/ContactLoader.java
@@ -316,7 +316,7 @@
                 resultIsCached = true;
             } else {
                 if (uriCurrentFormat.getLastPathSegment().equals(Constants.LOOKUP_URI_ENCODED)) {
-                    result = loadEncodedContactEntity(uriCurrentFormat);
+                    result = loadEncodedContactEntity(uriCurrentFormat, mLookupUri);
                 } else {
                     result = loadContactEntity(resolver, uriCurrentFormat);
                 }
@@ -349,7 +349,22 @@
         }
     }
 
-    private Contact loadEncodedContactEntity(Uri uri) throws JSONException {
+    /**
+     * Parses a {@link Contact} stored as a JSON string in a lookup URI.
+     *
+     * @param lookupUri The contact information to parse .
+     * @return The parsed {@code Contact} information.
+     * @throws JSONException
+     */
+    public static Contact parseEncodedContactEntity(Uri lookupUri)  {
+        try {
+            return loadEncodedContactEntity(lookupUri, lookupUri);
+        } catch (JSONException je) {
+            return null;
+        }
+    }
+
+    private static Contact loadEncodedContactEntity(Uri uri, Uri lookupUri) throws JSONException {
         final String jsonString = uri.getEncodedFragment();
         final JSONObject json = new JSONObject(jsonString);
 
@@ -363,7 +378,7 @@
         final String photoUri = json.optString(Contacts.PHOTO_URI, null);
         final Contact contact = new Contact(
                 uri, uri,
-                mLookupUri,
+                lookupUri,
                 directoryId,
                 null /* lookupKey */,
                 -1 /* id */,
@@ -423,7 +438,7 @@
         return contact;
     }
 
-    private void processOneRecord(RawContact rawContact, JSONObject item, String mimetype)
+    private static void processOneRecord(RawContact rawContact, JSONObject item, String mimetype)
             throws JSONException {
         final ContentValues itemValues = new ContentValues();
         itemValues.put(Data.MIMETYPE, mimetype);