mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Merge "Revert "sensors: adding a common convert lib"" am: df0bf96001 am: 11b7a8c73f
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2321957 Change-Id: I67d1d530e817339587c20081d1f1249a22a45b31 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
committed by
Automerger Merge Worker
commit
73e349fb15
@@ -44,12 +44,6 @@ cc_library_static {
|
|||||||
"libhidlbase",
|
"libhidlbase",
|
||||||
"android.hardware.sensors@1.0",
|
"android.hardware.sensors@1.0",
|
||||||
],
|
],
|
||||||
whole_static_libs: [
|
|
||||||
"sensors_common_convert",
|
|
||||||
],
|
|
||||||
export_static_lib_headers: [
|
|
||||||
"sensors_common_convert",
|
|
||||||
],
|
|
||||||
local_include_dirs: ["include/sensors"],
|
local_include_dirs: ["include/sensors"],
|
||||||
export_shared_lib_headers: [
|
export_shared_lib_headers: [
|
||||||
"libhardware",
|
"libhardware",
|
||||||
|
|||||||
@@ -196,11 +196,6 @@ void convertFromSensorEvent(const sensors_event_t &src, Event *dst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertFromASensorEvent(const ASensorEvent& src, Event* dst) {
|
|
||||||
convertFromSensorEvent(
|
|
||||||
android::hardware::sensors::implementation::common::convertASensorEvent(src), dst);
|
|
||||||
}
|
|
||||||
|
|
||||||
void convertToSensorEvent(const Event &src, sensors_event_t *dst) {
|
void convertToSensorEvent(const Event &src, sensors_event_t *dst) {
|
||||||
*dst = {.version = sizeof(sensors_event_t),
|
*dst = {.version = sizeof(sensors_event_t),
|
||||||
.sensor = src.sensorHandle,
|
.sensor = src.sensorHandle,
|
||||||
|
|||||||
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include <android/hardware/sensors/1.0/ISensors.h>
|
#include <android/hardware/sensors/1.0/ISensors.h>
|
||||||
#include <hardware/sensors.h>
|
#include <hardware/sensors.h>
|
||||||
#include <sensors/common_convert.h>
|
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
@@ -32,7 +31,6 @@ void convertFromSensor(const sensor_t &src, SensorInfo *dst);
|
|||||||
void convertToSensor(const SensorInfo &src, sensor_t *dst);
|
void convertToSensor(const SensorInfo &src, sensor_t *dst);
|
||||||
|
|
||||||
void convertFromSensorEvent(const sensors_event_t &src, Event *dst);
|
void convertFromSensorEvent(const sensors_event_t &src, Event *dst);
|
||||||
void convertFromASensorEvent(const ASensorEvent& src, Event* dst);
|
|
||||||
void convertToSensorEvent(const Event &src, sensors_event_t *dst);
|
void convertToSensorEvent(const Event &src, sensors_event_t *dst);
|
||||||
|
|
||||||
bool convertFromSharedMemInfo(const SharedMemInfo& memIn, sensors_direct_mem_t *memOut);
|
bool convertFromSharedMemInfo(const SharedMemInfo& memIn, sensors_direct_mem_t *memOut);
|
||||||
|
|||||||
@@ -37,12 +37,6 @@ cc_library_static {
|
|||||||
"libutils",
|
"libutils",
|
||||||
"android.hardware.sensors-V1-ndk",
|
"android.hardware.sensors-V1-ndk",
|
||||||
],
|
],
|
||||||
whole_static_libs: [
|
|
||||||
"sensors_common_convert",
|
|
||||||
],
|
|
||||||
export_static_lib_headers: [
|
|
||||||
"sensors_common_convert",
|
|
||||||
],
|
|
||||||
local_include_dirs: ["include/aidl/sensors"],
|
local_include_dirs: ["include/aidl/sensors"],
|
||||||
export_shared_lib_headers: [
|
export_shared_lib_headers: [
|
||||||
"libhardware",
|
"libhardware",
|
||||||
|
|||||||
@@ -490,10 +490,6 @@ void convertFromSensorEvent(const sensors_event_t& src, Event* dst) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertFromASensorEvent(const ASensorEvent& src, Event* dst) {
|
|
||||||
convertFromSensorEvent(common::convertASensorEvent(src), dst);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
} // namespace sensors
|
} // namespace sensors
|
||||||
} // namespace hardware
|
} // namespace hardware
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
|
|
||||||
#include <aidl/android/hardware/sensors/ISensors.h>
|
#include <aidl/android/hardware/sensors/ISensors.h>
|
||||||
#include <hardware/sensors.h>
|
#include <hardware/sensors.h>
|
||||||
#include <sensors/common_convert.h>
|
|
||||||
|
|
||||||
namespace android {
|
namespace android {
|
||||||
namespace hardware {
|
namespace hardware {
|
||||||
@@ -30,7 +29,6 @@ void convertToSensor(const aidl::android::hardware::sensors::SensorInfo& src, se
|
|||||||
void convertToSensorEvent(const aidl::android::hardware::sensors::Event& src, sensors_event_t* dst);
|
void convertToSensorEvent(const aidl::android::hardware::sensors::Event& src, sensors_event_t* dst);
|
||||||
void convertFromSensorEvent(const sensors_event_t& src,
|
void convertFromSensorEvent(const sensors_event_t& src,
|
||||||
aidl::android::hardware::sensors::Event* dst);
|
aidl::android::hardware::sensors::Event* dst);
|
||||||
void convertFromASensorEvent(const ASensorEvent& src, aidl::android::hardware::sensors::Event* dst);
|
|
||||||
|
|
||||||
} // namespace implementation
|
} // namespace implementation
|
||||||
} // namespace sensors
|
} // namespace sensors
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
// Copyright (C) 2022 The Android Open Source Project
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
//
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
|
|
||||||
package {
|
|
||||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "sensors_common_convert",
|
|
||||||
srcs: [
|
|
||||||
"convert.cpp",
|
|
||||||
],
|
|
||||||
vendor_available: true,
|
|
||||||
host_supported: true,
|
|
||||||
local_include_dirs: ["include"],
|
|
||||||
cflags: [
|
|
||||||
"-Wall",
|
|
||||||
"-Werror",
|
|
||||||
],
|
|
||||||
shared_libs: [
|
|
||||||
"libhardware",
|
|
||||||
],
|
|
||||||
header_libs: [
|
|
||||||
"libandroid_sensor_headers",
|
|
||||||
],
|
|
||||||
|
|
||||||
export_include_dirs: ["include"],
|
|
||||||
export_header_lib_headers: [
|
|
||||||
"libandroid_sensor_headers",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sensors/common_convert.h>
|
|
||||||
#include <cstring>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace sensors {
|
|
||||||
namespace implementation {
|
|
||||||
namespace common {
|
|
||||||
|
|
||||||
sensors_event_t convertASensorEvent(const ASensorEvent& src) {
|
|
||||||
// Attempt to ensure these types are compatible.
|
|
||||||
static_assert(sizeof(sensors_event_t) == sizeof(ASensorEvent));
|
|
||||||
static_assert(offsetof(sensors_event_t, timestamp) == offsetof(ASensorEvent, timestamp));
|
|
||||||
static_assert(offsetof(sensors_event_t, flags) == offsetof(ASensorEvent, flags));
|
|
||||||
|
|
||||||
// TODO(b/259711109) Follow up work to handle this in a safer way.
|
|
||||||
return *reinterpret_cast<const sensors_event_t*>(&src);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace common
|
|
||||||
} // namespace implementation
|
|
||||||
} // namespace sensors
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2022 The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <android/sensor.h>
|
|
||||||
#include <hardware/sensors.h>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace sensors {
|
|
||||||
namespace implementation {
|
|
||||||
namespace common {
|
|
||||||
|
|
||||||
sensors_event_t convertASensorEvent(const ASensorEvent& aEvent);
|
|
||||||
|
|
||||||
} // namespace common
|
|
||||||
} // namespace implementation
|
|
||||||
} // namespace sensors
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
||||||
Reference in New Issue
Block a user