No Camera recenter on resume after editing or viewing items

Bug: 7302361
Change-Id: I7420f89a766dc86d873166789b1875539541825c
diff --git a/src/com/android/gallery3d/app/PhotoPage.java b/src/com/android/gallery3d/app/PhotoPage.java
index cfc9aa0..7f6d773 100644
--- a/src/com/android/gallery3d/app/PhotoPage.java
+++ b/src/com/android/gallery3d/app/PhotoPage.java
@@ -162,6 +162,7 @@
     private boolean mStartInFilmstrip;
     private boolean mInCameraRoll;
     private boolean mStartedFromAlbumPage;
+    private boolean mRecenterCameraOnResume = true;
 
     private long mCameraSwitchCutoff = 0;
     private boolean mSkipUpdateCurrentPhoto = false;
@@ -533,6 +534,7 @@
                 launchPhotoEditor();
                 return;
             case R.id.photopage_bottom_control_panorama:
+                mRecenterCameraOnResume = false;
                 LightCycleHelper.viewPanorama(mActivity, mCurrentPhoto.getContentUri());
                 return;
             default:
@@ -598,6 +600,7 @@
                 .queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY).size() == 0) {
             intent.setAction(Intent.ACTION_EDIT);
         }
+        mRecenterCameraOnResume = false;
         ((Activity) mActivity).startActivityForResult(Intent.createChooser(intent, null),
                 REQUEST_EDIT);
     }
@@ -1082,7 +1085,8 @@
         mDeletePath = null;
     }
 
-    public static void playVideo(Activity activity, Uri uri, String title) {
+    public void playVideo(Activity activity, Uri uri, String title) {
+        mRecenterCameraOnResume = false;
         try {
             Intent intent = new Intent(Intent.ACTION_VIEW)
                     .setDataAndType(uri, "video/*")
@@ -1226,7 +1230,8 @@
         int albumPageTransition = transitions.get(
                 KEY_ALBUMPAGE_TRANSITION, MSG_ALBUMPAGE_NONE);
 
-        if (albumPageTransition == MSG_ALBUMPAGE_NONE && mAppBridge != null) {
+        if (albumPageTransition == MSG_ALBUMPAGE_NONE && mAppBridge != null
+                && mRecenterCameraOnResume) {
             // Generally, resuming the PhotoPage when in Camera should
             // reset to the capture mode to allow quick photo taking
             mCurrentIndex = 0;
@@ -1301,6 +1306,7 @@
         }
 
         mHasActivityResult = false;
+        mRecenterCameraOnResume = true;
         mHandler.sendEmptyMessageDelayed(MSG_UNFREEZE_GLROOT, UNFREEZE_GLROOT_TIMEOUT);
     }