Merge "Use selected photo ID as the "photo to display" lookup parameter" into ub-contactsdialer-a-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index c694a64..2e684cf 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -16,8 +16,8 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.contacts"
-    android:versionCode="10303"
-    android:versionName="1.3.03">
+    android:versionCode="10304"
+    android:versionName="1.3.04">
 
     <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="23" />
     <original-package android:name="com.android.contacts" />
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java
index 12f9061..d552c96 100644
--- a/src/com/android/contacts/quickcontact/QuickContactActivity.java
+++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java
@@ -208,7 +208,6 @@
     private static final String KEY_SELECTED_SUGGESTION_CONTACTS = "selected_suggestion_contacts";
     private static final String KEY_PREVIOUS_CONTACT_ID = "previous_contact_id";
     private static final String KEY_SUGGESTIONS_AUTO_SELECTED = "suggestions_auto_seleted";
-    private static final String KEY_SELECTED_SUGGESTION_NUMBER = "selected_suggestion_number";
 
     private static final int ANIMATION_STATUS_BAR_COLOR_CHANGE_DURATION = 150;
     private static final int REQUEST_CODE_CONTACT_EDITOR_ACTIVITY = 1;
@@ -961,7 +960,6 @@
         mSuggestionList = (LinearLayout) findViewById(R.id.suggestion_list);
         mSuggestionsCancelButton= (Button) findViewById(R.id.cancel_button);
         mSuggestionsLinkButton = (Button) findViewById(R.id.link_button);
-        final int previousSelectedSuggestion;
         if (savedInstanceState != null) {
             mIsSuggestionListCollapsed = savedInstanceState.getBoolean(
                     KEY_IS_SUGGESTION_LIST_COLLAPSED, true);
@@ -970,16 +968,14 @@
                     KEY_SUGGESTIONS_AUTO_SELECTED, true);
             mSelectedAggregationIds = (TreeSet<Long>)
                     savedInstanceState.getSerializable(KEY_SELECTED_SUGGESTION_CONTACTS);
-            previousSelectedSuggestion = savedInstanceState.getInt(KEY_SELECTED_SUGGESTION_NUMBER);
         } else {
             mIsSuggestionListCollapsed = true;
             mSelectedAggregationIds.clear();
-            previousSelectedSuggestion = -1;
         }
-        if (previousSelectedSuggestion == -1 || previousSelectedSuggestion > 0) {
-            enableLinkButton();
-        } else {
+        if (mSelectedAggregationIds.isEmpty()) {
             disableLinkButton();
+        } else {
+            enableLinkButton();
         }
         mCollapasedSuggestionHeader.setOnClickListener(new OnClickListener() {
             @Override
@@ -1136,13 +1132,6 @@
                 KEY_SUGGESTIONS_AUTO_SELECTED, mSuggestionsShouldAutoSelected);
         savedInstanceState.putSerializable(
                 KEY_SELECTED_SUGGESTION_CONTACTS, mSelectedAggregationIds);
-        final int selectedSuggestion;
-        if (mSelectedAggregationIds.contains(mContactData.getId())) {
-            selectedSuggestion = mSelectedAggregationIds.size() - 1;
-        } else {
-            selectedSuggestion = mSelectedAggregationIds.size();
-        }
-        savedInstanceState.putInt(KEY_SELECTED_SUGGESTION_NUMBER, selectedSuggestion);
     }
 
     private void processIntent(Intent intent) {