Commit graph

1052 commits

Author SHA1 Message Date
Andy Hung
698fe8448b Merge "HidRawDeviceTest: Enable for device build" 2023-02-06 20:24:33 +00:00
jiabin
fea9e1be0a Support opening bit-perfect output stream.
When opening bit-perfect output stream, the HAL should require the HAL
configuration match the request exactly.

Bug: 262581771
Test: manually
Change-Id: I2f79d41ad42b0c662d28667bde6ae115575d41e1
Merged-In: I2f79d41ad42b0c662d28667bde6ae115575d41e1
2023-02-02 21:51:11 +00:00
jiabin
016fa2107c Add volume control for AOSP USB audio HAL.
When the stream is open with bit-perfect output flag, the volume command
may be sent to the HAL. Use volume control from the mixer when it is
present.

Bug: 262581771
Test: adjust volume
Change-Id: I11e76450a2c3dbcad0ddbd56bd3db1ea83f10f2b
Merged-In: I11e76450a2c3dbcad0ddbd56bd3db1ea83f10f2b
2023-02-02 21:50:43 +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
Chih-Hung Hsieh
69e9179327 Fix sizeof warnings on unusual calloc
Test: make tidy-hardware-libhardware-modules-soundtrigger_subset
Change-Id: If1afcd4834461a2d1f855832dc89b8ae54bd8e2f
2022-12-09 12:41:40 -08: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
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
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
Jean-Michel Trivi
71834f3775 r_submix module: pipe size changes with sample rate
Adapt the pipe size based on the sample rate.
Behavior is unchanged for the default sample rate (48kHz), size
is adjusted by the ratio relative to the default rate.

Bug: 141604269
Test: atest AudioHostTest#testTwoChannelCapturingMediaConversion
Change-Id: I0ba45af18ef02dc0ef77d480e1203d2cd1db9864
2022-02-02 08:27:24 -08: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
Greg Kaiser
3f7bbbb4f1 r_submix HAL: Remove unused variable
We no longer set force_pipe_creation after the removal of
legacy code for in-pipe conversions, so we remove it.

Test: TreeHugger
Bug: 141604269
Change-Id: I82393ba0ad3142aa75d482cc6b0edbaeebbd8116
2022-01-05 07:00:42 -08:00
Jean-Michel Trivi
61d799a5e1 Merge "r_submix HAL: remove legacy code for in-pipe conversions" 2022-01-04 16:36:02 +00:00
Treehugger Robot
eaf73c934e Merge "r_submix: add owners file" am: 593bff82da am: eba0d7f70e am: a66b1a2486 am: 140613a961
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/1935497

Change-Id: I50f08b51fbc69e8262f7cc005fc5de3f1b74739e
2022-01-03 11:35:04 +00:00
Treehugger Robot
140613a961 Merge "r_submix: add owners file" am: 593bff82da am: eba0d7f70e am: a66b1a2486
Original change: https://android-review.googlesource.com/c/platform/hardware/libhardware/+/1935497

Change-Id: Ib2386d226b0708a6ed0118bad02189d3ac33a4ba
2022-01-03 11:18:33 +00:00
Jean-Michel Trivi
16699d13ec r_submix: add owners file
Bug: 141604269
Test: see gerrit
Change-Id: I975390f8f495267ef0cd24dc8e73db859e541146
2021-12-30 16:29:03 -08:00
Jean-Michel Trivi
a33c1654fb r_submix HAL: remove legacy code for in-pipe conversions
Old hacky uses of this HAL required channel and sample
rate conversion, which were never expected when this HAL
is used for its real application as the backend for
dynamic audio policies. In that context conversions are
performed in audio_flinger in the mixer.

Bug: 141604269
Test: atest AudioHostTest#testTwoChannelCapturing

Change-Id: I333e981fb3db403ab2da6f77debe49bc7d132ebc
2021-12-23 11:49:28 -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
YiMing Tseng
d2299dd03b Add GRALLOC_FRAMEBUFFER_NUM configuration am: 0b5ab223e1 am: 56747f919a
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/16235226

Change-Id: I235c7d209671734473f9e5885b49e1670a19fcf2
2021-12-16 03:32:23 +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
YiMing Tseng
0b5ab223e1 Add GRALLOC_FRAMEBUFFER_NUM configuration
Add config to set the NUM_BUFFERS. Set NUM_BUFFERS to 1 can
prevent page flipping and set it to a larger number can allow
userspace to fill up the following frame earlier.

Bug: 205917753
Change-Id: Ibf4a52a1e35f4a2404008a48b637cb82c4b46365
2021-12-09 09:09:25 +00:00
Erik Staats
0d8677fa4d dynamic_sensor: Support recognizing head tracker sensor. am: dbf2545214 am: ec9039d20a
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/16382054

Change-Id: Iaf36409f05f4c8e3f62fd61323f573575bed0cb7
2021-12-03 14:43:46 +00: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
7007ba93ef dynamic_sensor: Support non-8-bit sized HID report items. am: 4cb45aba7f am: 99ad5c01bb
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/16359454

Change-Id: I33e8fb34157fcfd27f649b1b956a4c28dddad6a3
2021-12-02 16:42:09 +00: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
82bbf6dc12 dynamic_sensor: Support report and power usage collections. am: f99f73ceeb am: 2978c08ef0
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/16323898

Change-Id: I45025e510e2a836b6f43949fea7955dafd601755
2021-11-23 14:14:18 +00: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
157ae479bc dynamic_sensor: Don't hold mgr lock when operating sensor. am: 24ead9d84a am: 9ec6c4dcf7
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/16185557

Change-Id: I8023f1d8f67ab5de14e1b7c1b7631f43f8f35fd0
2021-11-04 16:46:44 +00: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
f3852875e7 dynamic_sensor: Add multi-HAL 2.1 flush support. am: 35964ba076 am: d30ecf1f7d
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15974606

Change-Id: Ie329b87fa137b389231aac7b467a1d13652c5f76
2021-10-05 13:10:03 +00: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
747b0e0592 dynamic_sensor: Add multi-HAL 2.1 sampling support. am: 43bc7bccdc am: 157804a3f7
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15949542

Change-Id: Iccd67a723e6298812fe2b462e0b15b4ca1daa4de
2021-09-30 17:42:00 +00: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
43c3fc4afe dynamic_sensor: Notify multi-HAL 2.1 of connected sensors. am: 7b29add5f7 am: 67ca088321
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15933544

Change-Id: Id9cd784cd5467b46facda754b31e4cdcec817bff
2021-09-29 19:35:35 +00: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
16fc5d543e dynamic_sensor: Add sensor manager init to sub-HAL 2.1. am: 3c7a12d8f1 am: bf866d6dd4
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15905535

Change-Id: Icee05924819530890d509e990958af559811ea47
2021-09-24 18:05:32 +00: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
372bc142dd Revert "dynamic_sensor: Add sensor manager init to sub-HAL 2.1." am: 1d509cf815 am: fb74ed236c
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15886139

Change-Id: I774582c61e10555535317eb679b9d731b2ebea25
2021-09-22 18:28:17 +00: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
023e2f2294 dynamic_sensor: Add sensor manager init to sub-HAL 2.1. am: c7038f8a78 am: 409c42afad
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15874906

Change-Id: I790c826f327c71520a7ad20850686c41f7aaa0c5
2021-09-22 12:58:02 +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
ec9795eec1 Revert "dynamic_sensor: Add sensor manager init to sub-HAL 2.1." am: 3482ca5bf7 am: d1f1fbbcbc
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15847974

Change-Id: I8452563bf0d49f7f767b0deb1097d586f2fef806
2021-09-16 23:22:23 +00: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
913254ad60 dynamic_sensor: Add sensor manager init to sub-HAL 2.1. am: 28b58c62b5 am: e9155bf1ab
Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/libhardware/+/15831086

Change-Id: Id605f4fae90edd7b297242e097e06603baa0ec19
2021-09-16 22:04: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