Merge "Camera2 Tests: Add multiple stream tests" into klp-dev
diff --git a/include/hardware/bt_rc.h b/include/hardware/bt_rc.h
index 952652e..d455543 100755
--- a/include/hardware/bt_rc.h
+++ b/include/hardware/bt_rc.h
@@ -30,6 +30,13 @@
 typedef uint8_t btrc_uid_t[BTRC_UID_SIZE];
 
 typedef enum {
+    BTRC_FEAT_NONE = 0x00,    /* AVRCP 1.0 */
+    BTRC_FEAT_METADATA = 0x01,    /* AVRCP 1.3 */
+    BTRC_FEAT_ABSOLUTE_VOLUME = 0x02,    /* Supports TG role and volume sync */
+    BTRC_FEAT_BROWSE = 0x04,    /* AVRCP 1.4 and up, with Browsing support */
+} btrc_remote_features_t;
+
+typedef enum {
     BTRC_PLAYSTATE_STOPPED = 0x00,    /* Stopped */
     BTRC_PLAYSTATE_PLAYING = 0x01,    /* Playing */
     BTRC_PLAYSTATE_PAUSED = 0x02,    /* Paused  */
@@ -114,6 +121,10 @@
     uint8_t text[BTRC_MAX_ATTR_STR_LEN];
 } btrc_element_attr_val_t;
 
+/** Callback for the controller's supported feautres */
+typedef void (* btrc_remote_features_callback)(bt_bdaddr_t *bd_addr,
+                                                      btrc_remote_features_t features);
+
 /** Callback for play status request */
 typedef void (* btrc_get_play_status_callback)();
 
@@ -151,10 +162,20 @@
 */
 typedef void (* btrc_register_notification_callback) (btrc_event_id_t event_id, uint32_t param);
 
+/* AVRCP 1.4 Enhancements */
+/** Callback for volume change on CT
+**  volume: Current volume setting on the CT (0-127)
+*/
+typedef void (* btrc_volume_change_callback) (uint8_t volume, uint8_t ctype);
+
+/** Callback for passthrough commands */
+typedef void (* btrc_passthrough_cmd_callback) (int id, int key_state);
+
 /** BT-RC callback structure. */
 typedef struct {
     /** set to sizeof(BtRcCallbacks) */
     size_t      size;
+    btrc_remote_features_callback               remote_features_cb;
     btrc_get_play_status_callback               get_play_status_cb;
     btrc_list_player_app_attr_callback          list_player_app_attr_cb;
     btrc_list_player_app_values_callback        list_player_app_values_cb;
@@ -164,6 +185,8 @@
     btrc_set_player_app_value_callback          set_player_app_value_cb;
     btrc_get_element_attr_callback              get_element_attr_cb;
     btrc_register_notification_callback         register_notification_cb;
+    btrc_volume_change_callback                 volume_change_cb;
+    btrc_passthrough_cmd_callback               passthrough_cmd_cb;
 } btrc_callbacks_t;
 
 /** Represents the standard BT-RC interface. */
@@ -225,6 +248,15 @@
                                              btrc_notification_type_t type,
                                              btrc_register_notification_t *p_param);
 
+    /* AVRCP 1.4 enhancements */
+
+    /**Send current volume setting to remote side. Support limited to SetAbsoluteVolume
+    ** This can be enhanced to support Relative Volume (AVRCP 1.0).
+    ** With RelateVolume, we will send VOLUME_UP/VOLUME_DOWN opposed to absolute volume level
+    ** volume: Should be in the range 0-127. bit7 is reseved and cannot be set
+    */
+    bt_status_t (*set_volume)(uint8_t volume);
+
     /** Closes the interface. */
     void  (*cleanup)( void );
 } btrc_interface_t;
diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h
index 9492d3a..846bab4 100644
--- a/include/hardware/hwcomposer.h
+++ b/include/hardware/hwcomposer.h
@@ -449,12 +449,12 @@
      * For HWC 1.0, numDisplays will always be one, and displays[0] will be
      * non-NULL.
      *
-     * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries
-     * for unsupported or disabled/disconnected display types will be NULL.
+     * For HWC 1.1, numDisplays will always be HWC_NUM_PHYSICAL_DISPLAY_TYPES.
+     * Entries for unsupported or disabled/disconnected display types will be
+     * NULL.
      *
-     * In a future version, numDisplays may be larger than
-     * HWC_NUM_DISPLAY_TYPES. The extra entries correspond to enabled virtual
-     * displays, and will be non-NULL.
+     * In HWC 1.3, numDisplays may be up to HWC_NUM_DISPLAY_TYPES. The extra
+     * entries correspond to enabled virtual displays, and will be non-NULL.
      *
      * returns: 0 on success. An negative error code on error. If an error is
      * returned, SurfaceFlinger will assume that none of the layer will be
@@ -482,12 +482,12 @@
      * For HWC 1.0, numDisplays will always be one, and displays[0] will be
      * non-NULL.
      *
-     * For HWC 1.1, numDisplays will always be HWC_NUM_DISPLAY_TYPES. Entries
-     * for unsupported or disabled/disconnected display types will be NULL.
+     * For HWC 1.1, numDisplays will always be HWC_NUM_PHYSICAL_DISPLAY_TYPES.
+     * Entries for unsupported or disabled/disconnected display types will be
+     * NULL.
      *
-     * In a future version, numDisplays may be larger than
-     * HWC_NUM_DISPLAY_TYPES. The extra entries correspond to enabled virtual
-     * displays, and will be non-NULL.
+     * In HWC 1.3, numDisplays may be up to HWC_NUM_DISPLAY_TYPES. The extra
+     * entries correspond to enabled virtual displays, and will be non-NULL.
      *
      * IMPORTANT NOTE: There is an implicit layer containing opaque black
      * pixels behind all the layers in the list. It is the responsibility of
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index ce4723c..c69a4bc 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -182,12 +182,16 @@
 enum {
     HWC_DISPLAY_PRIMARY     = 0,
     HWC_DISPLAY_EXTERNAL    = 1,    // HDMI, DP, etc.
-    HWC_NUM_DISPLAY_TYPES
+    HWC_DISPLAY_VIRTUAL     = 2,
+
+    HWC_NUM_PHYSICAL_DISPLAY_TYPES = 2,
+    HWC_NUM_DISPLAY_TYPES          = 3,
 };
 
 enum {
     HWC_DISPLAY_PRIMARY_BIT     = 1 << HWC_DISPLAY_PRIMARY,
     HWC_DISPLAY_EXTERNAL_BIT    = 1 << HWC_DISPLAY_EXTERNAL,
+    HWC_DISPLAY_VIRTUAL_BIT     = 1 << HWC_DISPLAY_VIRTUAL,
 };
 
 /*****************************************************************************/
diff --git a/tests/hwc/cnativewindow.c b/tests/hwc/cnativewindow.c
index 474ceec..76f4564 100644
--- a/tests/hwc/cnativewindow.c
+++ b/tests/hwc/cnativewindow.c
@@ -74,7 +74,7 @@
 	unsigned ydpi;
 	unsigned format;
 
-	hwc_display_contents_1_t *dclist[HWC_NUM_DISPLAY_TYPES];
+	hwc_display_contents_1_t *dclist[HWC_NUM_PHYSICAL_DISPLAY_TYPES];
 
 	hwc_display_contents_1_t dc;
 	hwc_layer_1_t layer[4];
@@ -200,7 +200,7 @@
 		dc->numHwLayers++;
 	}
 
-	r = hwc->prepare(hwc, HWC_NUM_DISPLAY_TYPES, win->dclist);
+	r = hwc->prepare(hwc, HWC_NUM_PHYSICAL_DISPLAY_TYPES, win->dclist);
 	if (r) {
 		ERROR("hwc->prepare failed r=%d\n",r);
 		return;
@@ -210,7 +210,7 @@
 //		LOG("dl[%d] ctype=0x%08x hints=0x%08x flags=0x%08x\n", i,
 //			dl[i].compositionType, dl[0].hints, dl[0].flags);
 
-	r = hwc->set(hwc, HWC_NUM_DISPLAY_TYPES, win->dclist);
+	r = hwc->set(hwc, HWC_NUM_PHYSICAL_DISPLAY_TYPES, win->dclist);
 	if (r) {
 		ERROR("hwc->set failed, r=%d\n", r);
 		return;