From ecec49b0d2fc043c9034b08f53f98b0d2b2802e1 Mon Sep 17 00:00:00 2001
From: jiaoyuan <jiaoyuan@codeaurora.org>
Date: Wed, 17 Jun 2020 15:45:52 +0800
Subject: [PATCH] Snapcam: Fix reconfig stream issues

1.Don't enable capture button in HFR mode
2.Don't allow switch mode during taking snapshot

Change-Id: I98c4032eca6442427ca25e5ad48a60c0806bc1b4
---
 src/com/android/camera/CaptureModule.java | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 79a95bad6..29144b21f 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -3222,6 +3222,7 @@ public class CaptureModule implements CameraModule, PhotoController,
                                             CaptureFailure result) {
                     Log.d(TAG, "captureStillPictureForCommon onCaptureFailed: " + id);
                     enableShutterAndVideoOnUiThread(id, true);
+                    setCameraModeSwitcherAllowed(true);
                 }
 
                 @Override
@@ -3257,6 +3258,7 @@ public class CaptureModule implements CameraModule, PhotoController,
                             }
                         }
                     }
+                    setCameraModeSwitcherAllowed(true);
                 }
             }, mCaptureCallbackHandler);
         }
@@ -3783,7 +3785,9 @@ public class CaptureModule implements CameraModule, PhotoController,
                 public void run() {
                     mUI.stopSelfieFlash();
                     if (force || !captureWaitImageReceive()) {
-                        mUI.enableShutter(true);
+                        if(mCurrentSceneMode.mode != CameraMode.VIDEO && mCurrentSceneMode.mode != CameraMode.HFR) {
+                            mUI.enableShutter(true);
+                        }
                     }
                     if (mDeepPortraitMode) {
                         mUI.enableVideo(false);
@@ -6916,8 +6920,6 @@ public class CaptureModule implements CameraModule, PhotoController,
             return;
         }
 
-        Log.d(TAG,"onShutterButtonClick");
-
         if (mCurrentSceneMode.mode == CameraMode.HFR ||
                 mCurrentSceneMode.mode == CameraMode.VIDEO) {
             if (mSettingsManager.isLiveshotSupported(mVideoSize,mSettingsManager.getVideoFPS())){
@@ -6925,13 +6927,15 @@ public class CaptureModule implements CameraModule, PhotoController,
             }
             return;
         }
-
+        setCameraModeSwitcherAllowed(false);
+        Log.d(TAG,"onShutterButtonClick");
         String timer = mSettingsManager.getValue(SettingsManager.KEY_TIMER);
         int seconds = Integer.parseInt(timer);
         // When shutter button is pressed, check whether the previous countdown is
         // finished. If not, cancel the previous countdown and start a new one.
         if (mUI.isCountingDown()) {
             mUI.cancelCountDown();
+            setCameraModeSwitcherAllowed(true);
             return;
         }
         if (seconds > 0) {
@@ -6939,6 +6943,7 @@ public class CaptureModule implements CameraModule, PhotoController,
         } else {
             if (mChosenImageFormat == ImageFormat.YUV_420_888 && mPostProcessor.isItBusy()) {
                 warningToast("It's still busy processing previous scene mode request.");
+                setCameraModeSwitcherAllowed(true);
                 return;
             }
             checkSelfieFlashAndTakePicture();
-- 
GitLab