OSDN Git Service

Clear activity result when launching from lock screen.
authorGeorge Mount <mount@google.com>
Thu, 16 Aug 2012 18:06:42 +0000 (11:06 -0700)
committerGeorge Mount <mount@google.com>
Fri, 17 Aug 2012 17:37:06 +0000 (10:37 -0700)
 Bug 6710029
 When the screen is locked during video play, the activity result
 from that play will be triggered immediately when unlocking to
 camera. The result must be destroyed on unlock so that the resume
 goes to the camera rather than to the video display.

Change-Id: Ifa6f00fa1cba119d5fc6e762d1757bd6aac576f4

src/com/android/gallery3d/app/ActivityState.java
src/com/android/gallery3d/app/PhotoPage.java
src/com/android/gallery3d/app/StateManager.java

index 6335d05..13cd150 100644 (file)
@@ -108,6 +108,9 @@ abstract public class ActivityState {
     protected void onCreate(Bundle data, Bundle storedState) {
     }
 
+    protected void clearStateResult() {
+    }
+
     BroadcastReceiver mPowerIntentReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
index 120eb7d..c6e7469 100644 (file)
@@ -815,6 +815,11 @@ public class PhotoPage extends ActivityState implements
         }
     }
 
+    @Override
+    protected void clearStateResult() {
+        mHasActivityResult = false;
+    }
+
     private class PreparePhotoFallback implements OnGLIdleListener {
         private PhotoFallbackEffect mPhotoFallback = new PhotoFallbackEffect();
         private boolean mResultReady = false;
index 02e9976..f05ab01 100644 (file)
@@ -122,6 +122,12 @@ public class StateManager {
         getTopState().onStateResult(requestCode, resultCode, data);
     }
 
+    public void clearActivityResult() {
+        if (!mStack.isEmpty()) {
+            getTopState().clearStateResult();
+        }
+    }
+
     public int getStateCount() {
         return mStack.size();
     }