Camera2: Unconditionally shut down streams on disconnect.

stopPreviewL may do nothing in certain states. Stop streams directly
to avoid those failures, so that we always maintain the HAL interface
invariant that streams referenced by in-flight requests are never
deleted.

Bug: 7276954
Change-Id: Ic4cffc43036f4944684d941981a43d6dd1dce7af
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);