Merge "Reflecting the rename of System Group: My Contacts"
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 706b459..041440a 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -201,8 +201,8 @@
     <!-- Hint text for the organization name when editing -->
     <string name="ghostData_company">Company</string>
 
-    <!-- Hint text for the organization position when editing -->
-    <string name="ghostData_title">Position</string>
+    <!-- Hint text for the organization title when editing -->
+    <string name="ghostData_title">Title</string>
 
     <!-- Message displayed in a toast when you try to view the details of a contact that
          for some reason doesn't exist anymore. -->
diff --git a/src/com/android/contacts/RecentCallsListActivity.java b/src/com/android/contacts/RecentCallsListActivity.java
index 987784f..ccd1ce3 100644
--- a/src/com/android/contacts/RecentCallsListActivity.java
+++ b/src/com/android/contacts/RecentCallsListActivity.java
@@ -334,16 +334,13 @@
             }
         }
 
-        private void queryContactInfo(CallerInfoQuery ciq) {
+        private boolean queryContactInfo(CallerInfoQuery ciq) {
             // First check if there was a prior request for the same number
             // that was already satisfied
             ContactInfo info = mContactInfo.get(ciq.number);
+            boolean needNotify = false;
             if (info != null && info != ContactInfo.EMPTY) {
-                synchronized (mRequests) {
-                    if (mRequests.isEmpty()) {
-                        mHandler.sendEmptyMessage(REDRAW);
-                    }
-                }
+                return true;
             } else {
                 Cursor phonesCursor =
                     RecentCallsListActivity.this.getContentResolver().query(
@@ -365,11 +362,7 @@
 
                         mContactInfo.put(ciq.number, info);
                         // Inform list to update this item, if in view
-                        synchronized (mRequests) {
-                            if (mRequests.isEmpty()) {
-                                mHandler.sendEmptyMessage(REDRAW);
-                            }
-                        }
+                        needNotify = true;
                     }
                     phonesCursor.close();
                 }
@@ -377,6 +370,7 @@
             if (info != null) {
                 updateCallLog(ciq, info);
             }
+            return needNotify;
         }
 
         /*
@@ -384,12 +378,17 @@
          * @see java.lang.Runnable#run()
          */
         public void run() {
+            boolean needNotify = false;
             while (!mDone) {
                 CallerInfoQuery ciq = null;
                 synchronized (mRequests) {
                     if (!mRequests.isEmpty()) {
                         ciq = mRequests.removeFirst();
                     } else {
+                        if (needNotify) {
+                            needNotify = false;
+                            mHandler.sendEmptyMessage(REDRAW);
+                        }
                         try {
                             mRequests.wait(1000);
                         } catch (InterruptedException ie) {
@@ -397,8 +396,8 @@
                         }
                     }
                 }
-                if (ciq != null) {
-                    queryContactInfo(ciq);
+                if (ciq != null && queryContactInfo(ciq)) {
+                    needNotify = true;
                 }
             }
         }
@@ -730,10 +729,8 @@
         sFormattingType = FORMATTING_TYPE_INVALID;
     }
 
-
     @Override
-    protected void onStart() {
-        super.onStart();
+    protected void onResume() {
         // The adapter caches looked up numbers, clear it so they will get
         // looked up again.
         if (mAdapter != null) {
@@ -741,18 +738,17 @@
         }
 
         startQuery();
-    }
-
-    @Override
-    protected void onResume() {
         resetNewCallsFlag();
+
         super.onResume();
+
         mAdapter.mPreDrawListener = null; // Let it restart the thread after next draw
     }
 
     @Override
     protected void onPause() {
         super.onPause();
+
         // Kill the requests thread
         mAdapter.stopRequestProcessing();
     }
@@ -760,6 +756,7 @@
     @Override
     protected void onDestroy() {
         super.onDestroy();
+        mAdapter.stopRequestProcessing();
         mAdapter.changeCursor(null);
     }
 
diff --git a/src/com/android/contacts/ViewContactActivity.java b/src/com/android/contacts/ViewContactActivity.java
index cdf2871..2e41d80 100644
--- a/src/com/android/contacts/ViewContactActivity.java
+++ b/src/com/android/contacts/ViewContactActivity.java
@@ -939,10 +939,16 @@
                         final boolean duplicatesTitle =
                             isNameRawContact
                             && mDisplayNameSource == DisplayNameSources.ORGANIZATION
-                            && !hasData;
+                            && (!hasData || TextUtils.isEmpty(entry.label));
 
                         if (!duplicatesTitle) {
                             entry.uri = null;
+
+                            if (TextUtils.isEmpty(entry.label)) {
+                                entry.label = entry.data;
+                                entry.data = "";
+                            }
+
                             mOrganizationEntries.add(entry);
                         }
                     } else if (Nickname.CONTENT_ITEM_TYPE.equals(mimeType) && hasData) {