Merge "Modify g+ icon in Contact card to read from CP2 and stop color filtering" into ub-contactsdialer-g-dev
diff --git a/proguard.flags b/proguard.flags
index ec75101..9b950f8 100644
--- a/proguard.flags
+++ b/proguard.flags
@@ -9,16 +9,19 @@
   public void *(android.view.MenuItem);
 }
 
+# Feature highlight library.  See b/29877098
 -keep class com.google.android.libraries.material.featurehighlight.** { *;}
 
+# Needed for tests
 -keep class com.android.contacts.common.** { *;}
-# For test:
--keep class com.android.contactsbind.analytics.AnalyticsUtil { *;}
 -keep class com.android.contacts.interactions.** { *;}
 -keep class com.google.common.base.Objects { *;}
 -keep class com.google.common.base.Preconditions { *;}
+-keep class com.google.common.collect.ImmutableMap { *;}
+-keep class com.google.common.collect.ImmutableSet { *;}
 -keep class com.google.common.collect.Lists { *;}
 -keep class com.google.common.collect.Maps { *;}
+-keep class com.google.common.collect.Multimap { *;}
 -keep class com.google.common.collect.Sets { *;}
 
 # Any class or method annotated with NeededForTesting or NeededForReflection.
@@ -28,10 +31,9 @@
 @com.android.contacts.common.testing.NeededForTesting *;
 @com.android.contacts.test.NeededForReflection *;
 }
+
 # Keep classes and methods that have the guava @VisibleForTesting annotation
 -keep @com.google.common.annotations.VisibleForTesting class *
 -keepclassmembers class * {
   @com.google.common.annotations.VisibleForTesting *;
 }
-
--verbose
diff --git a/res/drawable-hdpi/ic_scroll_handle.png b/res/drawable-hdpi/ic_scroll_handle.png
deleted file mode 100644
index 3aa29b8..0000000
--- a/res/drawable-hdpi/ic_scroll_handle.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-mdpi/ic_scroll_handle.png b/res/drawable-mdpi/ic_scroll_handle.png
deleted file mode 100644
index af75db4..0000000
--- a/res/drawable-mdpi/ic_scroll_handle.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xhdpi/ic_scroll_handle.png b/res/drawable-xhdpi/ic_scroll_handle.png
deleted file mode 100644
index 2d43c4d..0000000
--- a/res/drawable-xhdpi/ic_scroll_handle.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxhdpi/ic_scroll_handle.png b/res/drawable-xxhdpi/ic_scroll_handle.png
deleted file mode 100644
index 55f1d13..0000000
--- a/res/drawable-xxhdpi/ic_scroll_handle.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable-xxxhdpi/ic_scroll_handle.png b/res/drawable-xxxhdpi/ic_scroll_handle.png
deleted file mode 100644
index d90782a..0000000
--- a/res/drawable-xxxhdpi/ic_scroll_handle.png
+++ /dev/null
Binary files differ
diff --git a/res/drawable/fastscroll_thumb.xml b/res/drawable/fastscroll_thumb.xml
deleted file mode 100644
index eca4b39..0000000
--- a/res/drawable/fastscroll_thumb.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2014 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.
--->
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:state_pressed="true" android:drawable="@drawable/ic_scroll_handle_pressed" />
-    <item android:drawable="@drawable/ic_scroll_handle_default" />
-</selector>
\ No newline at end of file
diff --git a/res/drawable/ic_scroll_handle_default.xml b/res/drawable/ic_scroll_handle_default.xml
deleted file mode 100644
index 055005e..0000000
--- a/res/drawable/ic_scroll_handle_default.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 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.
--->
-
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
-    android:src="@drawable/ic_scroll_handle"
-    android:tint="@color/dialtacts_secondary_text_color" />
\ No newline at end of file
diff --git a/res/drawable/ic_scroll_handle_pressed.xml b/res/drawable/ic_scroll_handle_pressed.xml
deleted file mode 100644
index 9109c81..0000000
--- a/res/drawable/ic_scroll_handle_pressed.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-     Copyright (C) 2014 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.
--->
-
-<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
-    android:src="@drawable/ic_scroll_handle"
-    android:tint="@color/dialtacts_theme_color" />
\ No newline at end of file
diff --git a/res/values/donottranslate_config.xml b/res/values/donottranslate_config.xml
index 8668159..ac46a55 100644
--- a/res/values/donottranslate_config.xml
+++ b/res/values/donottranslate_config.xml
@@ -114,6 +114,4 @@
     <string name="pref_open_source_licenses_key">pref_open_source_licenses</string>
     <string name="pref_privacy_policy_key">pref_privacy_policy</string>
     <string name="pref_terms_of_service_key">pref_terms_of_service</string>
-
-    <string name="star_sign">\u2605</string>
 </resources>
diff --git a/src/com/android/contacts/ContactSaveService.java b/src/com/android/contacts/ContactSaveService.java
index 33da756..7a2dc3f 100755
--- a/src/com/android/contacts/ContactSaveService.java
+++ b/src/com/android/contacts/ContactSaveService.java
@@ -1644,6 +1644,7 @@
         }
     }
 
+    @NeededForTesting
     public interface GroupsDao {
         Uri create(String title, AccountWithDataSet account);
         int delete(Uri groupUri);
@@ -1671,6 +1672,7 @@
             this.contentResolver = contentResolver;
         }
 
+        @NeededForTesting
         public Bundle captureDeletionUndoData(Uri groupUri) {
             final long groupId = ContentUris.parseId(groupUri);
             final Bundle result = new Bundle();
@@ -1708,6 +1710,7 @@
             return result;
         }
 
+        @NeededForTesting
         public Uri undoDeletion(Bundle deletedGroupData) {
             final ContentValues groupData = deletedGroupData.getParcelable(KEY_GROUP_DATA);
             if (groupData == null) {
@@ -1735,6 +1738,7 @@
             return groupUri;
         }
 
+        @NeededForTesting
         public Uri create(String title, AccountWithDataSet account) {
             final ContentValues values = new ContentValues();
             values.put(Groups.TITLE, title);
@@ -1744,6 +1748,7 @@
             return contentResolver.insert(Groups.CONTENT_URI, values);
         }
 
+        @NeededForTesting
         public int delete(Uri groupUri) {
             return contentResolver.delete(groupUri, null, null);
         }
diff --git a/src/com/android/contacts/common/list/ContactEntryListAdapter.java b/src/com/android/contacts/common/list/ContactEntryListAdapter.java
index 1ac8fd5..0d20d6e 100644
--- a/src/com/android/contacts/common/list/ContactEntryListAdapter.java
+++ b/src/com/android/contacts/common/list/ContactEntryListAdapter.java
@@ -370,7 +370,7 @@
     public void setFavoritesSectionHeader(int numberOfFavorites) {
         if (mIncludeFavorites) {
             mNumberOfFavorites = numberOfFavorites;
-            setSectionHeader(R.string.star_sign, numberOfFavorites);
+            setSectionHeader(numberOfFavorites);
         }
     }
 
@@ -378,11 +378,10 @@
         return mNumberOfFavorites;
     }
 
-    private void setSectionHeader(int resId, int numberOfItems) {
+    private void setSectionHeader(int numberOfItems) {
         SectionIndexer indexer = getIndexer();
         if (indexer != null) {
-            ((ContactsSectionIndexer) indexer).setProfileAndFavoritesHeader(
-                    getContext().getString(resId), numberOfItems);
+            ((ContactsSectionIndexer) indexer).setFavoritesHeader(numberOfItems);
         }
     }
 
diff --git a/src/com/android/contacts/common/list/ContactListItemView.java b/src/com/android/contacts/common/list/ContactListItemView.java
index 1dc99ef..67f6d35 100644
--- a/src/com/android/contacts/common/list/ContactListItemView.java
+++ b/src/com/android/contacts/common/list/ContactListItemView.java
@@ -979,8 +979,9 @@
      * Sets section header or makes it invisible if the title is null.
      */
     public void setSectionHeader(String title) {
-        if (!TextUtils.isEmpty(title)) {
-            if (TextUtils.equals(getContext().getString(R.string.star_sign), title)) {
+        if (title != null) {
+            // Empty section title is the favorites so show the star here.
+            if (title.isEmpty()) {
                 if (mHeaderView == null) {
                     addStarImageHeader();
                 } else if (mHeaderView instanceof TextView) {
diff --git a/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java b/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java
index 6e8e738..c208bef 100644
--- a/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java
+++ b/src/com/android/contacts/common/list/ContactListPinnedHeaderView.java
@@ -19,16 +19,13 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.graphics.Color;
-import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.Gravity;
 import android.view.View;
-import android.view.ViewParent;
 import android.widget.LinearLayout.LayoutParams;
 import android.widget.TextView;
 
 import com.android.contacts.common.R;
-import com.android.contacts.common.util.ViewUtil;
 
 /**
  * A custom view for the pinned section header shown at the top of the contact list.
@@ -72,7 +69,7 @@
      * Sets section header or makes it invisible if the title is null.
      */
     public void setSectionHeaderTitle(String title) {
-        if (!TextUtils.isEmpty(title)) {
+        if (title != null) {
             setText(title);
             setVisibility(View.VISIBLE);
         } else {
diff --git a/src/com/android/contacts/common/list/ContactsSectionIndexer.java b/src/com/android/contacts/common/list/ContactsSectionIndexer.java
index db64010..031380d 100644
--- a/src/com/android/contacts/common/list/ContactsSectionIndexer.java
+++ b/src/com/android/contacts/common/list/ContactsSectionIndexer.java
@@ -55,6 +55,7 @@
         mPositions = new int[counts.length];
         int position = 0;
         for (int i = 0; i < counts.length; i++) {
+            // Enforce that there will be no null or empty sections.
             if (TextUtils.isEmpty(mSections[i])) {
                 mSections[i] = BLANK_HEADER_STRING;
             } else if (!mSections[i].equals(BLANK_HEADER_STRING)) {
@@ -101,10 +102,10 @@
         return index >= 0 ? index : -index - 2;
     }
 
-    public void setProfileAndFavoritesHeader(String header, int numberOfItemsToAdd) {
+    public void setFavoritesHeader(int numberOfItemsToAdd) {
         if (mSections != null) {
             // Don't do anything if the header is already set properly.
-            if (mSections.length > 0 && header.equals(mSections[0])) {
+            if (mSections.length > 0 && mSections[0].isEmpty()) {
                 return;
             }
 
@@ -112,7 +113,8 @@
             // special section at the top for it and shift everything else down.
             String[] tempSections = new String[mSections.length + 1];
             int[] tempPositions = new int[mPositions.length + 1];
-            tempSections[0] = header;
+            // Favorites section is empty to hide fast scroll preview.
+            tempSections[0] = "";
             tempPositions[0] = 0;
             for (int i = 1; i <= mPositions.length; i++) {
                 tempSections[i] = mSections[i - 1];
diff --git a/src/com/android/contacts/common/list/PinnedHeaderListView.java b/src/com/android/contacts/common/list/PinnedHeaderListView.java
index 45ce4b3..b68ff1f 100644
--- a/src/com/android/contacts/common/list/PinnedHeaderListView.java
+++ b/src/com/android/contacts/common/list/PinnedHeaderListView.java
@@ -19,7 +19,6 @@
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.RectF;
-import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.MotionEvent;
 import android.view.View;
@@ -31,7 +30,6 @@
 import android.widget.ListAdapter;
 import android.widget.TextView;
 
-import com.android.contacts.common.R;
 import com.android.contacts.common.util.ViewUtil;
 
 /**
@@ -318,8 +316,7 @@
         // Hide header when it's a star.
         // TODO: try showing the view even when it's a star;
         // if we have to hide the star view, then try hiding it in some higher layer.
-        header.visible = !TextUtils.equals(
-                ((TextView) header.view).getText(), getContext().getString(R.string.star_sign));
+        header.visible = !((TextView) header.view).getText().toString().isEmpty();
         header.state = FADING;
         header.alpha = MAX_ALPHA;
         header.animating = false;