Clear activity result when launching from lock screen.
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
diff --git a/src/com/android/gallery3d/app/ActivityState.java b/src/com/android/gallery3d/app/ActivityState.java
index 6335d05..13cd150 100644
--- a/src/com/android/gallery3d/app/ActivityState.java
+++ b/src/com/android/gallery3d/app/ActivityState.java
@@ -108,6 +108,9 @@
protected void onCreate(Bundle data, Bundle storedState) {
}
+ protected void clearStateResult() {
+ }
+
BroadcastReceiver mPowerIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index 120eb7d..c6e7469 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -815,6 +815,11 @@
}
}
+ @Override
+ protected void clearStateResult() {
+ mHasActivityResult = false;
+ }
+
private class PreparePhotoFallback implements OnGLIdleListener {
private PhotoFallbackEffect mPhotoFallback = new PhotoFallbackEffect();
private boolean mResultReady = false;
diff --git a/src/com/android/gallery3d/app/StateManager.java b/src/com/android/gallery3d/app/StateManager.java
index 02e9976..f05ab01 100644
--- a/src/com/android/gallery3d/app/StateManager.java
+++ b/src/com/android/gallery3d/app/StateManager.java
@@ -122,6 +122,12 @@
getTopState().onStateResult(requestCode, resultCode, data);
}
+ public void clearActivityResult() {
+ if (!mStack.isEmpty()) {
+ getTopState().clearStateResult();
+ }
+ }
+
public int getStateCount() {
return mStack.size();
}