OSDN Git Service

Fix ANR in PhotoPage.
authorOwen Lin <owenlin@google.com>
Fri, 13 Apr 2012 04:33:29 +0000 (12:33 +0800)
committerOwen Lin <owenlin@google.com>
Fri, 13 Apr 2012 04:40:18 +0000 (12:40 +0800)
This bugs happens because we open too many PhotoPage(s) (and onSingleTapUp is a delayed event).
However, each of the PhotoPage need a Thread to run tile decoder. When we close one of the
PhotoPage, it will wait the tile decoder to get finished first. However, the title decoder may
still waiting in the queue and never got a chance to run.

Change-Id: I113d1150729892edb4fe36bc5a1dc131db300476
fix: 6319833

src/com/android/gallery3d/app/AlbumPage.java
src/com/android/gallery3d/app/AlbumSetPage.java

index efffe40..0fcd7a7 100644 (file)
@@ -164,6 +164,7 @@ public class AlbumPage extends ActivityState implements GalleryActionBar.Cluster
     }
 
     private void onSingleTapUp(int slotIndex) {
+        if (!mIsActive) return;
         MediaItem item = mAlbumDataAdapter.get(slotIndex);
         if (item == null) {
             Log.w(TAG, "item not ready yet, ignore the click");
index cbd6789..60de019 100644 (file)
@@ -172,6 +172,7 @@ public class AlbumSetPage extends ActivityState implements
     }
 
     public void onSingleTapUp(int slotIndex) {
+        if (!mIsActive) return;
         MediaSet targetSet = mAlbumSetDataAdapter.getMediaSet(slotIndex);
         if (targetSet == null) return; // Content is dirty, we shall reload soon