Merge "Ellipsize texts in contacts list correctly"
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 219ff67..722fc46 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -409,26 +409,6 @@
             </intent-filter>
         </activity>
 
-        <!-- Flushes the QuickContact IntentCache -->
-        <receiver android:name=".quickcontact.PackageIntentReceiver">
-            <intent-filter>
-                <action android:name="android.intent.action.PACKAGE_ADDED" />
-                <data android:scheme="package" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.PACKAGE_REPLACED" />
-                <data android:scheme="package" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.PACKAGE_REMOVED" />
-                <data android:scheme="package" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.intent.action.PACKAGE_CHANGED" />
-                <data android:scheme="package" />
-            </intent-filter>
-        </receiver>
-
         <activity-alias android:name="ContactShortcut"
             android:targetActivity=".activities.ContactSelectionActivity"
             android:label="@string/shortcutContact"
@@ -567,37 +547,6 @@
             android:theme="@android:style/Theme.Translucent">
         </activity>
 
-        <!-- LIVE FOLDERS -->
-        <activity
-            android:name=".ContactsLiveFolders$AllContacts"
-            android:label="@string/liveFolderAll"
-            android:icon="@mipmap/ic_launcher_folder_live_contacts">
-            <intent-filter>
-                <action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <activity
-            android:name=".ContactsLiveFolders$StarredContacts"
-            android:label="@string/liveFolderFavorites"
-            android:icon="@mipmap/ic_launcher_folder_live_contacts_starred">
-            <intent-filter>
-                <action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-        <activity
-            android:name=".ContactsLiveFolders$PhoneContacts"
-            android:label="@string/liveFolderPhone"
-            android:icon="@mipmap/ic_launcher_folder_live_contacts_phone">
-            <intent-filter>
-                <action android:name="android.intent.action.CREATE_LIVE_FOLDER" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
         <!-- vCard related -->
         <activity android:name=".vcard.ImportVCardActivity"
             android:configChanges="orientation|screenSize|keyboardHidden"
diff --git a/res/layout/call_log_voicemail_status.xml b/res/layout/call_log_voicemail_status.xml
index 280dfd0..191c821 100644
--- a/res/layout/call_log_voicemail_status.xml
+++ b/res/layout/call_log_voicemail_status.xml
@@ -27,15 +27,9 @@
             android:layout_weight="1"
             android:paddingLeft="@dimen/call_log_outer_margin"
             android:paddingRight="@dimen/call_log_inner_margin"
+            android:textAppearance="?android:attr/textAppearanceMedium"
             android:textColor="?attr/call_log_voicemail_status_text_color"
         />
-        <View
-            android:id="@+id/voicemail_status_divider"
-            android:layout_width="1px"
-            android:layout_height="@dimen/call_log_call_action_size"
-            android:layout_gravity="center_vertical"
-            android:background="@drawable/ic_divider_dashed_holo_dark"
-        />
         <TextView
             android:id="@+id/voicemail_status_action"
             android:layout_width="wrap_content"
@@ -43,7 +37,8 @@
             android:gravity="center_vertical"
             android:paddingLeft="@dimen/call_log_inner_margin"
             android:paddingRight="@dimen/call_log_outer_margin"
-            android:textColor="?attr/call_log_voicemail_status_text_color"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="?attr/call_log_voicemail_status_action_text_color"
             android:background="?android:attr/selectableItemBackground"
             android:clickable="true"
         />
diff --git a/res/mipmap-hdpi/ic_launcher_folder_live_contacts.png b/res/mipmap-hdpi/ic_launcher_folder_live_contacts.png
deleted file mode 100644
index 84babe2..0000000
--- a/res/mipmap-hdpi/ic_launcher_folder_live_contacts.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-hdpi/ic_launcher_folder_live_contacts_phone.png b/res/mipmap-hdpi/ic_launcher_folder_live_contacts_phone.png
deleted file mode 100644
index 004e849..0000000
--- a/res/mipmap-hdpi/ic_launcher_folder_live_contacts_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-hdpi/ic_launcher_folder_live_contacts_starred.png b/res/mipmap-hdpi/ic_launcher_folder_live_contacts_starred.png
deleted file mode 100644
index 73b4fa5..0000000
--- a/res/mipmap-hdpi/ic_launcher_folder_live_contacts_starred.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_folder_live_contacts.png b/res/mipmap-mdpi/ic_launcher_folder_live_contacts.png
deleted file mode 100644
index d49cc7b..0000000
--- a/res/mipmap-mdpi/ic_launcher_folder_live_contacts.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_folder_live_contacts_phone.png b/res/mipmap-mdpi/ic_launcher_folder_live_contacts_phone.png
deleted file mode 100644
index 0127f84..0000000
--- a/res/mipmap-mdpi/ic_launcher_folder_live_contacts_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-mdpi/ic_launcher_folder_live_contacts_starred.png b/res/mipmap-mdpi/ic_launcher_folder_live_contacts_starred.png
deleted file mode 100644
index 8d56b31..0000000
--- a/res/mipmap-mdpi/ic_launcher_folder_live_contacts_starred.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_folder_live_contacts.png b/res/mipmap-xhdpi/ic_launcher_folder_live_contacts.png
deleted file mode 100644
index 99bb9f8..0000000
--- a/res/mipmap-xhdpi/ic_launcher_folder_live_contacts.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_folder_live_contacts_phone.png b/res/mipmap-xhdpi/ic_launcher_folder_live_contacts_phone.png
deleted file mode 100644
index fd416b8..0000000
--- a/res/mipmap-xhdpi/ic_launcher_folder_live_contacts_phone.png
+++ /dev/null
Binary files differ
diff --git a/res/mipmap-xhdpi/ic_launcher_folder_live_contacts_starred.png b/res/mipmap-xhdpi/ic_launcher_folder_live_contacts_starred.png
deleted file mode 100644
index ff9e326..0000000
--- a/res/mipmap-xhdpi/ic_launcher_folder_live_contacts_starred.png
+++ /dev/null
Binary files differ
diff --git a/res/values/attrs.xml b/res/values/attrs.xml
index a95de0f..b9a534c 100644
--- a/res/values/attrs.xml
+++ b/res/values/attrs.xml
@@ -116,6 +116,7 @@
         <attr name="call_log_voicemail_status_height" format="dimension" />
         <attr name="call_log_voicemail_status_background_color" format="color" />
         <attr name="call_log_voicemail_status_text_color" format="color" />
+        <attr name="call_log_voicemail_status_action_text_color" format="color" />
     </declare-styleable>
 
     <declare-styleable name="Favorites">
diff --git a/res/values/strings.xml b/res/values/strings.xml
index ed88aaa..62dac75 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -379,9 +379,6 @@
 
          [CHAR LIMIT=NONE] -->
     <string name="recentCallsIconLabel">Call log</string>
-    <string name="liveFolderAll">All contacts</string>
-    <string name="liveFolderFavorites">Starred contacts</string>
-    <string name="liveFolderPhone">Contacts with phone numbers</string>
 
     <!-- Menu item used to send an SMS or MMS message to a phone number  -->
     <string name="menu_sendTextMessage">Send text message</string>
@@ -522,15 +519,6 @@
         \n<li>Touch the star next to the contact\'s name\n</li>"
     </string>
 
-    <!-- Live folder label for all contacts -->
-    <string name="liveFolder_all_label">All contacts</string>
-
-    <!-- Live folder label for only starred contacts -->
-    <string name="liveFolder_favorites_label">Starred</string>
-
-    <!-- Live folder label for all contacts with phone numbers -->
-    <string name="liveFolder_phones_label">Phones</string>
-
     <!-- Item label: jump to the in-call DTMF dialpad.
          (Part of a list of options shown in the dialer when another call
          is already in progress.) -->
diff --git a/res/values/styles.xml b/res/values/styles.xml
index d324d66..62a06f6 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -57,10 +57,11 @@
         <item name="call_log_secondary_background_color">#333333</item>
         <item name="call_log_header_color">#33b5e5</item>
         <!-- VoicemailStatus -->
-        <item name="call_log_voicemail_status_height">40dip</item>
-        <item name="call_log_voicemail_status_background_color">#FFFFE0</item>
-        <item name="call_log_voicemail_status_text_color">#000000</item>
-        <!-- Favorites -->
+        <item name="call_log_voicemail_status_height">48dip</item>
+        <item name="call_log_voicemail_status_background_color">#262626</item>
+        <item name="call_log_voicemail_status_text_color">#888888</item>
+        <item name="call_log_voicemail_status_action_text_color">#33b5e5</item>
+            <!-- Favorites -->
         <item name="favorites_padding_bottom">?android:attr/actionBarSize</item>
     </style>
 
@@ -74,9 +75,10 @@
         <item name="call_log_secondary_background_color">#333333</item>
         <item name="call_log_header_color">#33b5e5</item>
         <!-- VoicemailStatus -->
-        <item name="call_log_voicemail_status_height">40dip</item>
-        <item name="call_log_voicemail_status_background_color">#FFFFE0</item>
-        <item name="call_log_voicemail_status_text_color">#000000</item>
+        <item name="call_log_voicemail_status_height">48dip</item>
+        <item name="call_log_voicemail_status_background_color">#262626</item>
+        <item name="call_log_voicemail_status_text_color">#888888</item>
+        <item name="call_log_voicemail_status_action_text_color">#33b5e5</item>
     </style>
 
     <style name="DetailActivityTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
diff --git a/src/com/android/contacts/ContactsLiveFolders.java b/src/com/android/contacts/ContactsLiveFolders.java
deleted file mode 100644
index 9cb7e72..0000000
--- a/src/com/android/contacts/ContactsLiveFolders.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.contacts;
-
-import android.app.Activity;
-import android.content.Context;
-import android.content.Intent;
-import android.net.Uri;
-import android.os.Bundle;
-import android.provider.ContactsContract.Contacts;
-import android.provider.LiveFolders;
-
-public class ContactsLiveFolders {
-    public static class StarredContacts extends Activity {
-        public static final Uri CONTENT_URI =
-                Uri.parse("content://contacts/live_folders/favorites");
-
-        @Override
-        protected void onCreate(Bundle savedInstanceState) {
-            super.onCreate(savedInstanceState);
-
-            final Intent intent = getIntent();
-            final String action = intent.getAction();
-
-            if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
-                setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
-                        getString(R.string.liveFolder_favorites_label),
-                        R.mipmap.ic_launcher_folder_live_contacts_starred));
-            } else {
-                setResult(RESULT_CANCELED);
-            }
-
-            finish();
-        }
-    }
-
-    public static class PhoneContacts extends Activity {
-        public static final Uri CONTENT_URI =
-                Uri.parse("content://contacts/live_folders/people_with_phones");
-
-        @Override
-        protected void onCreate(Bundle savedInstanceState) {
-            super.onCreate(savedInstanceState);
-
-            final Intent intent = getIntent();
-            final String action = intent.getAction();
-
-            if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
-                setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
-                        getString(R.string.liveFolder_phones_label),
-                        R.mipmap.ic_launcher_folder_live_contacts_phone));
-            } else {
-                setResult(RESULT_CANCELED);
-            }
-
-            finish();
-        }
-    }
-
-    public static class AllContacts extends Activity {
-        public static final Uri CONTENT_URI =
-                Uri.parse("content://contacts/live_folders/people");
-
-        @Override
-        protected void onCreate(Bundle savedInstanceState) {
-            super.onCreate(savedInstanceState);
-
-            final Intent intent = getIntent();
-            final String action = intent.getAction();
-
-            if (LiveFolders.ACTION_CREATE_LIVE_FOLDER.equals(action)) {
-                setResult(RESULT_OK, createLiveFolder(this, CONTENT_URI,
-                        getString(R.string.liveFolder_all_label),
-                        R.mipmap.ic_launcher_folder_live_contacts));
-            } else {
-                setResult(RESULT_CANCELED);
-            }
-
-            finish();
-        }
-    }
-
-    private static Intent createLiveFolder(Context context, Uri uri, String name,
-            int icon) {
-
-        final Intent intent = new Intent();
-
-        intent.setData(uri);
-        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_BASE_INTENT,
-                new Intent(Intent.ACTION_VIEW, Contacts.CONTENT_URI));
-        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_NAME, name);
-        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_ICON,
-                Intent.ShortcutIconResource.fromContext(context, icon));
-        intent.putExtra(LiveFolders.EXTRA_LIVE_FOLDER_DISPLAY_MODE, LiveFolders.DISPLAY_MODE_LIST);
-
-        return intent;
-    }
-}
diff --git a/src/com/android/contacts/calllog/CallLogFragment.java b/src/com/android/contacts/calllog/CallLogFragment.java
index f66bbd0..79f3499 100644
--- a/src/com/android/contacts/calllog/CallLogFragment.java
+++ b/src/com/android/contacts/calllog/CallLogFragment.java
@@ -75,7 +75,6 @@
     private View mStatusMessageView;
     private TextView mStatusMessageText;
     private TextView mStatusMessageAction;
-    private View mStatusMessageDivider;
     private KeyguardManager mKeyguardManager;
 
     @Override
@@ -144,7 +143,6 @@
         mStatusMessageView = view.findViewById(R.id.voicemail_status);
         mStatusMessageText = (TextView) view.findViewById(R.id.voicemail_status_message);
         mStatusMessageAction = (TextView) view.findViewById(R.id.voicemail_status_action);
-        mStatusMessageDivider = view.findViewById(R.id.voicemail_status_divider);
         return view;
     }
 
@@ -186,7 +184,6 @@
             }
             if (message.actionUri != null) {
                 mStatusMessageAction.setVisibility(View.VISIBLE);
-                mStatusMessageDivider.setVisibility(View.VISIBLE);
                 mStatusMessageAction.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View v) {
@@ -196,7 +193,6 @@
                 });
             } else {
                 mStatusMessageAction.setVisibility(View.GONE);
-                mStatusMessageDivider.setVisibility(View.GONE);
             }
         }
     }
diff --git a/src/com/android/contacts/quickcontact/PackageIntentReceiver.java b/src/com/android/contacts/quickcontact/PackageIntentReceiver.java
deleted file mode 100644
index 7af4005..0000000
--- a/src/com/android/contacts/quickcontact/PackageIntentReceiver.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License
- */
-
-package com.android.contacts.quickcontact;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-/**
- * Package intent receiver that flushes the {@link ResolveCache} so that Packages are rescanned next
- * time
- */
-public class PackageIntentReceiver extends BroadcastReceiver {
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        ResolveCache.flush();
-    }
-}
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 0588c7d..2c62fe4 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -18,7 +18,6 @@
 
 import com.android.contacts.Collapser;
 import com.android.contacts.ContactPhotoManager;
-import com.android.contacts.ContactPresenceIconUtil;
 import com.android.contacts.R;
 import com.android.contacts.model.AccountTypeManager;
 import com.android.contacts.model.DataKind;
diff --git a/src/com/android/contacts/quickcontact/ResolveCache.java b/src/com/android/contacts/quickcontact/ResolveCache.java
index 08a6cf8..aae2ee7 100644
--- a/src/com/android/contacts/quickcontact/ResolveCache.java
+++ b/src/com/android/contacts/quickcontact/ResolveCache.java
@@ -19,6 +19,7 @@
 import com.android.contacts.util.PhoneCapabilityTester;
 import com.google.android.collect.Sets;
 
+import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
@@ -65,16 +66,35 @@
      */
     public synchronized static ResolveCache getInstance(Context context) {
         if (sInstance == null) {
-            return sInstance = new ResolveCache(context.getApplicationContext());
+            final Context applicationContext = context.getApplicationContext();
+            sInstance = new ResolveCache(applicationContext);
+
+            // Register for package-changes so that we can flush our cache
+            final IntentFilter filter = new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
+            filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
+            filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
+            filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
+            filter.addDataScheme("package");
+            applicationContext.registerReceiver(sInstance.mPackageIntentReceiver, filter);
         }
         return sInstance;
     }
 
-    public synchronized static void flush() {
+    private synchronized static void flush() {
         sInstance = null;
     }
 
     /**
+     * Called anytime a package is installed, uninstalled etc, so that we can wipe our cache
+     */
+    private BroadcastReceiver mPackageIntentReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            flush();
+        }
+    };
+
+    /**
      * Cached entry holding the best {@link ResolveInfo} for a specific
      * MIME-type, along with a {@link SoftReference} to its icon.
      */