Commit 8a476f88 authored by Adam Lawson's avatar Adam Lawson Committed by Blaster4385
Browse files

nicky: sensors: Update from android-13.0.0_r3

parent a7d34f42
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -46,5 +46,6 @@ cc_binary {
    ],
    static_libs: [
        "android.hardware.sensors@1.0-convert",
        "android.hardware.sensors@2.X-multihal",
    ],
}
+21 −8
Original line number Diff line number Diff line
@@ -124,8 +124,10 @@ Return<void> HalProxy::getSensorsList_2_1(ISensorsV2_1::getSensorsList_2_1_cb _h
Return<void> HalProxy::getSensorsList(ISensorsV2_0::getSensorsList_cb _hidl_cb) {
    std::vector<V1_0::SensorInfo> sensors;
    for (const auto& iter : mSensors) {
      if (iter.second.type != SensorType::HINGE_ANGLE) {
        sensors.push_back(convertToOldSensorInfo(iter.second));
      }
    }
    _hidl_cb(sensors);
    return Void();
}
@@ -174,7 +176,13 @@ Return<Result> HalProxy::initialize_2_1(
    std::unique_ptr<EventMessageQueueWrapperBase> queue =
            std::make_unique<EventMessageQueueWrapperV2_1>(eventQueue);

    return initializeCommon(queue, wakeLockDescriptor, dynamicCallback);
    // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions.
    auto hidlWakeLockQueue =
            std::make_unique<WakeLockMessageQueue>(wakeLockDescriptor, true /* resetPointers */);
    std::unique_ptr<WakeLockMessageQueueWrapperBase> wakeLockQueue =
            std::make_unique<WakeLockMessageQueueWrapperHidl>(hidlWakeLockQueue);

    return initializeCommon(queue, wakeLockQueue, dynamicCallback);
}

Return<Result> HalProxy::initialize(
@@ -190,12 +198,18 @@ Return<Result> HalProxy::initialize(
    std::unique_ptr<EventMessageQueueWrapperBase> queue =
            std::make_unique<EventMessageQueueWrapperV1_0>(eventQueue);

    return initializeCommon(queue, wakeLockDescriptor, dynamicCallback);
    // Create the Wake Lock FMQ from the wakeLockDescriptor. Reset the read/write positions.
    auto hidlWakeLockQueue =
            std::make_unique<WakeLockMessageQueue>(wakeLockDescriptor, true /* resetPointers */);
    std::unique_ptr<WakeLockMessageQueueWrapperBase> wakeLockQueue =
            std::make_unique<WakeLockMessageQueueWrapperHidl>(hidlWakeLockQueue);

    return initializeCommon(queue, wakeLockQueue, dynamicCallback);
}

Return<Result> HalProxy::initializeCommon(
        std::unique_ptr<EventMessageQueueWrapperBase>& eventQueue,
        const ::android::hardware::MQDescriptorSync<uint32_t>& wakeLockDescriptor,
        std::unique_ptr<WakeLockMessageQueueWrapperBase>& wakeLockQueue,
        const sp<ISensorsCallbackWrapperBase>& sensorsCallback) {
    Result result = Result::OK;

@@ -220,8 +234,7 @@ Return<Result> HalProxy::initializeCommon(

    // Create the Wake Lock FMQ that is used by the framework to communicate whenever WAKE_UP
    // events have been successfully read and handled by the framework.
    mWakeLockQueue =
            std::make_unique<WakeLockMessageQueue>(wakeLockDescriptor, true /* resetPointers */);
    mWakeLockQueue = std::move(wakeLockQueue);

    if (mEventQueueFlag != nullptr) {
        EventFlag::deleteEventFlag(&mEventQueueFlag);
@@ -248,8 +261,8 @@ Return<Result> HalProxy::initializeCommon(
        Result currRes = mSubHalList[i]->initialize(this, this, i);
        if (currRes != Result::OK) {
            result = currRes;
            ALOGE("Subhal '%s' failed to initialize.", mSubHalList[i]->getName().c_str());
            break;
            ALOGE("Subhal '%s' failed to initialize with reason %" PRId32 ".",
                  mSubHalList[i]->getName().c_str(), static_cast<int32_t>(currRes));
        }
    }

@@ -341,7 +354,7 @@ Return<void> HalProxy::debug(const hidl_handle& fd, const hidl_vec<hidl_string>&
        return Void();
    }

    android::base::borrowed_fd writeFd = dup(fd->data[0]);
    int writeFd = fd->data[0];

    std::ostringstream stream;
    stream << "===HalProxy===" << std::endl;
+4 −0
Original line number Diff line number Diff line
@@ -68,6 +68,10 @@ std::vector<V2_1::Event> HalProxyCallbackBase::processEvents(const std::vector<V
    std::vector<V2_1::Event> eventsOut;
    for (V2_1::Event event : events) {
        event.sensorHandle = setSubHalIndex(event.sensorHandle, mSubHalIndex);
        if (event.sensorType == V2_1::SensorType::DYNAMIC_SENSOR_META) {
            event.u.dynamic.sensorHandle =
                    setSubHalIndex(event.u.dynamic.sensorHandle, mSubHalIndex);
        }
        eventsOut.push_back(event);
        const V2_1::SensorInfo& sensor = mCallback->getSensorInfo(event.sensorHandle);
        if ((sensor.flags & V1_0::SensorFlagBits::WAKE_UP) != 0) {
+1 −1
Original line number Diff line number Diff line
@@ -2,6 +2,6 @@ service vendor.sensors-hal-2-0-multihal /vendor/bin/hw/android.hardware.sensors@
    class hal
    user system
    group system wakelock context_hub input
    writepid /dev/cpuset/system-background/tasks
    task_profiles ServiceCapacityLow
    capabilities BLOCK_SUSPEND
    rlimit rtprio 10 10