Don't send view notification before showing quick contact

Instead, do this in the second load.  This directly affects the quick contact
startup time.

Bug 6529921

Change-Id: Ief7bda9bd32cb4be0c86c4b79efb35da812721dc
diff --git a/src/com/android/contacts/ContactLoader.java b/src/com/android/contacts/ContactLoader.java
index ab2ac41..10579f3 100644
--- a/src/com/android/contacts/ContactLoader.java
+++ b/src/com/android/contacts/ContactLoader.java
@@ -84,22 +84,25 @@
     private boolean mLoadGroupMetaData;
     private boolean mLoadStreamItems;
     private boolean mLoadInvitableAccountTypes;
+    private boolean mPostViewNotification;
     private Result mContact;
     private ForceLoadContentObserver mObserver;
     private final Set<Long> mNotifiedRawContactIds = Sets.newHashSet();
 
-    public ContactLoader(Context context, Uri lookupUri) {
-        this(context, lookupUri, false, false, false);
+    public ContactLoader(Context context, Uri lookupUri, boolean postViewNotification) {
+        this(context, lookupUri, false, false, false, postViewNotification);
     }
 
     public ContactLoader(Context context, Uri lookupUri, boolean loadGroupMetaData,
-            boolean loadStreamItems, boolean loadInvitableAccountTypes) {
+            boolean loadStreamItems, boolean loadInvitableAccountTypes,
+            boolean postViewNotification) {
         super(context);
         mLookupUri = lookupUri;
         mRequestedUri = lookupUri;
         mLoadGroupMetaData = loadGroupMetaData;
         mLoadStreamItems = loadStreamItems;
         mLoadInvitableAccountTypes = loadInvitableAccountTypes;
+        mPostViewNotification = postViewNotification;
     }
 
     /**
@@ -1236,8 +1239,10 @@
                         mLookupUri, true, mObserver);
             }
 
-            // inform the source of the data that this contact is being looked at
-            postViewNotificationToSyncAdapter();
+            if (mPostViewNotification) {
+                // inform the source of the data that this contact is being looked at
+                postViewNotificationToSyncAdapter();
+            }
         }
 
         super.deliverResult(mContact);
@@ -1301,11 +1306,13 @@
      */
     public void upgradeToFullContact() {
         // Everything requested already? Nothing to do, so let's bail out
-        if (mLoadGroupMetaData && mLoadInvitableAccountTypes && mLoadStreamItems) return;
+        if (mLoadGroupMetaData && mLoadInvitableAccountTypes && mLoadStreamItems
+                && mPostViewNotification) return;
 
         mLoadGroupMetaData = true;
         mLoadInvitableAccountTypes = true;
         mLoadStreamItems = true;
+        mPostViewNotification = true;
 
         // Cache the current result, so that we only load the "missing" parts of the contact.
         cacheResult();