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

Commit 5f810327 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Sensors: MultiHal: Add HIDL-based Multi-Hal"

parents cd6300e9 d133e4c3
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -8,7 +8,6 @@ cc_library_shared {
        "libhardware",
        "libhwbinder",
        "libbase",
        "libcutils",
        "libutils",
        "libhidlbase",
        "libhidltransport",
@@ -16,6 +15,7 @@ cc_library_shared {
    ],
    static_libs: [
        "android.hardware.sensors@1.0-convert",
        "multihal",
    ],
    local_include_dirs: ["include/sensors"],
}
@@ -30,7 +30,6 @@ cc_library_static {
        "libhardware",
        "libhwbinder",
        "libbase",
        "libcutils",
        "libutils",
        "libhidlbase",
        "libhidltransport",
+19 −3
Original line number Diff line number Diff line
@@ -15,17 +15,29 @@
 */

#include "Sensors.h"

#include "convert.h"
#include "multihal.h"

#include <android-base/logging.h>

#include <sys/stat.h>

namespace android {
namespace hardware {
namespace sensors {
namespace V1_0 {
namespace implementation {

/*
 * If a multi-hal configuration file exists in the proper location,
 * return true indicating we need to use multi-hal functionality.
 */
static bool UseMultiHal() {
    const std::string& name = MULTI_HAL_CONFIG_FILE_PATH;
    struct stat buffer;
    return (stat (name.c_str(), &buffer) == 0);
}

static Result ResultFromStatus(status_t err) {
    switch (err) {
        case OK:
@@ -43,10 +55,14 @@ Sensors::Sensors()
    : mInitCheck(NO_INIT),
      mSensorModule(nullptr),
      mSensorDevice(nullptr) {
    status_t err = hw_get_module(
    status_t err = OK;
    if (UseMultiHal()) {
        mSensorModule = ::get_multi_hal_module_info();
    } else {
        err = hw_get_module(
            SENSORS_HARDWARE_MODULE_ID,
            (hw_module_t const **)&mSensorModule);

    }
    if (mSensorModule == NULL) {
        err = UNKNOWN_ERROR;
    }
+12 −12

File changed.

Contains only whitespace changes.