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

Commit 058664a3 authored by Ashutosh Joshi's avatar Ashutosh Joshi Committed by Android (Google) Code Review
Browse files

Merge "Fix shim layer bugs for Sensors HIDL wrapper."

parents b4eed611 da270a09
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);
}