Merge t-qpr-2022-12

Change-Id: I12cde7207f288dfd74cb6881d7a46209a0a009e2
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h
index 95a0b6e..93ef9ae 100644
--- a/include/hardware/bluetooth.h
+++ b/include/hardware/bluetooth.h
@@ -27,7 +27,16 @@
 
 __BEGIN_DECLS
 
+/**	
+* The Bluetooth Hardware Module ID
+*/
+
 #define BLUETOOTH_INTERFACE_STRING "bluetoothInterface"
+#define BT_HARDWARE_MODULE_ID "bluetooth"
+#define BT_STACK_MODULE_ID "bluetooth"
+#define BT_STACK_TEST_MODULE_ID "bluetooth_test"
+#define bluetooth_module_t "bluetooth_test"
+
 
 /** Bluetooth profile interface IDs */
 
@@ -217,7 +226,7 @@
    * Access mode - GET and SET
    * Data type   - uint32_t
    */
-  BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT,
+  BT_PROPERTY_ADAPTER_DISCOVERABLE_TIMEOUT,
 
   /* Properties unique to remote device */
   /**
diff --git a/include/hardware/camera_common.h b/include/hardware/camera_common.h
index 16651a9..75632de 100644
--- a/include/hardware/camera_common.h
+++ b/include/hardware/camera_common.h
@@ -1209,8 +1209,34 @@
      */
     void (*notify_device_state_change)(uint64_t deviceState);
 
+    /**
+     * get_camera_device_version:
+     *
+     * Return the device version for a given camera device. This value may not change for a camera
+     * device. The version returned here must be the same as the one from get_camera_info.
+     *
+     * Return values:
+     *
+     * 0:           On a successful operation
+     *
+     * -ENODEV:     The information cannot be provided due to an internal
+     *              error.
+     *
+     * -EINVAL:     The input arguments are invalid, i.e. the id is invalid,
+     *              and/or the module is invalid.
+     *
+     * Version information (based on camera_module_t.common.module_api_version):
+     *
+     * CAMERA_MODULE_API_VERSION_2_5 or higher:
+     *
+     *   When a camera is disconnected, its camera id becomes invalid. Calling this
+     *   this method with this invalid camera id will get -EINVAL and NULL camera
+     *   static metadata (camera_info.static_camera_characteristics).
+     */
+    int (*get_camera_device_version)(int camera_id, uint32_t *version);
+
     /* reserved for future use */
-    void* reserved[2];
+    void* reserved[1];
 } camera_module_t;
 
 __END_DECLS
diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h
index 3823765..c4d8a44 100644
--- a/include/hardware/hwcomposer_defs.h
+++ b/include/hardware/hwcomposer_defs.h
@@ -299,10 +299,19 @@
 enum {
     HWC_DISPLAY_PRIMARY     = 0,
     HWC_DISPLAY_EXTERNAL    = 1,    // HDMI, DP, etc.
-    HWC_DISPLAY_VIRTUAL     = 2,
 
-    HWC_NUM_PHYSICAL_DISPLAY_TYPES = 2,
-    HWC_NUM_DISPLAY_TYPES          = 3,
+    HWC_DISPLAY_EXTERNAL_2  = 2,
+    HWC_DISPLAY_EXTERNAL_3  = 3,
+    HWC_DISPLAY_EXTERNAL_4  = 4,
+
+    HWC_DISPLAY_BUILTIN_2   = 5,
+    HWC_DISPLAY_BUILTIN_3   = 6,
+    HWC_DISPLAY_BUILTIN_4   = 7,
+
+    HWC_DISPLAY_VIRTUAL     = 8,
+
+    HWC_NUM_PHYSICAL_DISPLAY_TYPES = 8,
+    HWC_NUM_DISPLAY_TYPES          = 9,
 };
 
 enum {
diff --git a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
index efac5e9..85f8001 100644
--- a/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
+++ b/modules/sensors/dynamic_sensor/DynamicSensorManager.cpp
@@ -22,6 +22,7 @@
 
 #include <utils/Log.h>
 #include <utils/SystemClock.h>
+#include <cutils/properties.h>
 
 #include <cassert>
 
@@ -63,6 +64,10 @@
         SENSOR_FLAG_SPECIAL_REPORTING_MODE | SENSOR_FLAG_WAKE_UP,
         { NULL, NULL }
     };
+
+    kSensorOpTimeout = std::chrono::milliseconds(
+            (uint32_t)property_get_int32(
+                "vendor.dynamic_sensor.setup.timeout.ms", 900));
 }
 
 DynamicSensorManager::~DynamicSensorManager() {
diff --git a/modules/sensors/dynamic_sensor/DynamicSensorManager.h b/modules/sensors/dynamic_sensor/DynamicSensorManager.h
index b8a7320..e5ab2b4 100644
--- a/modules/sensors/dynamic_sensor/DynamicSensorManager.h
+++ b/modules/sensors/dynamic_sensor/DynamicSensorManager.h
@@ -127,8 +127,7 @@
 
     // Sensor operation queue. Calls to the sensor HAL must complete within 1
     // second.
-    static constexpr std::chrono::milliseconds
-            kSensorOpTimeout = std::chrono::milliseconds(900);
+    std::chrono::milliseconds kSensorOpTimeout = std::chrono::milliseconds(900);
     std::mutex mSensorOpQueueLock;
     std::queue<std::pair<uint64_t, std::shared_future<int>>> mSensorOpQueue;
     uint64_t mNextSensorOpIndex = 0;
diff --git a/modules/sensors/dynamic_sensor/HidRawSensor.cpp b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
index 3759e7e..c90f4f1 100644
--- a/modules/sensors/dynamic_sensor/HidRawSensor.cpp
+++ b/modules/sensors/dynamic_sensor/HidRawSensor.cpp
@@ -1066,7 +1066,10 @@
 bool HidRawSensor::getSensorEventData(const std::vector<uint8_t> &message,
                                       sensors_event_t *event) {
     for (const auto &rec : mTranslateTable) {
-        int64_t v = (message[rec.byteOffset + rec.byteSize - 1] & 0x80) ? -1 : 0;
+        int64_t v = 0;
+        if (rec.minValue < 0) {
+            v = (message[rec.byteOffset + rec.byteSize - 1] & 0x80) ? -1 : 0;
+        }
         for (int i = static_cast<int>(rec.byteSize) - 1; i >= 0; --i) {
             v = (v << 8) | message[rec.byteOffset + i]; // HID is little endian
         }
diff --git a/modules/sensors/dynamic_sensor/HidRawSensor.h b/modules/sensors/dynamic_sensor/HidRawSensor.h
index 074482a..e4564a0 100644
--- a/modules/sensors/dynamic_sensor/HidRawSensor.h
+++ b/modules/sensors/dynamic_sensor/HidRawSensor.h
@@ -154,9 +154,11 @@
     bool getReportFieldValue(const std::vector<uint8_t> &message,
                              ReportTranslateRecord* rec, ValueType* value) {
         bool valid = true;
-        int64_t v;
+        int64_t v = 0;
+        if (rec->minValue < 0) {
+            v = (message[rec->byteOffset + rec->byteSize - 1] & 0x80) ? -1 : 0;
+        }
 
-        v = (message[rec->byteOffset + rec->byteSize - 1] & 0x80) ? -1 : 0;
         for (int i = static_cast<int>(rec->byteSize) - 1; i >= 0; --i) {
             v = (v << 8) | message[rec->byteOffset + i]; // HID is little endian
         }