Merge "HWC2: Add const and alphabetize" 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/power.h b/include/hardware/power.h
index 29ef4dc..cc6f5b9 100644
--- a/include/hardware/power.h
+++ b/include/hardware/power.h
@@ -48,7 +48,8 @@
     POWER_HINT_VIDEO_ENCODE = 0x00000003,
     POWER_HINT_VIDEO_DECODE = 0x00000004,
     POWER_HINT_LOW_POWER = 0x00000005,
-    POWER_HINT_SUSTAINED_PERFORMANCE = 0x00000006
+    POWER_HINT_SUSTAINED_PERFORMANCE = 0x00000006,
+    POWER_HINT_VR_MODE = 0x00000007
 } power_hint_t;
 
 typedef enum {
@@ -136,6 +137,13 @@
      *     non-zero when sustained performance mode is activated, and zero
      *     when deactivated.
      *
+     * POWER_HINT_VR_MODE
+     *
+     *     VR Mode is activated or deactivated. VR mode is intended to
+     *     provide minimum guarantee for performance for the amount of time the
+     *     device can sustain it. The data parameter is non-zero when the mode
+     *     is activated and zero when deactivated.
+     *
      * A particular platform may choose to ignore any hint.
      *
      * availability: version 0.2
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;
 }