Merge "Camera2: Report getMaxNumFocusAreas 0 for fixed focus cameras" into jb-mr1-dev
diff --git a/services/audioflinger/Android.mk b/services/audioflinger/Android.mk
index 85c2dac..bd9421c 100644
--- a/services/audioflinger/Android.mk
+++ b/services/audioflinger/Android.mk
@@ -79,3 +79,5 @@
 # LOCAL_CFLAGS += -DAUDIO_WATCHDOG
 
 include $(BUILD_SHARED_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp
index 90cba46..3239483 100644
--- a/services/camera/libcameraservice/Camera2Client.cpp
+++ b/services/camera/libcameraservice/Camera2Client.cpp
@@ -378,7 +378,16 @@
 
     ALOGV("Camera %d: Shutting down", mCameraId);
 
-    stopPreviewL();
+    res = mStreamingProcessor->stopStream();
+    if (res != OK) {
+        ALOGE("%s: Problem stopping streaming: %s (%d)",
+                __FUNCTION__, strerror(-res), res);
+    }
+    res = mDevice->waitUntilDrained();
+    if (res != OK) {
+        ALOGE("%s: Problem waiting for HAL: %s (%d)",
+                __FUNCTION__, strerror(-res), res);
+    }
 
     {
         SharedParameters::Lock l(mParameters);
diff --git a/services/camera/libcameraservice/camera2/ZslProcessor.cpp b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
index 5208574..1937955 100644
--- a/services/camera/libcameraservice/camera2/ZslProcessor.cpp
+++ b/services/camera/libcameraservice/camera2/ZslProcessor.cpp
@@ -254,11 +254,14 @@
     if (mZslQueueTail != mZslQueueHead) {
         CameraMetadata request;
         size_t index = mZslQueueTail;
-        while (request.isEmpty() && index != mZslQueueHead) {
-            request = mZslQueue[index].frame;
+        while (index != mZslQueueHead) {
+            if (!mZslQueue[index].frame.isEmpty()) {
+                request = mZslQueue[index].frame;
+                break;
+            }
             index = (index + 1) % kZslBufferDepth;
         }
-        if (request.isEmpty()) {
+        if (index == mZslQueueHead) {
             ALOGV("%s: ZSL queue has no valid frames to send yet.",
                   __FUNCTION__);
             return NOT_ENOUGH_DATA;