Merge "Replace integer constants with strings in Activity Recognition HAL."
diff --git a/include/hardware/audio.h b/include/hardware/audio.h
index d0648b7..6558dda 100644
--- a/include/hardware/audio.h
+++ b/include/hardware/audio.h
@@ -97,6 +97,9 @@
 /* A2DP sink address set by framework */
 #define AUDIO_PARAMETER_A2DP_SINK_ADDRESS "a2dp_sink_address"
 
+/* A2DP source address set by framework */
+#define AUDIO_PARAMETER_A2DP_SOURCE_ADDRESS "a2dp_source_address"
+
 /* Screen state */
 #define AUDIO_PARAMETER_KEY_SCREEN_STATE "screen_state"
 
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 5e100ec..c00a8f7 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -324,10 +324,6 @@
 /** TODO: Add callbacks for Link Up/Down and other generic
   *  notifications/callbacks */
 
-/** Wakelock callback */
-/* Called to take/release wakelock to allow timers to work (temporary kluge) */
-typedef void (*bt_wakelock_callback)(int acquire);
-
 /** Bluetooth DM callback structure. */
 typedef struct {
     /** set to sizeof(bt_callbacks_t) */
@@ -344,7 +340,6 @@
     callback_thread_event thread_evt_cb;
     dut_mode_recv_callback dut_mode_recv_cb;
     le_test_mode_callback le_test_mode_cb;
-    bt_wakelock_callback bt_wakelock_cb;
 } bt_callbacks_t;
 
 /** NOTE: By default, no profiles are initialized at the time of init/enable.
diff --git a/include/hardware/camera3.h b/include/hardware/camera3.h
index b326e92..07d19a6 100644
--- a/include/hardware/camera3.h
+++ b/include/hardware/camera3.h
@@ -279,30 +279,26 @@
  *   for processing rate).
  *
  * - Limited-mode devices do not need to support most of the
- *   settings/result/static info metadata. Full-mode devices must support all
- *   metadata fields listed in TODO. Specifically, only the following settings
+ *   settings/result/static info metadata. Specifically, only the following settings
  *   are expected to be consumed or produced by a limited-mode HAL device:
  *
- *   android.control.aeAntibandingMode (controls)
- *   android.control.aeExposureCompensation (controls)
- *   android.control.aeLock (controls)
- *   android.control.aeMode (controls)
- *       [OFF means ON_FLASH_TORCH - TODO]
- *   android.control.aeRegions (controls)
- *   android.control.aeTargetFpsRange (controls)
- *   android.control.afMode (controls)
- *       [OFF means infinity focus]
- *   android.control.afRegions (controls)
- *   android.control.awbLock (controls)
- *   android.control.awbMode (controls)
- *       [OFF not supported]
- *   android.control.awbRegions (controls)
- *   android.control.captureIntent (controls)
- *   android.control.effectMode (controls)
- *   android.control.mode (controls)
- *       [OFF not supported]
- *   android.control.sceneMode (controls)
- *   android.control.videoStabilizationMode (controls)
+ *   android.control.aeAntibandingMode (controls and dynamic)
+ *   android.control.aeExposureCompensation (controls and dynamic)
+ *   android.control.aeLock (controls and dynamic)
+ *   android.control.aeMode (controls and dynamic)
+ *   android.control.aeRegions (controls and dynamic)
+ *   android.control.aeTargetFpsRange (controls and dynamic)
+ *   android.control.aePrecaptureTrigger (controls and dynamic)
+ *   android.control.afMode (controls and dynamic)
+ *   android.control.afRegions (controls and dynamic)
+ *   android.control.awbLock (controls and dynamic)
+ *   android.control.awbMode (controls and dynamic)
+ *   android.control.awbRegions (controls and dynamic)
+ *   android.control.captureIntent (controls and dynamic)
+ *   android.control.effectMode (controls and dynamic)
+ *   android.control.mode (controls and dynamic)
+ *   android.control.sceneMode (controls and dynamic)
+ *   android.control.videoStabilizationMode (controls and dynamic)
  *   android.control.aeAvailableAntibandingModes (static)
  *   android.control.aeAvailableModes (static)
  *   android.control.aeAvailableTargetFpsRanges (static)
@@ -315,64 +311,50 @@
  *   android.control.awbAvailableModes (static)
  *   android.control.maxRegions (static)
  *   android.control.sceneModeOverrides (static)
- *   android.control.aeRegions (dynamic)
  *   android.control.aeState (dynamic)
- *   android.control.afMode (dynamic)
- *   android.control.afRegions (dynamic)
  *   android.control.afState (dynamic)
- *   android.control.awbMode (dynamic)
- *   android.control.awbRegions (dynamic)
  *   android.control.awbState (dynamic)
- *   android.control.mode (dynamic)
  *
+ *   android.flash.mode (controls and dynamic)
  *   android.flash.info.available (static)
  *
  *   android.info.supportedHardwareLevel (static)
  *
- *   android.jpeg.gpsCoordinates (controls)
- *   android.jpeg.gpsProcessingMethod (controls)
- *   android.jpeg.gpsTimestamp (controls)
- *   android.jpeg.orientation (controls)
- *   android.jpeg.quality (controls)
- *   android.jpeg.thumbnailQuality (controls)
- *   android.jpeg.thumbnailSize (controls)
+ *   android.jpeg.gpsCoordinates (controls and dynamic)
+ *   android.jpeg.gpsProcessingMethod (controls and dynamic)
+ *   android.jpeg.gpsTimestamp (controls and dynamic)
+ *   android.jpeg.orientation (controls and dynamic)
+ *   android.jpeg.quality (controls and dynamic)
+ *   android.jpeg.thumbnailQuality (controls and dynamic)
+ *   android.jpeg.thumbnailSize (controls and dynamic)
  *   android.jpeg.availableThumbnailSizes (static)
  *   android.jpeg.maxSize (static)
- *   android.jpeg.gpsCoordinates (dynamic)
- *   android.jpeg.gpsProcessingMethod (dynamic)
- *   android.jpeg.gpsTimestamp (dynamic)
- *   android.jpeg.orientation (dynamic)
- *   android.jpeg.quality (dynamic)
- *   android.jpeg.size (dynamic)
- *   android.jpeg.thumbnailQuality (dynamic)
- *   android.jpeg.thumbnailSize (dynamic)
  *
  *   android.lens.info.minimumFocusDistance (static)
  *
- *   android.request.id (controls)
- *   android.request.id (dynamic)
+ *   android.request.id (controls and dynamic)
  *
- *   android.scaler.cropRegion (controls)
- *       [ignores (x,y), assumes center-zoom]
+ *   android.scaler.cropRegion (controls and dynamic)
  *   android.scaler.availableStreamConfigurations (static)
  *   android.scaler.availableMinFrameDurations (static)
  *   android.scaler.availableStallDurations (static)
  *   android.scaler.availableMaxDigitalZoom (static)
- *       [full resolution not supported]
  *   android.scaler.maxDigitalZoom (static)
- *   android.scaler.cropRegion (dynamic)
+ *   android.scaler.croppingType (static)
  *
  *   android.sensor.orientation (static)
  *   android.sensor.timestamp (dynamic)
  *
- *   android.statistics.faceDetectMode (controls)
+ *   android.statistics.faceDetectMode (controls and dynamic)
  *   android.statistics.info.availableFaceDetectModes (static)
- *   android.statistics.faceDetectMode (dynamic)
  *   android.statistics.faceIds (dynamic)
  *   android.statistics.faceLandmarks (dynamic)
  *   android.statistics.faceRectangles (dynamic)
  *   android.statistics.faceScores (dynamic)
  *
+ *   android.sync.frameNumber (dynamic)
+ *   android.sync.maxLatency (static)
+ *
  * - Captures in limited mode that include high-resolution (> 1080p) output
  *   buffers may block in process_capture_request() until all the output buffers
  *   have been filled. A full-mode HAL device must process sequences of
@@ -383,6 +365,14 @@
  *   that request completes for high-resolution captures for limited-mode
  *   devices.
  *
+ * - Full-mode devices must support below additional capabilities:
+ *   - 30fps at maximum resolution is preferred, more than 20fps is required.
+ *   - Per frame control (android.sync.maxLatency == PER_FRAME_CONTROL).
+ *   - Sensor manual control metadata. See MANUAL_SENSOR defined in
+ *     android.request.availableCapabilities.
+ *   - Post-processing manual control metadata. See MANUAL_POST_PROCESSING defined
+ *     in android.request.availableCapabilities.
+ *
  */
 
 /**
diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h
index 9327c41..91aa111 100644
--- a/include/hardware/sensors.h
+++ b/include/hardware/sensors.h
@@ -416,10 +416,17 @@
  * trigger-mode: on-change
  * wake-up sensor: no
  *
- *  A sensor of this type returns the current heart rate if activated.
- *  The value is returned as a float which represents the heart rate in beats
- *  per minute (BPM).
- *  When the sensor cannot measure the heart rate, the returned value must be 0.
+ *  A sensor of this type returns the current heart rate.
+ *  The events contain the current heart rate in beats per minute (BPM) and the
+ *  status of the sensor during the measurement. See heart_rate_event_t for more
+ *  details.
+ *
+ *  Because this sensor is on-change, events must be generated when and only
+ *  when heart_rate.bpm or heart_rate.status have changed since the last
+ *  event. The event should be generated no faster than every period_ns passed
+ *  to setDelay() or to batch(). See the definition of the on-change trigger
+ *  mode for more information.
+ *
  *  sensor_t.requiredPermission must be set to SENSOR_PERMISSION_BODY_SENSORS.
  */
 #define SENSOR_TYPE_HEART_RATE                      (21)
@@ -514,11 +521,12 @@
  *
  * A sensor of this type generates an event each time a tilt event is detected. A tilt event
  * should be generated if the direction of the 2-seconds window average gravity changed by at least
- * 35 degrees since the activation of the sensor.
- *     initial_estimated_gravity = average of accelerometer measurements over the first
- *                                 1 second after activation.
+ * 35 degrees since the activation or the last trigger of the sensor.
+ *     reference_estimated_gravity = average of accelerometer measurements over the first
+ *                                 1 second after activation or the estimated gravity at the last
+ *                                 trigger.
  *     current_estimated_gravity = average of accelerometer measurements over the last 2 seconds.
- *     trigger when angle (initial_estimated_gravity, current_estimated_gravity) > 35 degrees
+ *     trigger when angle (reference_estimated_gravity, current_estimated_gravity) > 35 degrees
  *
  * Large accelerations without a change in phone orientation should not trigger a tilt event.
  * For example, a sharp turn or strong acceleration while driving a car should not trigger a tilt
@@ -567,17 +575,15 @@
 /** Minimum magnetic field on Earth's surface */
 #define MAGNETIC_FIELD_EARTH_MIN    (30.0f)
 
-
 /**
- * status of orientation sensor
+ * Possible values of the status field of sensor events.
  */
-
+#define SENSOR_STATUS_NO_CONTACT        -1
 #define SENSOR_STATUS_UNRELIABLE        0
 #define SENSOR_STATUS_ACCURACY_LOW      1
 #define SENSOR_STATUS_ACCURACY_MEDIUM   2
 #define SENSOR_STATUS_ACCURACY_HIGH     3
 
-
 /**
  * sensor event data
  */
@@ -627,6 +633,17 @@
 } meta_data_event_t;
 
 /**
+ * Heart rate event data
+ */
+typedef struct {
+  // Heart rate in beats per minute.
+  // Set to 0 when status is SENSOR_STATUS_UNRELIABLE or ..._NO_CONTACT
+  float bpm;
+  // Status of the sensor for this reading. Set to one SENSOR_STATUS_...
+  int8_t status;
+} heart_rate_event_t;
+
+/**
  * Union of the various types of sensor data
  * that can be returned.
  */
@@ -683,8 +700,8 @@
             /* uncalibrated magnetometer values are in micro-Teslas */
             uncalibrated_event_t uncalibrated_magnetic;
 
-            /* heart rate in bpm */
-            float           heart_rate;
+            /* heart rate data containing value in bpm and status */
+            heart_rate_event_t heart_rate;
 
             /* this is a special event. see SENSOR_TYPE_META_DATA above.
              * sensors_meta_data_event_t events are all reported with a type of
diff --git a/include/hardware/tv_input.h b/include/hardware/tv_input.h
index f2d03f1..75aafce 100644
--- a/include/hardware/tv_input.h
+++ b/include/hardware/tv_input.h
@@ -22,6 +22,7 @@
 #include <sys/types.h>
 
 #include <hardware/hardware.h>
+#include <system/audio.h>
 #include <system/window.h>
 
 __BEGIN_DECLS
@@ -86,7 +87,13 @@
 
     /* TODO: Add capability if necessary. */
 
-    /* TODO: Audio info */
+    /*
+     * Audio info
+     *
+     * audio_type == AUDIO_DEVICE_NONE if this input has no audio.
+     */
+    audio_devices_t audio_type;
+    char audio_address[AUDIO_DEVICE_MAX_ADDRESS_LEN];
 } tv_input_device_info_t;
 
 typedef enum {
diff --git a/tests/camera2/Android.mk b/tests/camera2/Android.mk
index 9efac0f..577ba0a 100644
--- a/tests/camera2/Android.mk
+++ b/tests/camera2/Android.mk
@@ -45,6 +45,9 @@
 LOCAL_CFLAGS += -Wall -Wextra
 
 LOCAL_MODULE:= camera2_test
+LOCAL_MODULE_STEM_32 := camera2_test
+LOCAL_MODULE_STEM_64 := camera2_test64
+LOCAL_MULTILIB := both
 LOCAL_MODULE_TAGS := tests
 
 include $(BUILD_NATIVE_TEST)