Camera3: Only queue snapshot YUV buffers before snapshot request

Since we are starting all configured streams before the very first
request, we want to make sure we are only queuing the YUV buffers
when we receive the snapshot request.

This logic only applies to non-reprocessing capture. For reprocessing
capture, since we already have input buffer, we don't need to queue
any buffer into hardware.

Bug: 10544282

Change-Id: Ia3434160f4944649fd327b839f9130edb32b54d1
diff --git a/camera/QCamera2/HAL3/QCamera3Channel.cpp b/camera/QCamera2/HAL3/QCamera3Channel.cpp
index 387ee35..0805ade 100644
--- a/camera/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/camera/QCamera2/HAL3/QCamera3Channel.cpp
@@ -976,23 +976,14 @@
     int32_t rc = NO_ERROR;
     int index;
     mJpegSettings = jpegSettings;
-    if(!m_bIsActive) {
-        ALOGD("%s: First request on this channel starting stream",__func__);
-        //Stream on for main image. YUV buffer is queued to the kernel at the end of this call.
-        if(!pInputBuffer)
-            rc = start();
-        else
-            ALOGD("%s: Current request has input buffer no need to start h/w stream", __func__);
-    } else {
+    // Picture stream has already been started before any request comes in
+    if (!m_bIsActive) {
+        ALOGE("%s: Picture stream should have been started before any request",
+            __func__);
+        return -EINVAL;
+    }
+    if (pInputBuffer == NULL)
         mStreams[0]->bufDone(0);
-        ALOGD("%s: Request on an existing stream",__func__);
-    }
-
-    if(rc != NO_ERROR) {
-        ALOGE("%s: Failed to start the stream on the request",__func__);
-        return rc;
-    }
-
 
     if(!mMemory) {
         if(pInputBuffer) {
@@ -1193,7 +1184,7 @@
     }
 
     //Queue YUV buffers in the beginning mQueueAll = true
-    rc = mYuvMemory->allocate(1, len, true);
+    rc = mYuvMemory->allocate(1, len, false);
     if (rc < 0) {
         ALOGE("%s: unable to allocate metadata memory", __func__);
         delete mYuvMemory;