Merge "radio stub HAL."
diff --git a/include/hardware/camera3.h b/include/hardware/camera3.h
index 5fcbf0f..284c78b 100644
--- a/include/hardware/camera3.h
+++ b/include/hardware/camera3.h
@@ -128,6 +128,13 @@
  * 3.3: Minor revision of expanded-capability HAL:
  *
  *   - OPAQUE and YUV reprocessing API updates.
+ *
+ *   - Basic support for depth output buffers.
+ *
+ *   - Addition of data_space field to camera3_stream_t.
+ *
+ *   - Addition of rotation field to camera3_stream_t.
+ *
  */
 
 /**
@@ -1365,6 +1372,25 @@
 } camera3_stream_type_t;
 
 /**
+ * camera3_stream_rotation_t:
+ *
+ * The required counterclockwise rotation of camera stream.
+ */
+typedef enum camera3_stream_rotation {
+    /* No rotation */
+    CAMERA3_STREAM_ROTATION_0 = 0,
+
+    /* Rotate by 90 degree counterclockwise */
+    CAMERA3_STREAM_ROTATION_90 = 1,
+
+    /* Rotate by 180 degree counterclockwise */
+    CAMERA3_STREAM_ROTATION_180 = 2,
+
+    /* Rotate by 270 degree counterclockwise */
+    CAMERA3_STREAM_ROTATION_270 = 3
+} camera3_stream_rotation_t;
+
+/**
  * camera3_stream_t:
  *
  * A handle to a single camera input or output stream. A stream is defined by
@@ -1482,6 +1508,59 @@
      */
     void *priv;
 
+    /**
+     * A field that describes the contents of the buffer. The format and buffer
+     * dimensions define the memory layout and structure of the stream buffers,
+     * while dataSpace defines the meaning of the data within the buffer.
+     *
+     * For most formats, dataSpace defines the color space of the image data.
+     * In addition, for some formats, dataSpace indicates whether image- or
+     * depth-based data is requested.  See system/core/include/system/graphics.h
+     * for details of formats and valid dataSpace values for each format.
+     *
+     * Version information:
+     *
+     * < CAMERA_DEVICE_API_VERSION_3_3:
+     *
+     *   Not defined and should not be accessed. dataSpace should be assumed to
+     *   be HAL_DATASPACE_UNKNOWN, and the appropriate color space, etc, should
+     *   be determined from the usage flags and the format.
+     *
+     * >= CAMERA_DEVICE_API_VERSION_3_3:
+     *
+     *   Always set by the camera service. HAL must use this dataSpace to
+     *   configure the stream to the correct colorspace, or to select between
+     *   color and depth outputs if supported.
+     */
+    android_dataspace_t data_space;
+
+    /**
+     * The required output rotation of the stream, one of
+     * the camera3_stream_rotation_t values. This must be inspected by HAL along
+     * with stream width and height. For example, if the rotation is 90 degree
+     * and the stream width and height is 720 and 1280 respectively, camera service
+     * will supply buffers of size 720x1280, and HAL should capture a 1280x720 image
+     * and rotate the image by 90 degree counterclockwise.
+     *
+     * <= CAMERA_DEVICE_API_VERSION_3_2:
+     *
+     *    Not defined and must not be accessed. HAL must not apply any rotation
+     *    on output images.
+     *
+     * >= CAMERA_DEVICE_API_VERSION_3_3:
+     *
+     *    Always set by camera service. HAL must inspect this field during stream
+     *    configuration and returns -EINVAL if HAL cannot perform such rotation.
+     *    HAL must always support CAMERA3_STREAM_ROTATION_0, so a
+     *    configure_streams() call must not fail for unsupported rotation if
+     *    rotation field of all streams is CAMERA3_STREAM_ROTATION_0.
+     *
+     */
+    int rotation;
+
+    /* reserved for future use */
+    void *reserved[7];
+
 } camera3_stream_t;
 
 /**
@@ -2536,6 +2615,9 @@
      *
      *          - Including too many output streams of a certain format.
      *
+     *          - Unsupported rotation configuration (only applies to
+     *            devices with version >= CAMERA_DEVICE_API_VERSION_3_3)
+     *
      *          Note that the framework submitting an invalid stream
      *          configuration is not normal operation, since stream
      *          configurations are checked before configure. An invalid
diff --git a/include/hardware/camera_common.h b/include/hardware/camera_common.h
index 0a907b9..c2d4536 100644
--- a/include/hardware/camera_common.h
+++ b/include/hardware/camera_common.h
@@ -236,10 +236,12 @@
     const camera_metadata_t *static_camera_characteristics;
 
     /**
-     * The total resource "cost" of using this this camera, represented as
-     * an integer value in the range [0, 100] where 100 represents total usage
-     * of the shared resource that is the limiting bottleneck of the camera
-     * subsystem.
+     * The total resource "cost" of using this camera, represented as an integer
+     * value in the range [0, 100] where 100 represents total usage of the shared
+     * resource that is the limiting bottleneck of the camera subsystem.  This may
+     * be a very rough estimate, and is used as a hint to the camera service to
+     * determine when to disallow multiple applications from simultaneously
+     * opening different cameras advertised by the camera service.
      *
      * The camera service must be able to simultaneously open and use any
      * combination of camera devices exposed by the HAL where the sum of
@@ -249,12 +251,112 @@
      * available in the configuration settings exposed for that device through
      * the camera metadata.
      *
-     * Note: The camera service may still attempt to simultaneously open
-     * combinations of camera devices with a total resource cost > 100.  This
-     * may succeed or fail.  If this succeeds, combinations of configurations
-     * that are not supported should fail during the configure calls.  If the
-     * total resource cost is <= 100, configuration should never fail due to
-     * resource constraints.
+     * The camera service may still attempt to simultaneously open combinations
+     * of camera devices with a total resource cost > 100.  This may succeed or
+     * fail.  If this succeeds, combinations of configurations that are not
+     * supported due to resource constraints from having multiple open devices
+     * should fail during the configure calls.  If the total resource cost is
+     * <= 100, open and configure should never fail for any stream configuration
+     * settings or other device capabilities that would normally succeed for a
+     * device when it is the only open camera device.
+     *
+     * This field will be used to determine whether background applications are
+     * allowed to use this camera device while other applications are using other
+     * camera devices.  Note: multiple applications will never be allowed by the
+     * camera service to simultaneously open the same camera device.
+     *
+     * Example use cases:
+     *
+     * Ex. 1: Camera Device 0 = Back Camera
+     *        Camera Device 1 = Front Camera
+     *   - Using both camera devices causes a large framerate slowdown due to
+     *     limited ISP bandwidth.
+     *
+     *   Configuration:
+     *
+     *   Camera Device 0 - resource_cost = 51
+     *                     conflicting_devices = null
+     *   Camera Device 1 - resource_cost = 51
+     *                     conflicting_devices = null
+     *
+     *   Result:
+     *
+     *   Since the sum of the resource costs is > 100, if a higher-priority
+     *   application has either device open, no lower-priority applications will be
+     *   allowed by the camera service to open either device.  If a lower-priority
+     *   application is using a device that a higher-priority subsequently attempts
+     *   to open, the lower-priority application will be forced to disconnect the
+     *   the device.
+     *
+     *   If the highest-priority application chooses, it may still attempt to open
+     *   both devices (since these devices are not listed as conflicting in the
+     *   conflicting_devices fields), but usage of these devices may fail in the
+     *   open or configure calls.
+     *
+     * Ex. 2: Camera Device 0 = Left Back Camera
+     *        Camera Device 1 = Right Back Camera
+     *        Camera Device 2 = Combined stereo camera using both right and left
+     *                          back camera sensors used by devices 0, and 1
+     *        Camera Device 3 = Front Camera
+     *   - Due to do hardware constraints, up to two cameras may be open at once. The
+     *     combined stereo camera may never be used at the same time as either of the
+     *     two back camera devices (device 0, 1), and typically requires too much
+     *     bandwidth to use at the same time as the front camera (device 3).
+     *
+     *   Configuration:
+     *
+     *   Camera Device 0 - resource_cost = 50
+     *                     conflicting_devices = { 2 }
+     *   Camera Device 1 - resource_cost = 50
+     *                     conflicting_devices = { 2 }
+     *   Camera Device 2 - resource_cost = 100
+     *                     conflicting_devices = { 0, 1 }
+     *   Camera Device 3 - resource_cost = 50
+     *                     conflicting_devices = null
+     *
+     *   Result:
+     *
+     *   Based on the conflicting_devices fields, the camera service guarantees that
+     *   the following sets of open devices will never be allowed: { 1, 2 }, { 0, 2 }.
+     *
+     *   Based on the resource_cost fields, if a high-priority foreground application
+     *   is using camera device 0, a background application would be allowed to open
+     *   camera device 1 or 3 (but would be forced to disconnect it again if the
+     *   foreground application opened another device).
+     *
+     *   The highest priority application may still attempt to simultaneously open
+     *   devices 0, 2, and 3, but the HAL may fail in open or configure calls for
+     *   this combination.
+     *
+     * Ex. 3: Camera Device 0 = Back Camera
+     *        Camera Device 1 = Front Camera
+     *        Camera Device 2 = Low-power Front Camera that uses the same
+     *                          sensor as device 1, but only exposes image stream
+     *                          resolutions that can be used in low-power mode
+     *  - Using both front cameras (device 1, 2) at the same time is impossible due
+     *    a shared physical sensor.  Using the back and "high-power" front camera
+     *    (device 1) may be impossible for some stream configurations due to hardware
+     *    limitations, but the "low-power" front camera option may always be used as
+     *    it has special dedicated hardware.
+     *
+     *   Configuration:
+     *
+     *   Camera Device 0 - resource_cost = 100
+     *                     conflicting_devices = null
+     *   Camera Device 1 - resource_cost = 100
+     *                     conflicting_devices = { 2 }
+     *   Camera Device 2 - resource_cost = 0
+     *                     conflicting_devices = { 1 }
+     *   Result:
+     *
+     *   Based on the conflicting_devices fields, the camera service guarantees that
+     *   the following sets of open devices will never be allowed: { 1, 2 }.
+     *
+     *   Based on the resource_cost fields, only the highest priority application
+     *   may attempt to open both device 0 and 1 at the same time. If a higher-priority
+     *   application is not using device 1 or 2, a low-priority background application
+     *   may open device 2 (but will be forced to disconnect it if a higher-priority
+     *   application subsequently opens device 1 or 2).
      *
      * Version information (based on camera_module_t.common.module_api_version):
      *
@@ -281,6 +383,9 @@
      * The camera service will never simultaneously open any of the devices
      * in this list while this camera device is open.
      *
+     * The strings pointed to in this field will not be cleaned up by the camera
+     * service, and must remain while this device is plugged in.
+     *
      * Version information (based on camera_module_t.common.module_api_version):
      *
      *  CAMERA_MODULE_API_VERSION_2_3 or lower:
@@ -391,7 +496,7 @@
  * device is present. The framework will not call set_torch_mode() to turn on
  * torch mode of a camera device if the camera device is not present. At module
  * load time, the framework will assume torch modes are in the
- * TORCH_MODE_STATUS_AVAILABLE state if the camera device is present and
+ * TORCH_MODE_STATUS_OFF state if the camera device is present and
  * android.flash.info.available is reported as true via get_camera_info() call.
  *
  * The behaviors of the camera HAL module that the framework expects in the
@@ -400,7 +505,7 @@
  *      After camera_module_callbacks::camera_device_status_change() is invoked
  *      to inform the framework that the camera device is present, the framework
  *      will assume the camera device's torch mode is in
- *      TORCH_MODE_STATUS_AVAILABLE state. The camera HAL module does not need
+ *      TORCH_MODE_STATUS_OFF state. The camera HAL module does not need
  *      to invoke camera_module_callbacks::torch_mode_status_change() unless the
  *      flash unit is unavailable to use by set_torch_mode().
  *
@@ -416,47 +521,49 @@
  *  3. open() is called to open a camera device.
  *      The camera HAL module must invoke
  *      camera_module_callbacks::torch_mode_status_change() for all flash units
- *      that have entered TORCH_MODE_STATUS_RESOURCE_BUSY state and can not be
+ *      that have entered TORCH_MODE_STATUS_NOT_AVAILABLE state and can not be
  *      turned on by calling set_torch_mode() anymore due to this open() call.
  *
  *  4. close() is called to close a camera device.
  *      The camera HAL module must invoke
  *      camera_module_callbacks::torch_mode_status_change() for all flash units
- *      that have entered TORCH_MODE_STATUS_AVAILABLE state and can be turned
+ *      that have entered TORCH_MODE_STATUS_OFF state and can be turned
  *      on by calling set_torch_mode() again because of enough resources freed
  *      up by this close() call.
  *
- *  Note that the framework calling set_torch_mode() should not trigger any
- *  callbacks except when HAL cannot keep multiple torch modes on
- *  simultaneously. In that case, HAL must notify the framework that any
- *  previously-on torch mode states have become TORCH_MODE_STATUS_OFF.
- *
+ *  Note that the framework calling set_torch_mode() successfully must trigger
+ *  TORCH_MODE_STATUS_OFF or TORCH_MODE_STATUS_ON callback for the given camera
+ *  device. Additionally it must trigger TORCH_MODE_STATUS_OFF callbacks for
+ *  other previously-on torch modes if HAL cannot keep multiple torch modes on
+ *  simultaneously.
  */
 typedef enum torch_mode_status {
-    /**
-     * The flash unit is available and the torch mode can be turned on by
-     * calling set_torch_mode(). By default, the framework will assume all
-     * flash units of all present camera devices are in this state if
-     * android.flash.info.available is reported as true via get_camera_info()
-     * call.
-     */
-    TORCH_MODE_STATUS_AVAILABLE = 0,
 
     /**
      * The flash unit is no longer available and the torch mode can not be
      * turned on by calling set_torch_mode(). If the torch mode is on, it
      * will be turned off by HAL before HAL calls torch_mode_status_change().
      */
-    TORCH_MODE_STATUS_RESOURCE_BUSY = 1,
+    TORCH_MODE_STATUS_NOT_AVAILABLE = 0,
 
     /**
-     * The previously-on torch mode has been turned off by HAL but the flash
-     * unit is still available for set_torch_mode(). This may happen after the
-     * framework turned on the torch mode of some other camera device and HAL
-     * had to turn off the torch modes of any camera devices that were
-     * previously on.
+     * A torch mode has become off and available to be turned on via
+     * set_torch_mode(). This may happen in the following
+     * cases:
+     *   1. After the resources to turn on the torch mode have become available.
+     *   2. After set_torch_mode() is called to turn off the torch mode.
+     *   3. After the framework turned on the torch mode of some other camera
+     *      device and HAL had to turn off the torch modes of any camera devices
+     *      that were previously on.
      */
-    TORCH_MODE_STATUS_OFF = 2,
+    TORCH_MODE_STATUS_AVAILABLE_OFF = 1,
+
+    /**
+     * A torch mode has become on and available to be turned off via
+     * set_torch_mode(). This can happen only after set_torch_mode() is called
+     * to turn on the torch mode.
+     */
+    TORCH_MODE_STATUS_AVAILABLE_ON = 2,
 
 } torch_mode_status_t;
 
@@ -713,18 +820,19 @@
      * set_torch_mode:
      *
      * Turn on or off the torch mode of the flash unit associated with a given
-     * camera ID. This function is blocking until the operation completes or
-     * fails.
+     * camera ID. If the operation is successful, HAL must notify the framework
+     * torch state by invoking
+     * camera_module_callbacks.torch_mode_status_change() with the new state.
      *
      * The camera device has a higher priority accessing the flash unit. When
      * there are any resource conflicts, such as open() is called to open a
      * camera device, HAL module must notify the framework through
      * camera_module_callbacks.torch_mode_status_change() that the
      * torch mode has been turned off and the torch mode state has become
-     * TORCH_MODE_STATUS_RESOURCE_BUSY. When resources to turn on torch mode
+     * TORCH_MODE_STATUS_NOT_AVAILABLE. When resources to turn on torch mode
      * become available again, HAL module must notify the framework through
      * camera_module_callbacks.torch_mode_status_change() that the torch mode
-     * state has become available for set_torch_mode() to be called.
+     * state has become TORCH_MODE_STATUS_OFF for set_torch_mode() to be called.
      *
      * When the framework calls set_torch_mode() to turn on the torch mode of a
      * flash unit, if HAL cannot keep multiple torch modes on simultaneously,
diff --git a/include/hardware/keyguard.h b/include/hardware/keyguard.h
index 2d65d4b..88dcad1 100644
--- a/include/hardware/keyguard.h
+++ b/include/hardware/keyguard.h
@@ -53,9 +53,9 @@
      * Returns: 0 on success or an error code less than 0 on error.
      * On error, enrolled_password_handle will not be allocated.
      */
-    int (*enroll)(const struct keyguard_device *dev, const uint8_t *password_payload,
-            const uint8_t password_payload_length, uint8_t **enrolled_password_handle,
-            uint8_t *enrolled_password_handle_length);
+    int (*enroll)(const struct keyguard_device *dev, uint32_t uid,
+            const uint8_t *password_payload, size_t password_payload_length,
+            uint8_t **enrolled_password_handle, size_t *enrolled_password_handle_length);
 
     /**
      * Verifies provided_password matches enrolled_password_handle.
@@ -70,9 +70,10 @@
      * Returns: 0 on success or an error code less than 0 on error
      * On error, verification token will not be allocated
      */
-    int (*verify)(const struct keyguard_device *dev, const uint8_t *enrolled_password_handle,
-            const uint8_t enrolled_password_handle_length, const uint8_t *provided_password,
-            const uint8_t provided_password_length, uint8_t **verification_token);
+    int (*verify)(const struct keyguard_device *dev, uint32_t uid,
+            const uint8_t *enrolled_password_handle, size_t enrolled_password_handle_length,
+            const uint8_t *provided_password, size_t provided_password_length,
+            uint8_t **verification_token, size_t *verification_token_length);
 
 };
 typedef struct keyguard_device keyguard_device_t;
diff --git a/include/hardware/keymaster_defs.h b/include/hardware/keymaster_defs.h
index 2e93dc6..a8f73ff 100644
--- a/include/hardware/keymaster_defs.h
+++ b/include/hardware/keymaster_defs.h
@@ -461,6 +461,54 @@
     return param;
 }
 
+#define KEYMASTER_SIMPLE_COMPARE(a, b) (a < b) ? -1 : ((a > b) ? 1 : 0)
+inline int keymaster_param_compare(const keymaster_key_param_t* a, const keymaster_key_param_t* b) {
+    int retval = KEYMASTER_SIMPLE_COMPARE(a->tag, b->tag);
+    if (retval != 0)
+        return retval;
+
+    switch (keymaster_tag_get_type(a->tag)) {
+    case KM_INVALID:
+    case KM_BOOL:
+        return 0;
+    case KM_ENUM:
+    case KM_ENUM_REP:
+        return KEYMASTER_SIMPLE_COMPARE(a->enumerated, b->enumerated);
+    case KM_INT:
+    case KM_INT_REP:
+        return KEYMASTER_SIMPLE_COMPARE(a->integer, b->integer);
+    case KM_LONG:
+        return KEYMASTER_SIMPLE_COMPARE(a->long_integer, b->long_integer);
+    case KM_DATE:
+        return KEYMASTER_SIMPLE_COMPARE(a->date_time, b->date_time);
+    case KM_BIGNUM:
+    case KM_BYTES:
+        // Handle the empty cases.
+        if (a->blob.data_length != 0 && b->blob.data_length == 0)
+            return -1;
+        if (a->blob.data_length == 0 && b->blob.data_length == 0)
+            return 0;
+        if (a->blob.data_length == 0 && b->blob.data_length > 0)
+            return 1;
+
+        retval = memcmp(a->blob.data, b->blob.data, a->blob.data_length < b->blob.data_length
+                                                        ? a->blob.data_length
+                                                        : b->blob.data_length);
+        if (retval != 0)
+            return retval;
+        else if (a->blob.data_length != b->blob.data_length) {
+            // Equal up to the common length; longer one is larger.
+            if (a->blob.data_length < b->blob.data_length)
+                return -1;
+            if (a->blob.data_length > b->blob.data_length)
+                return 1;
+        };
+    }
+
+    return 0;
+}
+#undef KEYMASTER_SIMPLE_COMPARE
+
 inline void keymaster_free_param_values(keymaster_key_param_t* param, size_t param_count) {
     while (param_count-- > 0) {
         switch (keymaster_tag_get_type(param->tag)) {
diff --git a/modules/camera/ExampleCamera.cpp b/modules/camera/ExampleCamera.cpp
index ca28b99..d873321 100644
--- a/modules/camera/ExampleCamera.cpp
+++ b/modules/camera/ExampleCamera.cpp
@@ -92,7 +92,7 @@
 
     /* android.scaler */
     int32_t android_scaler_available_formats[] = {
-            HAL_PIXEL_FORMAT_RAW_SENSOR,
+            HAL_PIXEL_FORMAT_RAW16,
             HAL_PIXEL_FORMAT_BLOB,
             HAL_PIXEL_FORMAT_RGBA_8888,
             HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
diff --git a/modules/camera/Stream.cpp b/modules/camera/Stream.cpp
index 90ad30b..e0099b6 100644
--- a/modules/camera/Stream.cpp
+++ b/modules/camera/Stream.cpp
@@ -117,10 +117,6 @@
         return "RGB 888";
     case HAL_PIXEL_FORMAT_RGB_565:
         return "RGB 565";
-    case HAL_PIXEL_FORMAT_sRGB_A_8888:
-        return "sRGB A 8888";
-    case HAL_PIXEL_FORMAT_sRGB_X_8888:
-        return "sRGB B 8888";
     case HAL_PIXEL_FORMAT_Y8:
         return "Y8";
     case HAL_PIXEL_FORMAT_Y16:
@@ -133,8 +129,10 @@
         return "NV21";
     case HAL_PIXEL_FORMAT_YCbCr_422_I:
         return "YUY2";
-    case HAL_PIXEL_FORMAT_RAW_SENSOR:
-        return "RAW SENSOR";
+    case HAL_PIXEL_FORMAT_RAW10:
+        return "RAW10";
+    case HAL_PIXEL_FORMAT_RAW16:
+        return "RAW16";
     case HAL_PIXEL_FORMAT_BLOB:
         return "BLOB";
     case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
diff --git a/modules/gralloc/gralloc.cpp b/modules/gralloc/gralloc.cpp
index bdc789d..a9fbc80 100644
--- a/modules/gralloc/gralloc.cpp
+++ b/modules/gralloc/gralloc.cpp
@@ -217,7 +217,7 @@
             bpp = 3;
             break;
         case HAL_PIXEL_FORMAT_RGB_565:
-        case HAL_PIXEL_FORMAT_RAW_SENSOR:
+        case HAL_PIXEL_FORMAT_RAW16:
             bpp = 2;
             break;
         default:
diff --git a/modules/usbcamera/Stream.cpp b/modules/usbcamera/Stream.cpp
index a3fefa3..f56866e 100644
--- a/modules/usbcamera/Stream.cpp
+++ b/modules/usbcamera/Stream.cpp
@@ -98,10 +98,6 @@
         return "RGB 888";
     case HAL_PIXEL_FORMAT_RGB_565:
         return "RGB 565";
-    case HAL_PIXEL_FORMAT_sRGB_A_8888:
-        return "sRGB A 8888";
-    case HAL_PIXEL_FORMAT_sRGB_X_8888:
-        return "sRGB B 8888";
     case HAL_PIXEL_FORMAT_Y8:
         return "Y8";
     case HAL_PIXEL_FORMAT_Y16:
@@ -114,8 +110,10 @@
         return "NV21";
     case HAL_PIXEL_FORMAT_YCbCr_422_I:
         return "YUY2";
-    case HAL_PIXEL_FORMAT_RAW_SENSOR:
-        return "RAW SENSOR";
+    case HAL_PIXEL_FORMAT_RAW10:
+        return "RAW10";
+    case HAL_PIXEL_FORMAT_RAW16:
+        return "RAW16";
     case HAL_PIXEL_FORMAT_BLOB:
         return "BLOB";
     case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED:
diff --git a/modules/usbcamera/UsbCamera.cpp b/modules/usbcamera/UsbCamera.cpp
index ded3e92..82a1145 100644
--- a/modules/usbcamera/UsbCamera.cpp
+++ b/modules/usbcamera/UsbCamera.cpp
@@ -94,7 +94,7 @@
 
     /* android.scaler */
     int32_t android_scaler_available_formats[] = {
-            HAL_PIXEL_FORMAT_RAW_SENSOR,
+            HAL_PIXEL_FORMAT_RAW16,
             HAL_PIXEL_FORMAT_BLOB,
             HAL_PIXEL_FORMAT_RGBA_8888,
             HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED,
diff --git a/tests/camera2/CameraMetadataTests.cpp b/tests/camera2/CameraMetadataTests.cpp
index 94fa911..da5b748 100644
--- a/tests/camera2/CameraMetadataTests.cpp
+++ b/tests/camera2/CameraMetadataTests.cpp
@@ -169,7 +169,7 @@
         if (rawResolutionsCount > 0) {
             EXPECT_TRUE(
                 HasElementInArrayFromStaticTag(ANDROID_SCALER_AVAILABLE_FORMATS,
-                        HAL_PIXEL_FORMAT_RAW_SENSOR));
+                        HAL_PIXEL_FORMAT_RAW16));
         }
 
         // Required processed sizes.
diff --git a/tests/camera2/CameraMultiStreamTests.cpp b/tests/camera2/CameraMultiStreamTests.cpp
index df8e623..1edc28e 100644
--- a/tests/camera2/CameraMultiStreamTests.cpp
+++ b/tests/camera2/CameraMultiStreamTests.cpp
@@ -208,7 +208,7 @@
         void SetUp() {
             ASSERT_EQ(OK,
                 mDevice->createStream(mNativeWindow,
-                    mWidth, mHeight, mFormat,
+                    mWidth, mHeight, mFormat, HAL_DATASPACE_UNKNOWN,
                     &mStreamId));
 
             ASSERT_NE(-1, mStreamId);
diff --git a/tests/camera2/CameraStreamFixture.h b/tests/camera2/CameraStreamFixture.h
index cc13169..ff110d8 100644
--- a/tests/camera2/CameraStreamFixture.h
+++ b/tests/camera2/CameraStreamFixture.h
@@ -257,6 +257,7 @@
         ASSERT_EQ(OK,
             device->createStream(mNativeWindow,
                 mWidth, mHeight, format,
+                HAL_DATASPACE_UNKNOWN,
                 &mStreamId));
 
         ASSERT_NE(-1, mStreamId);
diff --git a/tests/camera2/CameraStreamTests.cpp b/tests/camera2/CameraStreamTests.cpp
index 69ee274..a3b8c47 100644
--- a/tests/camera2/CameraStreamTests.cpp
+++ b/tests/camera2/CameraStreamTests.cpp
@@ -166,15 +166,15 @@
         /*mHeapCount*/ 3
     },
     {
-        /*mFormat*/    HAL_PIXEL_FORMAT_RAW_SENSOR,
+        /*mFormat*/    HAL_PIXEL_FORMAT_RAW16,
         /*mHeapCount*/ 1
     },
     {
-        /*mFormat*/    HAL_PIXEL_FORMAT_RAW_SENSOR,
+        /*mFormat*/    HAL_PIXEL_FORMAT_RAW16,
         /*mHeapCount*/ 2
     },
     {
-        /*mFormat*/    HAL_PIXEL_FORMAT_RAW_SENSOR,
+        /*mFormat*/    HAL_PIXEL_FORMAT_RAW16,
         /*mHeapCount*/ 3
     },
 };
diff --git a/tests/camera2/camera2.cpp b/tests/camera2/camera2.cpp
index 72b7b61..8d637d4 100644
--- a/tests/camera2/camera2.cpp
+++ b/tests/camera2/camera2.cpp
@@ -305,7 +305,7 @@
             }
 
             camera_metadata_ro_entry_t availableSizes;
-            if (format == HAL_PIXEL_FORMAT_RAW_SENSOR) {
+            if (format == HAL_PIXEL_FORMAT_RAW16) {
                 res = find_camera_metadata_ro_entry(mStaticInfo,
                         ANDROID_SCALER_AVAILABLE_RAW_SIZES,
                         &availableSizes);
@@ -445,7 +445,7 @@
         const int32_t *rawResolutions;
         size_t   rawResolutionsCount;
 
-        int format = HAL_PIXEL_FORMAT_RAW_SENSOR;
+        int format = HAL_PIXEL_FORMAT_RAW16;
 
         getResolutionList(format,
                 &rawResolutions, &rawResolutionsCount);
@@ -457,7 +457,7 @@
                       << test_info->test_case_name() << "."
                       << test_info->name()
                       << " because the optional format was not available: "
-                      << "RAW_SENSOR" << std::endl;
+                      << "RAW16" << std::endl;
             return;
         }
 
@@ -581,7 +581,7 @@
         const int32_t *rawResolutions;
         size_t    rawResolutionsCount;
 
-        int format = HAL_PIXEL_FORMAT_RAW_SENSOR;
+        int format = HAL_PIXEL_FORMAT_RAW16;
 
         getResolutionList(format,
                 &rawResolutions, &rawResolutionsCount);
@@ -593,7 +593,7 @@
                       << test_info->test_case_name() << "."
                       << test_info->name()
                       << " because the optional format was not available: "
-                      << "RAW_SENSOR" << std::endl;
+                      << "RAW16" << std::endl;
             return;
         }