Commit graph

120 commits

Author SHA1 Message Date
Treehugger Robot
60b7e3a576 Merge "Revert "Revert "Increase HidRawSensor thread priority to reduce latency""" into main am: 095c6960f8
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2755006

Change-Id: Ibdee07646502b1b4f494486d23bab55d1b567894
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-18 22:21:39 +00:00
Arthur Ishiguro
80b8e87c96 Revert "Revert "Increase HidRawSensor thread priority to reduce latency""
This reverts commit 371bc82855.

Reason for revert: CL not determined to be culprit of b/300512496 

Change-Id: Idf0a692a8dec80f684e47e0be24cb158c10030fc
2023-09-18 17:42:07 +00:00
Treehugger Robot
a081c2ffd0 Merge "Revert "Increase HidRawSensor thread priority to reduce latency"" into main am: 0d62798e8e
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2753014

Change-Id: I8a2ff0f6b3ebe5aad3040ab4c5b203c87cb27b7c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-15 02:07:08 +00:00
Arthur Ishiguro
371bc82855 Revert "Increase HidRawSensor thread priority to reduce latency"
This reverts commit ae23e94424.

Reason for revert: Possible culprit of b/300512496

Change-Id: Ia99167aa9c979e8afa69ce64f27d535c9228e414
2023-09-14 23:31:27 +00:00
Treehugger Robot
da2289a9f0 Merge "Increase HidRawSensor thread priority to reduce latency" into main am: d88f8e4c58
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2749180

Change-Id: I387dfe7c5ece6cb20ce8ab1f8982186e8d90813d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-09-13 18:00:14 +00:00
Arthur Ishiguro
ae23e94424 Increase HidRawSensor thread priority to reduce latency
Bug: 296157591
Test: Compile
Change-Id: Ia7eff3aa45b291d150b1c1e0f6a19d41644fd11f
2023-09-12 23:08:10 +00:00
Andy Hung
7c92b64318 Merge "HidRawDeviceTest: Enable for device build" am: 698fe8448b am: f4871891b2 am: 6766ca4760
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2404797

Change-Id: I02d826405a4d2aa2d36d8bff8720d7639f3a8fed
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-06 22:19:37 +00:00
Andy Hung
f4871891b2 Merge "HidRawDeviceTest: Enable for device build" am: 698fe8448b
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2404797

Change-Id: Ie2968a66d2f4961ffd8462874710f7eb37dd99ee
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2023-02-06 21:01:17 +00:00
Andy Hung
b264eb4bd3 HidRawDeviceTest: Enable for device build
Test: $ adb shell hidrawdevice_test /dev/hidraw0
Bug: 265754293
Change-Id: I103ebc030f012d11e977fc155fc68f884f71f518
2023-01-27 11:42:20 -08:00
Christopher Ferris
0fcfbf598b Merge "Modify a data structure into a union." am: 8e965d90de am: 9d6b418d6f am: de12b9273e
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2243423

Change-Id: I3cd75bcd78d3aa6855eb570f801c61cbca94eb10
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-03 03:02:05 +00:00
Christopher Ferris
de12b9273e Merge "Modify a data structure into a union." am: 8e965d90de am: 9d6b418d6f
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2243423

Change-Id: Id3bbeac041d086619e7313286e144ea2b7c1a931
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-03 02:30:27 +00:00
Brian Duddie
13456086a0 Increase dynamic sensor op timeout to 1.6 sec am: 9a056455f2 am: 2e6815d22a
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/20333186

Change-Id: I017181a60300d7673c2d1926080ef6e18b25d0f4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-02 10:33:09 +00:00
Brian Duddie
2e6815d22a Increase dynamic sensor op timeout to 1.6 sec am: 9a056455f2
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/20333186

Change-Id: Ie65bd144da9d4fc20fc3ea799dc148419fda0484
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-02 10:02:52 +00:00
Brian Duddie
9a056455f2 Increase dynamic sensor op timeout to 1.6 sec
Minimizes intermittent failures when a device is in sniff mode.

Fixes: 245881714
Test: enable/disable with spatial audio feature enabled
Change-Id: I5fb5b9ff37a6f8a245678c87ee82e2032dc845f2
2022-10-31 23:15:15 +00:00
Christopher Ferris
8b0619b47d Modify a data structure into a union.
The new 6.0 kernel headers changed all variable length
structures from [0] to []. This causes a clang warning to
trigger, so rewrite the affected data structure using a
union to avoid having a variable sized array in the middle
of the structure.

Test: Builds.
Change-Id: I60c6d31a93566c4aa9f7501f39f88543ee76ce91
2022-10-13 12:39:44 -07:00
Treehugger Robot
90a7896e53 Merge "[dynamic_sensor] correctly interpret HID data" am: dcbe8650b6 am: 69f047a046 am: 28bb4526f9 am: 9a2c8265c6 am: 97675c486a
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/2213197

Change-Id: If277186697ce25af5b1e23a802baee6efc28993a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-09-09 22:31:25 +00:00
Manish Kushwaha
d4085b7193 [dynamic_sensor] correctly interpret HID data
specifically, interpret HID data value as unsigned if minValue is
positive

Fix: 238391386
Test: See "Testing Done" in comments in ag/19889364
Change-Id: I715c2189ad90ee71e022ae131354354157694556
2022-09-09 16:50:00 +00:00
Brian Duddie
7aad531bc9 dynamic_sensor: Improve error logging
Correctly pass errno to strerror() rather than the return value, which
will always be -1 on error.

Fixes: 245585769
Test: build only
Change-Id: Iae1170949f3b2a0286ef8b9ddf26c74a6cee6783
2022-09-07 19:46:32 +00:00
Brian Duddie
f4def6edb5 Clarify and clean up dynamic_sensor documentation
Test: n/a
Change-Id: I0b0226b1fce940bd37b8d8a1f72123948ff1fe0a
2022-08-24 23:21:45 +00:00
Erik Staats
3493565708 Add /dev permissions to dynamic sensor README.md .
Bug: 228879057
Test: Verified in gitiles.
Change-Id: If82a5bf302cb68a2c5b486006e4679fbfc8ee545
2022-04-20 11:16:52 -07:00
Erik Staats
fdb42f78cd dynamic_sensor: Fix HID min/max sample rate computation.
Bug: 228369656
Test: Used uhid-sample to add a dynamic sensor and verified correct
 min/max sample rate.
Change-Id: I88a1bec26a03a97ee7a3c590d2601151b89ee545
2022-04-06 15:30:02 -07:00
Erik Staats
9b8bc0f7c1 dynamic_sensor: Support timing out sensor operations.
Bug: 226012902
Test: Used uhid-sample to add a dynamic sensor and verified it can be
 sampled.
Test: Simulated start sampling ioctl timeout and verified operation
 completes with a timeout and eventually cleans up.
Test: Simulated start sampling ioctl timeout with device removal before
 completion and verified operation completes with a timeout and
 eventually cleans up.
Change-Id: I9a957bc1e4000b2c587278146ecbe6e903010616
2022-04-06 12:42:06 +00:00
Brian Duddie
b9769d799c Change dynamic sensors handle base to 1
Fixes: 227766975
Test: load on device, confirm handle number changed
Change-Id: I0466784d7e468bd785f2525f1ab7cd02cc5436e8
2022-04-01 17:22:31 +00:00
Erik Staats
cbcdc02ef4 dynamic_sensor: Support Android head tracker sensor type.
Bug: 189507742
Test: Verified head tracker sensor type and sampling.
Test: Verified custom Android sensor sampling.
Change-Id: Id403de916111ed737b9cebebe9850d5e5845cf56
2022-01-27 20:10:57 +00:00
Zhaoming Yin
c76c1d5799 Fix opendir NULL dirp return issue
Bug: 206035991
Test: use forrest to run boottest

Change-Id: I9e77b7d6184a0ee132b8f058f7f83302c54bcb4a
2022-01-16 08:13:00 -08:00
Erik Staats
8262a62fb2 dynamic_sensor: Use HID unique ID for head tracker UUID.
Also, don't require 16-bit strings for HID name, manufacturer, and
unique ID. Also change dump of HID unique ID to be in hex.

Bug: 213483369
Test: Verified that the standard Android head tracker sensor uses the
 HID unique ID for the sensor UUID.
Test: Verified that custom Android sensors use a fabricated UUID.
Change-Id: I125f84187868543dccab758e22dce744c013578e
2022-01-06 12:28:06 -08:00
Erik Staats
75fb5d739e Add dynamic sensor README.md.
Bug: 207008609
Test: Verified in gitiles.
Change-Id: I7bb8575aef0a8764390a6dc8f4ca785f49a1eb61
2021-12-16 20:09:59 +00:00
Erik Staats
4b4cb8dab3 dynamic_sensor: Fix report item offset calculation.
Bug: 207008609
Test: Verified dynamic sensor sampling with proposed standard Android
 head tracker.
Change-Id: I163b79c2c99f02961adebcb5dcb7e39603944e24
2021-12-10 12:20:22 -08:00
Erik Staats
dbf2545214 dynamic_sensor: Support recognizing head tracker sensor.
Bug: 207008609
Test: Verified dynamic sensor sampling with proposed standard Android
 head tracker.
Test: Verified dynamic sensor sampling with custom Android sensor.
Change-Id: Ia9b991d4a8f7de132cb8509bcc84c51f62e56b31
2021-12-02 15:48:00 -08:00
Erik Staats
4cb45aba7f dynamic_sensor: Support non-8-bit sized HID report items.
Bug: 207008609
Test: Verified dynamic sensor sampling.
Test: Verified unit tests pass.
Change-Id: I797ccabadefa0dde59fd0f3e8541f9853d657f3f
2021-12-01 14:45:36 -08:00
Erik Staats
f99f73ceeb dynamic_sensor: Support report and power usage collections.
Bug: 207008609
Test: Verified dynamic sensor sampling.
Change-Id: If0bef3647d5c52f9bf1d92a2a0ead72e98c70b8c
2021-11-22 10:56:57 -08:00
Erik Staats
24ead9d84a dynamic_sensor: Don't hold mgr lock when operating sensor.
Bug: 205041452
Test: Verified that multiple subscriptions can be made with sensor_test
 to a dynamic sensor without hanging.
Change-Id: Ie7671df8294bee04a0ebe1940242c2a83105f897
2021-11-03 15:32:49 -07:00
Erik Staats
35964ba076 dynamic_sensor: Add multi-HAL 2.1 flush support.
Bug: 201730055
Test: Verified that flush, batch, and activate sensor VTS tests pass.
Change-Id: I6721d9f8976b3ef9f6af02b2320833025b479ee6
2021-10-04 15:17:32 -07:00
Erik Staats
43bc7bccdc dynamic_sensor: Add multi-HAL 2.1 sampling support.
Bug: 195964858
Test: Paired a Sony PS4 controller and verified it can be sampled as an
 accelerometer. The first subscription always returns all 0's, but
 subsequent subscriptions return proper accel samples.
Change-Id: I4bbc4695c988f600a62502f9fccabaa68f42c72b
2021-09-30 06:50:43 -07:00
Erik Staats
7b29add5f7 dynamic_sensor: Notify multi-HAL 2.1 of connected sensors.
Bug: 195964858
Test: Paired a Sony PS4 controller and verified it is present in sensor
 list as an accelerometer. It can't be sampled, but the LSM6DSR
 accelerometer may still be sampled.
Change-Id: I182291cebdf84e5f6cd44d16debd6a07c4bc5281
2021-09-29 10:07:03 -07:00
Erik Staats
3c7a12d8f1 dynamic_sensor: Add sensor manager init to sub-HAL 2.1.
Bug: 195964858
Test: Verified dynamic sensor manager is present in sensor list and that
 no SELinux violations occur on sc-v2-dev and master.

$ make -j28 && \
         vendor/google/tools/flashall -w -s 14281FDEE000A5 --disable_verity && \
         sleep 90 && adb root
.
.
.
$ adb shell sensor_test list | grep "sensor_test\|Type\|Dynamic"
sensor_test version 74
Type     Subtype  Name
32       0        Dynamic Sensor Manager
$ adb logcat -d | grep avc | grep sensor
$

Change-Id: Ib3da287e4f4118ad6b19498248e263f8c1662b3a
2021-09-24 06:16:51 -07:00
Erik Staats
1d509cf815 Revert "dynamic_sensor: Add sensor manager init to sub-HAL 2.1."
Revert submission 15874906-bug_195964858.2

Reason for revert: b/200815351
Reverted Changes:
I76a60f7fb:Allow the sensor HAL to access dynamic sensor prop...
I5d587dc46:dynamic_sensor: Add sensor manager init to sub-HAL...

Change-Id: I26b95614bb276e5c2a686de78d73ab48767176a3
2021-09-22 17:53:58 +00:00
Erik Staats
c7038f8a78 dynamic_sensor: Add sensor manager init to sub-HAL 2.1.
Bug: 195964858
Test: Verified dynamic sensor manager is present in sensor list and that
 no SELinux violations occur.
Test: See details in testing done comment in
 https://googleplex-android-review.git.corp.google.com/15874906 .
Change-Id: I5d587dc46bdec66c3162bf222d36b285b8d2ca3d
2021-09-20 16:58:27 -07:00
Erik Staats
3482ca5bf7 Revert "dynamic_sensor: Add sensor manager init to sub-HAL 2.1."
This reverts commit 28b58c62b5.

Reason for revert: 200210164

Change-Id: I6be2c972a29ec7943dbdf450ef3e491065b011a6
2021-09-16 22:58:51 +00:00
Erik Staats
28b58c62b5 dynamic_sensor: Add sensor manager init to sub-HAL 2.1.
Bug: 195964858
Test: Verified dynamic sensor manager is present in sensor list.
Test: Test: See details in testing done comment in
 https://googleplex-android-review.git.corp.google.com/15831086 .
Change-Id: Ia34596d79f8a6c6985b35dcae75126e456f6009e
2021-09-15 13:48:11 -07:00
Erik Staats
2ac7393bd8 dynamic_sensor: Add stubbed sensor multi-HAL 2.1 support.
Bug: 195964858
Test: Verified the dynamic sensor sub-HAL initializes and non-dynamic
 sensors can sample.
Test: See details in testing done comment in
 https://googleplex-android-review.git.corp.google.com/15806307 .
Change-Id: I59934814cc61c7319731eb840ff2132a8c5ce241
2021-09-13 15:03:51 -07:00
Bob Badour
d7984ccf02 [LSC] Add LOCAL_LICENSE_KINDS to hardware/libhardware
Added SPDX-license-identifier-Apache-2.0 to:
  modules/audio/Android.bp
  modules/audio_remote_submix/Android.bp
  modules/audio_remote_submix/tests/Android.bp
  modules/camera/3_0/Android.bp
  modules/consumerir/Android.bp
  modules/fingerprint/Android.bp
  modules/gralloc/Android.mk
  modules/hwcomposer/Android.bp
  modules/input/evdev/Android.bp
  modules/local_time/Android.bp
  modules/nfc-nci/Android.bp
  modules/nfc/Android.bp
  modules/power/Android.bp
  modules/radio/Android.bp
  modules/sensors/Android.bp
  modules/sensors/Android.mk
  modules/sensors/dynamic_sensor/Android.bp
  modules/sensors/dynamic_sensor/HidUtils/Android.bp
  modules/soundtrigger/Android.bp
  modules/thermal/Android.bp
  modules/tv_input/Android.bp
  modules/usbaudio/Android.bp
  modules/usbcamera/Android.bp
  modules/vibrator/Android.bp
  modules/vr/Android.bp
  tests/camera3/Android.bp
  tests/fingerprint/Android.bp
  tests/hardware/Android.bp
  tests/hwc/Android.bp
  tests/input/evdev/Android.bp
  tests/nusensors/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  Android.bp
  modules/camera/3_4/Android.mk

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: I28924363e6c478f5d0b465b63534c4efd041c770
2021-02-12 20:51:13 -08:00
Nick Desaulniers
79149a378b libhardware: fix -Wreorder-init-list
C++20 is stricter about member ordering in designated initializers than
C99.

Bug: 139945549
Test: mm
Change-Id: I045da46821280e720286a25a0c96b5750d1ad05e
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
2019-11-11 14:41:57 -08:00
Colin Cross
377856d1be Fix accidental implicit fallthroughs
-Wimplicit-fallthrough was printing warnings for these, they look
like real errors.  Fix them and re-enable the error.

Test: treehugger
Change-Id: I818e18a995760f17b85b4c72ee577e531fa2a601
2019-11-01 16:37:17 -07:00
TreeHugger Robot
5cfe24991e Merge "Merge qt-r1-dev-plus-aosp-without-vendor (5817612) into stage-aosp-master" into stage-aosp-master 2019-09-11 20:31:31 +00:00
Brian Duddie
71a921d828 Update sensors OWNERS
Test: n/a
Change-Id: Idbf1b969ab4372c0aeb37bff3066c391c69e64a5
2019-09-09 15:01:59 -07:00
Vineeta Srivastava
bc5b610f7b Strip sensors HAL module.
Bug: 134685292
Test: verified on a device that the library size reduces.
Change-Id: Ic22948a050f59b6ec0ae38dd89184f531d8b5c01
2019-06-12 08:34:24 -07:00
Sasha Smundak
b41d1a0a74 Explicitly include log/log.h instead of cutils/log.h
Eliminates the warning.
Test: treehugger

Change-Id: I567d8fea169e688165ede1fb35d1338c565e3645
2019-01-31 17:18:27 -08:00
Chih-Hung Hsieh
3d68176cfd Fix cert-dcl16-c clang-tidy warnings
Bug: 120614316
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,cert-dcl16-c
Change-Id: I744040edc476bf2bb58413a2a14965c27113a5bd
2018-12-12 22:23:40 +00:00
Brian Duddie
7b007c989f Add bstack to sensors OWNERS file
Test: n/a
Change-Id: I25ae89abe1dfe1552e92cccf0354a269959c0c13
2018-11-30 13:33:20 -08:00