Only kill image requests from the one fragment

In ContractEntryListAdapter#changeCursor(), don't kill all image loading
requests app wide. Instead, only kill the image loading requests that
were associated with the adapter's fragment.

Bug: 15522504
Change-Id: Ib4e0448217e8bbb8df55e74649a013e0f1688a22
diff --git a/src/com/android/contacts/common/list/ContactEntryListAdapter.java b/src/com/android/contacts/common/list/ContactEntryListAdapter.java
index fc8f0d4..83a8c39 100644
--- a/src/com/android/contacts/common/list/ContactEntryListAdapter.java
+++ b/src/com/android/contacts/common/list/ContactEntryListAdapter.java
@@ -72,6 +72,11 @@
      */
     private boolean mProfileExists;
 
+    /**
+     * The root view of the fragment that this adapter is associated with.
+     */
+    private View mFragmentRootView;
+
     private ContactPhotoManager mPhotoLoader;
 
     private String mQueryString;
@@ -96,6 +101,14 @@
         addPartitions();
     }
 
+    /**
+     * @param fragmentRootView Root view of the fragment. This is used to restrict the scope of
+     * image loading requests that get cancelled on cursor changes.
+     */
+    protected void setFragmentRootView(View fragmentRootView) {
+        mFragmentRootView = fragmentRootView;
+    }
+
     protected void setDefaultFilterHeaderText(int resourceId) {
         mDefaultFilterHeaderText = getContext().getResources().getText(resourceId);
     }
@@ -447,7 +460,7 @@
         }
 
         // When the cursor changes, cancel any pending asynchronous photo loads.
-        mPhotoLoader.cancelPendingRequests();
+        mPhotoLoader.cancelPendingRequests(mFragmentRootView);
     }
 
     public void changeCursor(Cursor cursor) {