Commit Graph

34 Commits

Author SHA1 Message Date
Yixuan Wang 8d073840b1 sm8150-common: sensors: Remove early break for sub-HAL initialization failure
Bug: 212420575
Test: none
Change-Id: I38099a4edbdeffe99ae2d91fc9dc518c9da98b13
2023-05-03 05:04:42 +02:00
Brian Duddie 5f490fb597 sm8150-common: sensors: Fix sub-HAL handle in dynamic sensor meta events
Need to apply the sub-HAL index byte to ensure handles provided in
DYNAMIC_SENSOR_META events align properly with the [dis]connected
callbacks.

Bug: 228879057
Test: try on device with dynamic sensors sub-HAL at index > 0
Merged-In: Ic7290b51733bb829a5494ef41e9430b51dc6074e
Change-Id: Ic7290b51733bb829a5494ef41e9430b51dc6074e
2023-05-03 05:04:42 +02:00
Alexander Koskovich 56a6368e97 sm8150-common: sensors: Add group 'input' to 2.1 multihal
* Required by some OEM sensor implementations, e.g.
   ASUS ZenFone 8, ASUS ROG Phone 3, OnePlus 9. This
   is done so /dev/input/event* nodes can be read by
   the QCOM sensor HAL.

Test: Verified light and proximity sensor work on ASUS
      ZenFone 8 & ROG Phone 3 (android-12.1.0_r7).
Change-Id: I1a2d7384da0b159a4b59fcf38c37117d43b3b127
2023-05-03 05:04:42 +02:00
karthik bharadwaj d8089ab7f8 sm8150-common: sensors: Strip hinge angle sensor when running a 2.1 HAL as 2.0
VTS ensures that  2.0 HALs don't expose the hinge angle sensor,
but the 2.1 HALs must run 2.0 VTS tests. This CL ensures that
we don't expose the hinge angle sensor on the 2.0 HAL, to avoid
failing those VTS tests.

Bug: 173135479
Test: run vts -a x86 -m VtsHalSensorsV2_0TargetTest
Change-Id: I944bfb0b01be0831e45cfd3d6ed7dab6770d1b80
2023-05-03 05:04:42 +02:00
Stan Rokita 1fb2eaa255 sm8150-common: sensors: Remove unnecessary type and dup for fd
Test: Compile
Change-Id: Iab4502a03090e0c99af73fded270c537b2909591
2023-05-03 05:04:42 +02:00
LuK1337 6dc9270fe0 sm8150-common: sensors: Relocate als_correction_service to /system_ext
Change-Id: I866406c174180e54b57ddb021a500d6bd0f3388a
2023-05-03 05:04:42 +02:00
LibXZR 93f86ceace sm8150-common: sensors: Rework screen capture logic
Moving to asynchronous capture listener allows us to fix previous race
on GraphicBuffer and make sure it won't be blocked by any incident e.g.
fence timeout.

Also, guard updateScreenBuffer() with mutex to make sure lastScreenUpdate
can be updated safely.

Extends ThreadPoolMaxThreadCount to 1 because 0 is a confusing value.
Although we set max threads to 0 previously, extra binder thread was
still started according to the warning message in startThreadPool(),
which led to the race noted above as sigaction can also be run on binder
thread.

Also add verbose logging so we can do quick debugging with LOG_NDEBUG=0.

Change-Id: I4733919bc20b3c1b382e60b71c5ceaa10dedaf49
Signed-off-by: LibXZR <i@xzr.moe>
2023-05-03 05:04:42 +02:00
LibXZR 930a03bb2a sm8150-common: sensors: Capture secure layers too
They affect brightness.

Change-Id: Ifbc10a1e253c986ca720f3d610b545ef0e839e8a
Signed-off-by: LibXZR <i@xzr.moe>
2023-05-03 05:04:42 +02:00
Fabian Leutenegger 229c7d9e69 sm8150-common: Simplify pickup gesture patching
Change-Id: If9bebeab35aaf8fc9282a0c80985baf0eb8931d4
2023-05-03 05:04:42 +02:00
Tyler Trephan 66d48b8c96 sm8150-common: Update multihal to use new sensors AIDL interface
Signed-off-by: KanishkTheDerp <kanishkthederp@gmail.com>
Change-Id: I83c25910027e7f7f57d41913ec95f57094e78b09
2022-08-30 01:23:34 +02:00
Cosmin Tanislav 17fa1ada8e
sm8150-common: sensors: standardize pickup sensor
* use standard sensor type
 * ignore non-wakeup sensor variant
 * ignore events that do not properly match a pickup

Signed-off-by: Omkar Chandorkar <gotenksIN@aosip.dev>
2022-03-03 16:24:08 +09:00
Art_Chen a21e672dc5
sm8150-common: sensors: Spawn a binder thread for als service
Change-Id: Idefb74395f691ebec5e50aca0899c5d07f4276fe
2022-03-03 15:25:07 +09:00
Pranav 487af89e03
sm8150-common: sensors: Switch to ScreenshotClient::captureDisplay
Change-Id: I59057c31b5ce714cbb6abbd574be2d5d9248f4b1
Signed-off-by: Pranav <npv12@iitbbs.ac.in>
2022-03-03 15:25:07 +09:00
dantmnf 93c9e478e7
sm8150-common: Use average linear light for ALS correction
Change-Id: Ia784480462f5a236d0bd75861f1cf5fd170fe3b1
2022-03-03 15:25:06 +09:00
LuK1337 e28bfe6156
sm8150-common: sensors: Move to AOSP Soong conditionals
Change-Id: I220357b268053463044e2780ae70dfff3bb5a301
2022-03-03 15:24:54 +09:00
Rituj Beniwal 562f63234f
sm8150-common: Apply ALS correction to the RAW sensor value
* Probably a derp here 07c6e1a71f

Signed-off-by: Rituj Beniwal <ritujbeniwal@gmail.com>
2022-03-03 15:24:52 +09:00
LuK1337 0327a62c9b
sm8150-common: sensors: Replace sleep(1) with pause()
This is	a much smarter approach	as this	lets us	to
stay suspended for a much longer time, effectively
until we receive any signal.

Change-Id: Ibfc95437f38c6dc5a837cf1b968a78b0fae26f9e
2021-04-07 15:23:40 +05:30
LuK1337 fb250f82ed
sm8150-common: sensors: Bring back naruto light support
Also drop full treble flag as we are no longer
violating Treble SELinux tests.

Change-Id: If6802dc13c3ac56fa2e5cd032f3daad71958bffb
2021-04-03 06:56:29 +05:30
LuK1337 5def802c72
sm8150-common: Import sensors/2.0/multihal
Change-Id: I2615438912974f2f0f57fd96b930d4bd11d0de5b
2021-04-03 06:56:28 +05:30
LuK1337 eb4b31c557
sm8150-common: Import OOS 11 changes
* Redo blobs list based on OnePlus sm8250-common
* Retire lights HAL
* Retire custom sensors HAL for time being
* Reimport rootdir
* Reimport seccomp
* Update audio configs
* Update priv app perms whitelist
* Update properties
* Update sec_config
* Update wifi configs

Change-Id: I2b56f03c1d3e4d0d9693d82e96e8501695ebfd74
2021-04-03 06:53:28 +05:30
LuK1337 a7735fe51f
sm8150-common: sensors: Pass 0 degree rotation properly
Change-Id: Iaae6658f737d00a49d13e3c5c10a21d9d60b4bf1
2021-04-03 06:48:12 +05:30
Steven Moreland d34a0026cf
sm8150-common: Remove libhwbinder/libhidltransport deps
Since these were combined into libhidlbase.

Bug: 135686713
Test: build only (libhwbinder/libhidltransport are empty)
Change-Id: Iba2cd20b8b20fac3e7564de6b853b475fd4ebd2a
2021-04-03 06:48:10 +05:30
gnumdk c8e52bd53a sm8150-common: Use correction instead of discarding it
Change-Id: I55a8f3649e2062e03bc729ac1d2c814a6cf32428
2020-09-11 18:26:19 +02:00
gnumdk 67d0973dcc sm8150-common: Fix adaptive brightness
Do not reset value to zero, just use original reading. Prevents the
famous "unstable adaptive brightness" bug.

Change-Id: Ia82b4f3a6cf3ce0211e3ffa4ef3ff43be52030d2
Signed-off-by: Anirudh Gupta <anirudhgupta109@aosip.dev>
2020-06-24 14:43:54 +05:30
Anirudh Gupta eb1d29b2b5 sm8150-common: sensors: Switch log header location
Silences the following warning:

`warning: "Deprecated: don't include cutils/log.h, use either android/log.h or log/log.h" [-W#warnings]`

Change-Id: I17f280010d357a69edb29ade8a3e6612e0839242
Signed-off-by: Anirudh Gupta <anirudhgupta109@aosip.dev>
2020-05-02 14:30:10 +05:30
Peter Cai 3c734f274b sm8150-common: sensors: Start service with /dev/binder
* On Android 10, the default binder interface is set according to
  whether the service is system or vendor, whereas on pre-10 every
  service runs on /dev/binder by default. This breaks our service due to
  its dependency on SurfaceFlinger, which is not found on
  /dev/vndbinder.

Change-Id: I15584c40db4d432877994274205d7615565ef33b
2019-10-06 19:59:40 +02:00
Peter Cai c755db349f sm8150-common: sensors: Adapt to libgui changes of Android 10
Change-Id: Id3490e62be999d5d2653e80c25cc2274dc03f03d
2019-10-06 19:59:40 +02:00
Peter Cai 8c8601125f
sm8150-common: sensors: use soong config instead of properties 2019-07-15 12:24:51 +08:00
LuK1337 a7c1c683a9 sm8150-common: sensors: Switch to libgui_vendor
Change-Id: I4ff1fcefb0d3429f0fbbb6e79bdbc3357cbb3c8e
2019-07-07 12:53:46 +02:00
LuK1337 6db771311e sm8150-common: sensors: Use std::min() for calculating rgb_min
Change-Id: I77609ea08813e0c3ade54c5906acc4adb73473ad
2019-07-04 12:48:05 +02:00
Peter Cai c2cae22e74
sm8150-common: sensors: calibrate ALS from /persist
* The factory calibration data of the ambient light sensor is stored in
/persist. Make use of this and calibrate the sensor readings so we at
least won't get those crazy values any more.
2019-07-04 17:53:29 +08:00
Peter Cai 314420522e
sm8150-common: sensors: reduce log spam
* shut the sensors hal debugging information up.
2019-06-29 10:42:57 +08:00
Peter Cai a37dbb2a5a
sm8150-common: sensors: calculate correction for light sensor
* On OnePlus 7 series phones, the light sensor is placed under the
display. This means that light from the display can affect the reading
of the sensor, messing up the auto brightness algorithm.
* This is an attempt to address this by reading the pixel values right
around the sensor, estimate its brightness and substract it from the
original readings. It requires the following properties to be set:

- persist.vendor.sensors.light.location_{x,y}
  The position of the sensor in terms of the coordinates on screen
- persist.vendor.sensors.light.full_white_reading
  The reading of the light sensor when all the pixels around it are
  white and with full brightness

* This also depends on `libgui` from `frameworks/native` to be available
in vendor namespace. The module was already part of VNDK in AOSP, but
it's VNDK-SP which means it is not available to normal vendor HALs. For
now, we can just patch the `Android.bp` of `libgui` to set
`vendor_available: true`.
2019-06-27 14:06:45 +08:00
Peter Cai 9c7485da81
sm8150-common: import sensors multihal
* with a full vendor image, we can modify the sensors hal as we want. We
can replace the reported sensor type directly from HAL, instead of
relying on a framework patch.
2019-06-25 19:17:37 +08:00