Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit da270a09 authored by Ashutosh Joshi's avatar Ashutosh Joshi
Browse files

Fix shim layer bugs for Sensors HIDL wrapper.

i) Increase the number of default threads to 2.
ii) Handle the flush complete event correctly.

Bug: 35189074
Bug: 35067266

Test: Test that sensors work in both binderized and passthrough modes.
      Ensure that camera photosphere works.

Change-Id: Ic8dadf03395b4e96092ae962cf790c93d65a1c8d
parent f008f8fd
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -75,6 +75,10 @@ void convertFromSensorEvent(const sensors_event_t &src, Event *dst) {
        case SensorType::META_DATA:
        {
            dst->u.meta.what = (MetaDataEventType)src.meta_data.what;
            // Legacy HALs contain the handle reference in the meta data field.
            // Copy that over to the handle of the event. In legacy HALs this
            // field was expected to be 0.
            dst->sensorHandle = src.meta_data.sensor;
            break;
        }

@@ -212,8 +216,12 @@ void convertToSensorEvent(const Event &src, sensors_event_t *dst) {
  switch (src.sensorType) {
      case SensorType::META_DATA:
      {
          // Legacy HALs expect the handle reference in the meta data field.
          // Copy it over from the handle of the event.
          dst->meta_data.what = (int32_t)src.u.meta.what;
          dst->meta_data.sensor = dst->sensor;
          dst->meta_data.sensor = src.sensorHandle;
          // Set the sensor handle to 0 to maintain compatibility.
          dst->sensor = 0;
          break;
      }

+5 −1
Original line number Diff line number Diff line
@@ -23,5 +23,9 @@ using android::hardware::sensors::V1_0::ISensors;
using android::hardware::defaultPassthroughServiceImplementation;

int main() {
    return defaultPassthroughServiceImplementation<ISensors>();
    /* Sensors framework service needs at least two threads.
     * One thread blocks on a "poll"
     * The second thread is needed for all other HAL methods.
     */
    return defaultPassthroughServiceImplementation<ISensors>(2);
}