Camera2: Use HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED

Align camera2's management of platform-opaque formats with rest of
framework. Instead of using CAMERA2_PIXEL_FORMAT_OPAQUE, use
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED as the format for both the
camera HAL and for gralloc, and depend on the gralloc usage flags to
let the gralloc module select the appropriate real format for specific
stream endpoints.

Add a new gralloc usage for ZSL mode, where the camera service will
hold a streaming circular buffer of opaque full-resolution images
during camera preview. Since this is an opaque format that needs to be
optimized for 30fps operation, need gralloc to be aware of this use
case.

Bug: 6243944
Change-Id: If7f2516649381ce9bcffe4e319b63cbc068f643f
diff --git a/tests/camera2/camera2_utils.cpp b/tests/camera2/camera2_utils.cpp
index ba938d9..cefe29a 100644
--- a/tests/camera2/camera2_utils.cpp
+++ b/tests/camera2/camera2_utils.cpp
@@ -317,7 +317,7 @@
 StreamAdapter::StreamAdapter(sp<ISurfaceTexture> consumer):
         mState(UNINITIALIZED), mDevice(NULL),
         mId(-1),
-        mWidth(0), mHeight(0), mFormatRequested(0)
+        mWidth(0), mHeight(0), mFormat(0)
 {
     mConsumerInterface = new SurfaceTextureClient(consumer);
     camera2_stream_ops::dequeue_buffer = dequeue_buffer;
@@ -342,16 +342,16 @@
 
     mWidth = width;
     mHeight = height;
-    mFormatRequested = format;
+    mFormat = format;
 
     // Allocate device-side stream interface
 
     uint32_t id;
-    uint32_t formatActual;
+    uint32_t formatActual; // ignored
     uint32_t usage;
     uint32_t maxBuffers = 2;
     res = d->ops->allocate_stream(d,
-            mWidth, mHeight, mFormatRequested, getStreamOps(),
+            mWidth, mHeight, mFormat, getStreamOps(),
             &id, &formatActual, &usage, &maxBuffers);
     if (res != OK) {
         ALOGE("%s: Device stream allocation failed: %s (%d)",
@@ -362,7 +362,6 @@
     mDevice = d;
 
     mId = id;
-    mFormat = formatActual;
     mUsage = usage;
     mMaxProducerBuffers = maxBuffers;