Merge "Zero length in keymaster_free_param_set." into nyc-dev
diff --git a/include/hardware/bt_gatt_client.h b/include/hardware/bt_gatt_client.h
index 3462f51..e2c8a92 100644
--- a/include/hardware/bt_gatt_client.h
+++ b/include/hardware/bt_gatt_client.h
@@ -40,9 +40,7 @@
 /** Parameters for GATT read operations */
 typedef struct
 {
-    btgatt_srvc_id_t    srvc_id;
-    btgatt_gatt_id_t    char_id;
-    btgatt_gatt_id_t    descr_id;
+    uint16_t           handle;
     btgatt_unformatted_value_t value;
     uint16_t            value_type;
     uint8_t             status;
@@ -62,8 +60,7 @@
 {
     uint8_t             value[BTGATT_MAX_ATTR_LEN];
     bt_bdaddr_t         bda;
-    btgatt_srvc_id_t    srvc_id;
-    btgatt_gatt_id_t    char_id;
+    uint16_t            handle;
     uint16_t            len;
     uint8_t             is_notify;
 } btgatt_notify_params_t;
@@ -137,27 +134,9 @@
  */
 typedef void (*search_complete_callback)(int conn_id, int status);
 
-/** Reports GATT services on a remote device */
-typedef void (*search_result_callback)( int conn_id, btgatt_srvc_id_t *srvc_id);
-
-/** GATT characteristic enumeration result callback */
-typedef void (*get_characteristic_callback)(int conn_id, int status,
-                btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                int char_prop);
-
-/** GATT descriptor enumeration result callback */
-typedef void (*get_descriptor_callback)(int conn_id, int status,
-                btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                btgatt_gatt_id_t *descr_id);
-
-/** GATT included service enumeration result callback */
-typedef void (*get_included_service_callback)(int conn_id, int status,
-                btgatt_srvc_id_t *srvc_id, btgatt_srvc_id_t *incl_srvc_id);
-
 /** Callback invoked in response to [de]register_for_notification */
 typedef void (*register_for_notification_callback)(int conn_id,
-                int registered, int status, btgatt_srvc_id_t *srvc_id,
-                btgatt_gatt_id_t *char_id);
+                int registered, int status, uint16_t handle);
 
 /**
  * Remote device notification callback, invoked when a remote device sends
@@ -170,8 +149,7 @@
                 btgatt_read_params_t *p_data);
 
 /** GATT write characteristic operation callback */
-typedef void (*write_characteristic_callback)(int conn_id, int status,
-                btgatt_write_params_t *p_data);
+typedef void (*write_characteristic_callback)(int conn_id, int status, uint16_t handle);
 
 /** GATT execute prepared write callback */
 typedef void (*execute_write_callback)(int conn_id, int status);
@@ -181,8 +159,7 @@
                 btgatt_read_params_t *p_data);
 
 /** Callback invoked in response to write_descriptor */
-typedef void (*write_descriptor_callback)(int conn_id, int status,
-                btgatt_write_params_t *p_data);
+typedef void (*write_descriptor_callback)(int conn_id, int status, uint16_t handle);
 
 /** Callback triggered in response to read_remote_rssi */
 typedef void (*read_remote_rssi_callback)(int client_if, bt_bdaddr_t* bda,
@@ -260,10 +237,6 @@
     connect_callback                    open_cb;
     disconnect_callback                 close_cb;
     search_complete_callback            search_complete_cb;
-    search_result_callback              search_result_cb;
-    get_characteristic_callback         get_characteristic_cb;
-    get_descriptor_callback             get_descriptor_cb;
-    get_included_service_callback       get_included_service_cb;
     register_for_notification_callback  register_for_notification_cb;
     notify_callback                     notify_cb;
     read_characteristic_callback        read_characteristic_cb;
@@ -325,48 +298,21 @@
      */
     bt_status_t (*search_service)(int conn_id, bt_uuid_t *filter_uuid );
 
-    /**
-     * Enumerate included services for a given service.
-     * Set start_incl_srvc_id to NULL to get the first included service.
-     */
-    bt_status_t (*get_included_service)( int conn_id, btgatt_srvc_id_t *srvc_id,
-                                         btgatt_srvc_id_t *start_incl_srvc_id);
-
-    /**
-     * Enumerate characteristics for a given service.
-     * Set start_char_id to NULL to get the first characteristic.
-     */
-    bt_status_t (*get_characteristic)( int conn_id,
-                    btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *start_char_id);
-
-    /**
-     * Enumerate descriptors for a given characteristic.
-     * Set start_descr_id to NULL to get the first descriptor.
-     */
-    bt_status_t (*get_descriptor)( int conn_id,
-                    btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                    btgatt_gatt_id_t *start_descr_id);
-
     /** Read a characteristic on a remote device */
-    bt_status_t (*read_characteristic)( int conn_id,
-                    btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+    bt_status_t (*read_characteristic)( int conn_id, uint16_t handle,
                     int auth_req );
 
     /** Write a remote characteristic */
-    bt_status_t (*write_characteristic)(int conn_id,
-                    btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
+    bt_status_t (*write_characteristic)(int conn_id, uint16_t handle,
                     int write_type, int len, int auth_req,
                     char* p_value);
 
     /** Read the descriptor for a given characteristic */
-    bt_status_t (*read_descriptor)(int conn_id,
-                    btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                    btgatt_gatt_id_t *descr_id, int auth_req);
+    bt_status_t (*read_descriptor)(int conn_id, uint16_t handle, int auth_req);
 
     /** Write a remote descriptor for a given characteristic */
-    bt_status_t (*write_descriptor)( int conn_id,
-                    btgatt_srvc_id_t *srvc_id, btgatt_gatt_id_t *char_id,
-                    btgatt_gatt_id_t *descr_id, int write_type, int len,
+    bt_status_t (*write_descriptor)( int conn_id, uint16_t handle,
+                    int write_type, int len,
                     int auth_req, char* p_value);
 
     /** Execute a prepared write operation */
@@ -377,13 +323,11 @@
      * characteristic
      */
     bt_status_t (*register_for_notification)( int client_if,
-                    const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
-                    btgatt_gatt_id_t *char_id);
+                    const bt_bdaddr_t *bd_addr, uint16_t handle);
 
     /** Deregister a previous request for notifications/indications */
     bt_status_t (*deregister_for_notification)( int client_if,
-                    const bt_bdaddr_t *bd_addr, btgatt_srvc_id_t *srvc_id,
-                    btgatt_gatt_id_t *char_id);
+                    const bt_bdaddr_t *bd_addr, uint16_t handle);
 
     /** Request RSSI for a given remote device */
     bt_status_t (*read_remote_rssi)( int client_if, const bt_bdaddr_t *bd_addr);
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h
index e6aac8d..9650ae1 100644
--- a/include/hardware/hwcomposer2.h
+++ b/include/hardware/hwcomposer2.h
@@ -1371,6 +1371,32 @@
         hwc2_device_t* device, hwc2_display_t display, buffer_handle_t target,
         int32_t acquireFence, int32_t /*android_dataspace_t*/ dataspace);
 
+/* setColorMode(..., mode)
+ * Descriptor: HWC2_FUNCTION_SET_COLOR_MODE
+ * Must be provided by all HWC2 devices
+ *
+ * Sets the color mode of the given display.
+ *
+ * Upon returning from this function, the color mode change must have fully
+ * taken effect.
+ *
+ * The valid color modes can be found in android_color_mode_t in
+ * <system/graphics.h>. All HWC2 devices must support at least
+ * HAL_COLOR_MODE_NATIVE, and displays are assumed to be in this mode upon
+ * hotplug.
+ *
+ * Parameters:
+ *   mode - the mode to set
+ *
+ * Returns HWC2_ERROR_NONE or one of the following errors:
+ *   HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
+ *   HWC2_ERROR_BAD_PARAMETER - mode is not a valid color mode
+ *   HWC2_ERROR_UNSUPPORTED - mode is not supported on this display
+ */
+typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_MODE)(
+        hwc2_device_t* device, hwc2_display_t display,
+        int32_t /*android_color_mode_t*/ mode);
+
 /* setColorTransform(..., matrix, hint)
  * Descriptor: HWC2_FUNCTION_SET_COLOR_TRANSFORM
  * Must be provided by all HWC2 devices
@@ -1398,8 +1424,8 @@
  * color [R_out, G_out, B_out] will be:
  *
  * R_out = R_in * r.r + G_in * g.r + B_in * b.r + Tr
- * G_out = G_in * r.g + G_in * g.g + B_in * b.g + Tg
- * B_out = B_in * r.b + G_in * g.b + B_in * b.b + Tb
+ * G_out = R_in * r.g + G_in * g.g + B_in * b.g + Tg
+ * B_out = R_in * r.b + G_in * g.b + B_in * b.b + Tb
  *
  * Parameters:
  *   matrix - a 4x4 transform matrix (16 floats) as described above
@@ -1411,35 +1437,9 @@
  *   HWC2_ERROR_BAD_PARAMETER - hint is not a valid color transform hint
  */
 typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_TRANSFORM)(
-        hwc2_device_t* device, hwc2_display_t display, float* matrix,
+        hwc2_device_t* device, hwc2_display_t display, const float* matrix,
         int32_t /*android_color_transform_t*/ hint);
 
-/* setColorMode(..., mode)
- * Descriptor: HWC2_FUNCTION_SET_COLOR_MODE
- * Must be provided by all HWC2 devices
- *
- * Sets the color mode of the given display.
- *
- * Upon returning from this function, the color mode change must have fully
- * taken effect.
- *
- * The valid color modes can be found in android_color_mode_t in
- * <system/graphics.h>. All HWC2 devices must support at least
- * HAL_COLOR_MODE_NATIVE, and displays are assumed to be in this mode upon
- * hotplug.
- *
- * Parameters:
- *   mode - the mode to set
- *
- * Returns HWC2_ERROR_NONE or one of the following errors:
- *   HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
- *   HWC2_ERROR_BAD_PARAMETER - mode is not a valid color mode
- *   HWC2_ERROR_UNSUPPORTED - mode is not supported on this display
- */
-typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_COLOR_MODE)(
-        hwc2_device_t* device, hwc2_display_t display,
-        int32_t /*android_color_mode_t*/ mode);
-
 /* setOutputBuffer(..., buffer, releaseFence)
  * Descriptor: HWC2_FUNCTION_SET_OUTPUT_BUFFER
  * Must be provided by all HWC2 devices
diff --git a/tests/vehicle/vehicle-hal-tool.c b/tests/vehicle/vehicle-hal-tool.c
index 3c3922f..c93790a 100755
--- a/tests/vehicle/vehicle-hal-tool.c
+++ b/tests/vehicle/vehicle-hal-tool.c
@@ -396,7 +396,6 @@
     float sample_rate,
     uint32_t wait_in_seconds) {
     // Init the device with a callback.
-    device->init(device, vehicle_event_callback, vehicle_error_callback);
     int ret_code = device->subscribe(device, prop, 0, 0);
     if (ret_code != 0) {
         printf("Could not subscribe: %d\n", ret_code);
@@ -412,11 +411,6 @@
     if (ret_code != 0) {
         printf("Error unsubscribing the HAL, still continuining to uninit HAL ...");
     }
-
-    ret_code = device->release(device);
-    if (ret_code != 0) {
-        printf("Error uniniting HAL, exiting anyways.");
-    }
 }
 
 int main(int argc, char* argv[]) {
@@ -438,6 +432,8 @@
     vehicle_hw_device_t *vehicle_device = (vehicle_hw_device_t *) (device);
     printf("HAL Loaded!\n");
 
+    vehicle_device->init(vehicle_device, vehicle_event_callback, vehicle_error_callback);
+
     // If this is a list properties command - we check for -l command.
     int list_properties = 0;
     // Type of the property (see #defines in vehicle.h).
@@ -529,5 +525,10 @@
         }
         subscribe_to_property(vehicle_device, property, sample_rate, wait_time_in_sec);
     }
+
+    ret_code = vehicle_device->release(vehicle_device);
+    if (ret_code != 0) {
+        printf("Error uniniting HAL, exiting anyways.");
+    }
     return 0;
 }