144 Commits
udc ... bka

Author SHA1 Message Date
Bruno Martins
ce1bf5c27f aidl: camera: Partially return to soong_config_module_type usage
Some checks failed
action.yml / aidl: camera: Partially return to soong_config_module_type usage (push) Failing after 0s
This partially reverts commit 00809a1, that broke too many devices
that weren't ready yet.

Change-Id: I4d234e79a99da15542b81e1741290336e9f08d0b
2026-01-19 07:49:39 +00:00
LuK1337
44c057f60b pre-commit: Enable clang-format
Change-Id: I7a22a5fe9ee7176604fed0825f96417c53adb1ff
2026-01-18 15:59:00 +00:00
Bruno Martins
474ebe1722 sensors: Run through clang-format
Change-Id: I64ff0a321a1e95eaac78e8caefbf43a125fd5c84
2026-01-18 15:59:00 +00:00
Bruno Martins
c7abe693bd ril: Run through clang-format
Change-Id: I7964e1770a1b603242f336de037f0d5f095dff1a
2026-01-18 15:59:00 +00:00
Bruno Martins
ef4647e636 rebalance_interrupts: Run through clang-format
Change-Id: I76495309d747349077fef7980864fc794807723a
2026-01-18 15:59:00 +00:00
Bruno Martins
4b128b05b3 hidl: Run through clang-format
Change-Id: Ia848230ceb454b858d535481b34f193e06e765c6
2026-01-18 15:59:00 +00:00
Bruno Martins
6157fb0df0 aidl: Run through clang-format
Change-Id: I46a43e533cda2988a8f4cd547b644bccb5979431
2026-01-18 15:59:00 +00:00
Bruno Martins
d87a8f30a4 aidl: vibrator: Add some brackets
Change-Id: I4b804fb88bd098a1adcf42357a56acf286102e6c
2026-01-18 15:59:00 +00:00
Bruno Martins
211e5f0b1a aidl: usb: Add some brackets
Change-Id: I2498700fd38037974e8a27b7c5c77baf29cd0909
2026-01-18 15:59:00 +00:00
Bruno Martins
f76655d7bc aidl: memtrack: Add some brackets
Change-Id: Id950738a6871d6b6822b7b6bcfb641ab9c141dcf
2026-01-18 15:59:00 +00:00
Bruno Martins
0073e77169 aidl: camera: Remove deprecated module
Change-Id: I74151184a0c0b1d4bab442a84f330095a618763c
2026-01-18 15:59:00 +00:00
Bruno Martins
661a74dc6a hidl: camera: Remove deprecated custom device impl and provider
All Samsung targets out there are using AIDL custom device impl/provider.
There's no need to continue maintaining HIDL ones any longer.

Change-Id: I6dc832b04f2795e30052df6f37448c126fdad692
2026-01-18 15:59:00 +00:00
Bruno Martins
7063bcad23 aidl: usb: gadget: Migrate to select()
Change-Id: Id4696b9aa6af0243c43ca5f71d5d71e1ee0ee963
2026-01-18 15:59:00 +00:00
Bruno Martins
00809a12b0 aidl: camera: Migrate to select()
Change-Id: Id29a05301cc720fcbc9b28c98f3c98e2d67df166
2026-01-18 15:58:56 +00:00
Bruno Martins
9d8b250ce5 samsung: Remove loki_tool
It looks like this was only used by an ancient device... back in the
good'ol CM days.

Change-Id: Ib9aef0a72c32674ca2189e368752c90aa916c530
2026-01-18 14:00:38 +00:00
Bruno Martins
8aba80de2b samsung: Delete dtbhtoold
All the devices that used this tool are quite dead. Anyway, if proven
to be really needed, the tool should be placed in a dedicated Exynos
repository.

Change-Id: I2aefdeca818ed92d65e4cf50f83a0af42d3d2f2d
2026-01-18 14:00:38 +00:00
Bruno Martins
33f74940ad AdvancedDisplay: Blend into color preference category
Depends-on: I56b161c98eb7f669703f46d73f56e081ebf18558
Change-Id: I10a216b0d202f78cc42791ef45b4d49cf5767382
2026-01-02 01:19:30 +00:00
LineageOS Infra
b2f5a8db8d Automatic translation import
Change-Id: I9df6976f19746c9725ec39ec9970628cd1dcb789
2026-01-01 17:23:55 +00:00
borbelyvince
df0812cd0b aidl: vibrator: Use std::vector for effect data and clean up unnecessary field initializers
Change-Id: Ic20202204e2f3c4af03a9a298c645145aef0ce35
2026-01-01 16:40:34 +00:00
borbelyvince
4881519b23 aidl: vibrator: Write use_sep_index value in constructor
It only has to be initialized once, and no subsequent changes are needed.

Change-Id: I9c3290bdcff3964546efb9017ad12866d5903af8
2026-01-01 16:40:34 +00:00
Bruno Martins
96cec7c200 aidl: fingerprint: Add missing include
Spotted after clang-format formatting changes:

  hardware/samsung/aidl/fingerprint/LockoutTracker.h:26:5: error: unknown type name 'int64_t'
     26 |     int64_t getLockoutTimeLeft();
        |     ^
  hardware/samsung/aidl/fingerprint/LockoutTracker.h:29:5: error: unknown type name 'int32_t'
     29 |     int32_t mFailedCount = 0;
        |     ^
  hardware/samsung/aidl/fingerprint/LockoutTracker.h:30:5: error: unknown type name 'int64_t'
     30 |     int64_t mLockoutTimedStart;
        |     ^

Change-Id: I2cc02e0bdda9e3302aac8bffc5c6022caee96b34
2026-01-01 16:32:57 +00:00
Bruno Martins
1c29fd2599 aidl: fingerprint: Run through clang-format
Change-Id: I866e2c5621cf009a64658bd2f2b20087286c6f4d
2026-01-01 16:32:52 +00:00
Bruno Martins
2326b7c10b aidl: fingerprint: Add some brackets
Change-Id: I361c408cf50857ab53d32d5e67050dc940d96ef3
2026-01-01 16:32:48 +00:00
Luka Panio
1ff326fde4 aidl: fingerprint: Allow more than one fingerprint location
* Needed for foldable devices which have different locations
  on inner and outer screens

Change-Id: Iebdab30de5542bad43d4fc786a528e5306e26daa
2026-01-01 16:32:39 +00:00
Bruno Martins
078d67d671 Run pre-commit run --all
Change-Id: Ib794c4ef4425c3f372f8c92caa8da5c7b0957987
2026-01-01 15:44:34 +00:00
LuK1337
d29b39b66a Introduce pre-commit & GitHub Actions for it
Change-Id: I4604d13e5ccf74ec4c7088a40a9f7f915f9b1293
2026-01-01 15:44:02 +00:00
Bruno Martins
b0416d32bc ril: Run dos2unix
Change-Id: Ibbad45e91278ffcf2290c37deca117de4163c04f
2026-01-01 15:43:57 +00:00
Bruno Martins
1b4d8a2b03 fingerprint: Set defaults if no Z-order is set
Change-Id: If905bf143de7bd9232c83daa664d77067bec2aa6
2025-12-08 15:46:28 +00:00
Kai Jones
354ca305ca fingerprint: Configurable UDFPS dim layer Z-order
Introduce a build-time configuration for UDFPS dim layer Z-order.
Define `fod_dim_layer_zorder` via Soong, dynamically set using:

  $(call soong_config_set,samsungUdfpsVars,dim_layer_zorder,0x20000001u)

Change-Id: Ie1d5e78894e191150be235eb48e400ea1feab9b2
2025-12-08 15:46:18 +00:00
Bruno Martins
923942619f fingerprint: FOD -> UDFPS
Change-Id: I0b6be82483d8fc6bb74a529c2962d1e4b40cf04a
2025-12-08 15:46:03 +00:00
Anay Wadhera
33ccfec6cf doze: Drop minSdkVersion
Change-Id: Idbbe6713999ca8b942b2bf91cc899118e22a062b
2025-12-02 15:26:59 +00:00
LineageOS Infra
9cc8f56671 Automatic translation import
Change-Id: Ie3b52befcad81669a498f51598ca79e8ca20b260
2025-12-01 14:53:11 +00:00
e1ebb45e3c AdvancedDisplay: Move to PreferenceFragmentCompat
PreferenceFragment was deprecated in API level 28.

https://developer.android.com/jetpack/androidx/releases/preference#1.1.0

Change-Id: I3ae5a8b9a3be3317f097564368559802b9322558
Signed-off-by: AnierinB <anierin@evolution-x.org>
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-11-27 22:05:07 +00:00
Bruno Martins
c65e8a6f0f dap: Place top intro above main switch
To go along with the rest of Settings UI.

Change-Id: I04ec5319131cf557079480cc3cab590a16497e18
2025-11-27 21:58:31 +00:00
ExtremeXT
699a741aa9 dap: Gray out profiles when DAP is disabled
Change-Id: Ia1dc3cf4b8a6c16ed41fb79dd04f2d53c94e2103
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-11-27 21:58:21 +00:00
Bruno Martins
403a57cc0d dap: Use new method to listen for preference changes
Usage of addOnSwitchChangeListener(OnCheckedChangeListener) is
deprecated. The Javadoc explicitly says:

  Use setOnPreferenceChangeListener(OnPreferenceChangeListener) instead.

Change-Id: I591c52ee8e79ad075ba74f45c656344e7e3abbca
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-11-27 21:10:41 +00:00
08cfc0cbc2 dap: Move to PreferenceFragmentCompat
PreferenceFragment was deprecated in API level 28.

https://developer.android.com/jetpack/androidx/releases/preference#1.1.0

Change-Id: I4f933bab13382550c820ade4e759dd645aad37c4
Signed-off-by: AnierinB <anierin@evolution-x.org>
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-11-27 20:51:10 +00:00
Bruno Martins
e1873e9df4 doze: Use new method to listen for preference changes
Usage of addOnSwitchChangeListener(OnCheckedChangeListener) is
deprecated. The Javadoc explicitly says:

  Use setOnPreferenceChangeListener(OnPreferenceChangeListener) instead.

Change-Id: I71e0e3f86ff339a312cac1e09106f6d5d15b7e43
2025-11-27 20:46:31 +00:00
Michael Bestas
0c4a57235f doze: Convert to SwitchPreferenceCompat
Change-Id: Ic1cbaba37d499da1855af9c3930f2df426e2d3af
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-11-27 20:35:41 +00:00
0426336593 doze: Move to PreferenceFragmentCompat
PreferenceFragment was deprecated in API level 28.

https://developer.android.com/jetpack/androidx/releases/preference#1.1.0

Change-Id: Ie8a4b04bd588afbbbc5882349ddbc05f988f80bf
Signed-off-by: AnierinB <anierin@evolution-x.org>
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-11-27 20:05:38 +00:00
Michael Bestas
04da539900 Revert "samsung: hidl: add vibrator HAL for SEC Haptic Engine"
This reverts commit a4922f4f1c.

Reason for revert: HIDL vibrator is dead in BP3A and nobody uses this.

Change-Id: I53bb04b8efe42be67ff922a0be83f7cd4a92bd46
2025-11-20 23:52:50 +02:00
Tim Zimmermann
9f2dfb966f aidl: health: Uprev to V4
* No change in implementation is needed since it is pulled in from libhealth_aidl_impl_user

Change-Id: I1ab76e0311aaf69d493ef303ad6f0081e6e38c8e
2025-11-02 09:41:53 +01:00
ata-kaner
121dddc138 aidl: codec2: Add missing seccomp architectures
Fixes following error on non-ARM targets.

error: hardware/samsung/aidl/codec2/Android.bp:62:1: module "android.software.media.c2-default-seccomp_policy" variant "android_x86": src: missing prebuilt source file

Change-Id: I6dcc59329618853d75f55750b1a21b405f0c175a
2025-10-20 05:36:03 +03:00
LineageOS Infra
d72d21d4ca Automatic translation import
Change-Id: I72dc070a527fa0e03bdc2472322afc9ca5777091
2025-09-24 20:06:36 +00:00
Bruno Martins
73dc774852 samsung: Normalize vars namespaces
Change-Id: Iaef6bef86e572192c524dbb27cad58235523751c
2025-09-20 12:47:38 +00:00
Tim Zimmermann
888b1252e0 Revert "aidl: health: Allow disabling charger suspend"
This reverts commit 1940e53398.

Reason for revert: The original issue this was created for should
be fixed in the kernel. If we really want this disableable in the future
it should be done through a sysprop anyways.

Change-Id: I88d85e45bbd86c9e4d963c99c874ae23275ad5bc
2025-09-09 17:13:38 +02:00
Tim Zimmermann
4dd00a62d7 Revert "aidl: usb: gadget: Link mass_storage.0 when MTP or ADB is enabled"
This reverts commit de83d093e6.

Reason for revert: Rather hacky workaround for a 3rd party app.

Change-Id: I68763fa4365bfc86c1f612218d0b494f52864a13
2025-09-09 17:12:04 +02:00
Tim Zimmermann
f8f8b96472 Revert "aidl: usb: gadget: Don't bail out on mass_storage link fail"
This reverts commit 2af299f594.

Change-Id: I61af933fbccb61ef381ff8617db455ef90418874
2025-09-09 17:12:02 +02:00
ExtremeXT
2af299f594 aidl: usb: gadget: Don't bail out on mass_storage link fail
* This feature requires a change in the kernel config and another one in the USB init:
* e1e4a193d4
* bdd598c4d0

* This is not a vital feature, so there is no reason to bail out and completely kill USB when it fails.

Change-Id: I7e5a391d100ef77b9904384119e53629dc69260b
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-09-06 14:07:46 +03:00
Cyber Knight
de83d093e6 aidl: usb: gadget: Link mass_storage.0 when MTP or ADB is enabled
- This fixes DriveDroid functionality when coupled together with [1].

[1]: 0e435675d7

Test: Open DriveDroid, host an image, change usb configuration to File Transfer and try to boot an OS on PC by plugging in the phone.
Change-Id: I7956e14fb8239d273e687b61ed4154a0695460ce
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
[Flopster101: Also enable for ADB, it's more convenient since MTP isn't on by default.]
Signed-off-by: Flopster101 <nahuelgomez329@gmail.com>
Signed-off-by: Majaahh <maja.blaszczak@proton.me>
2025-09-06 09:41:20 +00:00
Tim Zimmermann
efaf58c10a secril_config_svc: Set ro.telephony.default_network property
Change-Id: I0345d103df56c8b8a1d91828edea2af7ceee7194
2025-09-05 15:26:09 +02:00
Tim Zimmermann
098923d64e secril_config_svc: Handle properties in a treble-compliant way
* This is also more similar to what the stock service does

Change-Id: Ic1e7e1f2fdd6d32bd0d89ed1a0c31f7ad69a0c84
2025-09-05 15:24:08 +02:00
Atakan
edf680575b secril_config_svc: Check called args before trying to set properties
Change-Id: I8b94d69915e643e8ca74857e90fcc2df68715f90
2025-09-05 00:18:32 +00:00
ExtremeXT
876585001b secril_config_svc: Set ro.vendor.radio.default_network properly
Devices supporting different network bands (LTE, 5G, etc) have different
values for this prop, hence hardcoding it in vendor.prop is not the best
solution.

Let secril_config_svc set this dynamically based on persist.radio.def_network
from telephony.prop.

Co-authored-by: Flopster101 <nahuelgomez329@gmail.com>
Change-Id: I8ee568224bfae74cb65c1f0440bd26bdce58814f
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-09-04 21:45:00 +00:00
Atakan
c111b52360 secril_config_svc: Set ro.telephony.sim_slots.count property
Devices from different regions may have different slot numbers, so hard-coding the number through overlays is not a good approach.

Let secril_config_svc handle this dynamically, just like how Samsung did on Android 16.

Change-Id: Ib832f6004bccb528a22ac4e6fe9fffa279892f1f
2025-09-02 22:22:36 +03:00
Atakan
5074e1b915 secril_config_svc: Use SetProperty() for fallback props
Change-Id: Ie4c4a46364962d81c82aaed909f55cf7bec25a2c
2025-09-02 22:12:59 +03:00
Bruno Martins
608872573b livedisplay: Migrate to AIDL
Change-Id: I4a67910fdc09a3350c5ee7215d5ac9b69c977af0
2025-09-02 13:16:38 +00:00
Atakan
d4c580a5bc livedisplay: Refactor for modern Qualcomm devices
We're now supporting various Qualcomm chipsets.

- Commonize DisplayColorCalibration for both Exynos and Qualcomm.
- Decommonize ReadingEnhancement for Exynos only (doesn't work on Qualcomm).
- Cleanup legacy code and paths.

Change-Id: Id2068e5ee421a546ed1f17f3fd2deb3ed0a26f8e
Co-Authored-By: Simon1511 <me@simon1511.de>
2025-09-02 13:16:38 +00:00
Majaahh
1940e53398 aidl: health: Allow disabling charger suspend
[Flopster101: Having it enabled on Exynos 1280 (s5e8825) devices would cause
the device to kernel panic shortly after the screen turned off in offline
charging, and I could not diagnose this at the kernel level.

[   38.159432] [0:      watchdogd:  496] Watchdog: secdbg_wdd_ping_handler RTC 2025-07-05 10:37:31 UTC
[   39.913841] [1:  kworker/u16:1:    9] [SHUB]      debug_work_func( 135) :  (2025/07/05 10:37:33) FW(0):0, Sensor state: 0x0, 0x0, En: 0x0, 0x0, Reset cnt: -1[0 : C 0(0, 0), N 0, 0, 0, D 0], Cal result : [M:N, P:N]
[   41.961728]I[1:      swapper/1:    0] Suspend/Resume hang between PM_SUSPEND_PREPARE and DEV_SUSPEND_PREPARE
[   41.961744]I[1:      swapper/1:    0] curr jiffies(4294902784) pm_prepare_jiffies (4294896320) expires jiffies(4294902570)
[   41.961804]I[1:      swapper/1:    0] Suspend/Resume hang detected
[   41.961820]I[1:      swapper/1:    0] Kernel panic - not syncing: SSLD:S2R timeout,time = 16110981 usec|action(freeze_processes, 0)[android.hardwar, 508]
[   41.961854]I[1:      swapper/1:    0] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G         C        5.10.238-android12-9 #3
[   41.961863]I[1:      swapper/1:    0] Hardware name: Samsung A25X SWA OPEN based on S5E8825 (DT)
[   41.961874] [6:    kworker/6:4:  359] deferred_work_fn: [sicd] deferred done]

Change-Id: Ibe27c52be81aa1ddde13aeda7a28f892ef4a855e
Co-authored-by: Flopster101 <nahuelgomez329@gmail.com>
Signed-off-by: Majaahh <maja.blaszczak@proton.me>
2025-09-01 15:10:37 +00:00
Bruno Martins
cd805062ff touch: Properly check if gestures are supported
Checking if the TSP command node exists is not enough to declare that
feature is supported, so check if the command is listed as available.

Change-Id: Id7884e62358db966cfd8b85fbca95bc13de03f80
2025-08-31 15:18:51 +00:00
Atakan
ca6f97fb2d vintf: Add MDFPP Gatekeeper entry
Change-Id: I05043484bd860d3daf48bcf53ac59622d494702b
2025-08-30 23:20:50 +00:00
Atakan
9627fa4826 hidl: keymaster: Update init script
Samsung has updated the keymaster init script in Android 11.

Change-Id: I696e8ae55243857c12faf0ef7e3d42fbd284ff93
2025-08-30 23:20:16 +00:00
ExtremeXT
e132bfadd8 touch: Add Single Tap gesture support
Co-authored-by: Simon1511 <simon2002.schoenmackers@gmail.com>
Change-Id: I0400802734471bffcf90d9711dbb7771fc7c8c86
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-08-28 20:02:58 +00:00
ExtremeXT
f4dd7d73f4 touch: Rename TOUCHSCREEN_GESTURE_NODE
To be more explicit as to what it is, in preparation for follow-up
change that adds a single tap gesture to the interface.

Change-Id: I5387e60fe24a0b6edd6b691ae403f734e281dca6
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-08-28 20:02:16 +00:00
Atakan
cb586c51f4 aidl: codec2: Modify for Samsung
Change-Id: I9d314651afd78761355e6667b69fb74199caaaaa
2025-08-28 19:31:04 +00:00
Atakan
db3ce29c77 aidl: Import AOSP C2 example service
From: frameworks/av/media/codec2/hal/services @ android-15.0.0_r32

Change-Id: I49fb09063bacd7571c04bd0e287227c2452e2bbd
2025-08-28 19:30:26 +00:00
ExtremeXT
a72f98f12b touch: Also support set_scan_rate TSP CMD
This adds support for set_scan_rate SEC TSP command, which is used by devices like the S20-S22 Series (non-FE).

Keeps backward compatibility for devices with a melfas touchscreen like the S20 FE (r8s/r8q), using set_game_mode TSP command.

Change-Id: I643832df015220874d728b1ef54533c07e59f885
Signed-off-by: ExtremeXT <extremextdev@gmail.com>
2025-08-28 19:29:48 +00:00
Bruno Martins
9ab477d63c touch: Add HighTouchPollingRate support
Change-Id: I40d1d909aec8bd9430fada68ce8ceec234c0ec88
2025-08-28 19:28:55 +00:00
Bruno Martins
25f925f7a9 hidl: Disable LiveDisplay HIDL
Will be migrated at a later stage. Just to unbreak things.

Change-Id: I0759ed5355c49c27718f4f1485b59ffd7ee7fdd3
2025-08-19 09:53:13 +00:00
Nolen Johnson
38094acf43 hidl: Kill fastcharge
Change-Id: I22a8ac6ec2721f86e4508f072bf728d4b216ed2a
2025-08-17 15:39:41 +01:00
Bruno Martins
2ea1e8f703 livedisplay: Move header files
Change-Id: Ica06ba4e2f343095ee2b319663aac7fad8b2513e
2025-08-17 15:36:10 +01:00
Bruno Martins
e3d545c8da livedisplay: Run clang-format
Change-Id: Ifab3fbbe151d5421468f458d88dc077e1def0941
2025-08-17 13:18:55 +01:00
Bruno Martins
a44a822af0 livedisplay: Use filegroups and merge cc_defaults
Change-Id: I1eeb27fcfd027cc4967b7c612767f58ee0653d67
2025-08-17 10:16:35 +01:00
Atakan
e3839f6b7b ril: sehradiomanager: Start Binder threadpool
Sehradiomanager fails to start if we do not call startThreadPool().

This reverts commit 6c6f615011 partially.

Change-Id: Idea7822aa80c7106d7c32365df84b2ac2997cd6d
2025-08-16 17:44:11 +00:00
LineageOS Infra
357a8e58ca Automatic translation import
Change-Id: I425badfc5312cd0f62b1b5f3f669807f7ab8fbce
2025-08-15 18:36:40 +00:00
Atakan
7ef731eaa4 CameraProvider: Init SEC CameraHardware module if UniHAL is present
Change-Id: I0c51e9703dba6a370c1ea4e8b4096ed8f8ca8119
2025-08-15 10:31:38 +00:00
Atakan
6c6f615011 treewide: Fix Binder ThreadPool initialization warnings
According to ProcessState:
- Any process requesting more than 0 threads must call startThreadPool, otherwise it will be set to zero.
- Any process requesting 0 threads must not call startThreadPool.

Change-Id: Ia055cfa2dc845aa97cb88d6de9127535a58c664d
2025-08-15 08:07:18 +00:00
Atakan
6814d040e7 livedisplay: Remove system variants of the services
Change-Id: Iabad087db61bcde84f895535ef0587f3fd112bc6
2025-08-11 12:02:34 +00:00
LineageOS Infra
e4c91fae34 Automatic translation import
Change-Id: I1320a38fe832fc158b2f5194f6372cd31d94b793
2025-08-01 21:13:42 +00:00
Bruno Martins
60c28a403e touch: Migrate to AIDL
Change-Id: Ie0c2dd615652e80032393b04112fc39803205814
2025-07-22 10:12:37 +00:00
Bruno Martins
466bdfd7f9 touch: Use pragma once directive
Change-Id: I3a3404a0ffa8ae9da845ba422adc0ff2ab0590ef
2025-07-22 10:12:37 +00:00
LineageOS Infra
e79e9239e1 Automatic translation import
Change-Id: I910faf4efd4b7dd5480e59eef94e3b8130a39df7
2025-07-15 17:08:20 +00:00
freetolga
7775731b3f aidl: fingerprint: Make the HAL late_start
On s5e9945, the stock service is late_start, deferring the
initialization. Starting it too early makes the sensor fail.

Change-Id: Ife229846a4ba8401169d2274bd9aba2cb6302abf
2025-07-09 13:14:13 +00:00
Salvo Giangreco
0eb9d4c527 ril: secril_config_svc: add missing fallback props
Change-Id: I81069a5ed22e6603b4123305c3c099bd3f494fea
2025-07-08 15:26:52 +00:00
borbelyvince
20a7e57a5a aidl: vibrator: Add support for ff devices
Change-Id: I4333b5ff442ccac097a2c9913985fe3672a1edff
2025-07-07 20:05:54 +00:00
Atakan
b8abadb785 powershare: Set permissions for default powershare nodes
Change-Id: I94da658672b7fb02fccc2df6e6106aef1366f345
2025-05-10 12:53:48 +00:00
Bruno Martins
8e2b9ef1d7 powershare: Migrate to AIDL
Change-Id: I2ae661bf0069c7f1dbed3f5be4275efb9b763352
2025-05-10 11:48:31 +00:00
LineageOS Infra
1b790d2d48 Automatic translation import
Change-Id: I7255ce2fbc7a9bfccc1577f66017d1be563f3aa9
2025-05-01 16:33:18 +00:00
Mashopy
aa75d8dbca samsung: Run bpfix
Change-Id: Ida4dd24167f0f15b1e67a3ae3f73454caa4e1f6e
2025-04-25 10:11:41 +01:00
Bruno Martins
0654e55600 vintf: Mark all HALs as optional
Change-Id: Ic00e778bd4e60c7ba1b3e4d2a25f79bca8277cfc
2025-04-21 00:00:49 +01:00
LineageOS Infra
20ba9e3a9f Automatic translation import
Change-Id: I5b935bfa6d69df95f7fb39f85667b393131de79e
2025-04-15 13:55:18 +00:00
Atakan
21ca8468cd vintf: Add AIDL entry for nfc
Change-Id: I9716630692145d529429859dd4933acf48af787c
2025-04-12 14:58:34 +03:00
LineageOS Infra
9ce1aad47c Automatic translation import
Change-Id: I0332188de0ab07d1bb361eec28d5cd5ae70181c4
2025-04-07 16:25:24 +00:00
Arian
6f507d907d sensors: Implement udfps long press sensor
Change-Id: I49773535f47c538b1ff210245109dd63c18d32cb
2025-03-28 19:10:45 +00:00
Arian
c2b048b0ba sensors: Let the reading of poll fd be configurable
Change-Id: I554a238c11a87d89687b60d3f39446c8f2ff7e2a
2025-03-28 14:37:33 +03:00
Cosmin Tanislav
a05c5586d6 sensors: Create sysfs polling one shot sensor
Change-Id: Ie78d7729201836bacd65a57f76e22adb61159192
2025-03-25 22:12:22 +03:00
Cosmin Tanislav
e768dfd9e7 sensors: Fix locking around setOperationMode and activate
Change-Id: I9a09f45f012662c8f92fa40da3a4b9dd691a1b2c
2025-03-25 22:12:22 +03:00
Cosmin Tanislav
e084eb593f sensors: Move one shot sensor out of main class
Change-Id: Ib7ac0c55409f2dc7f8fb114167e9f4b2e8859223
2025-03-25 22:12:22 +03:00
Cosmin Tanislav
f66e03c015 sensors: Make sensor set mode operation function virtual
Change-Id: I62c94a6ad250417162cfc9eaca8cb490ce650d9c
2025-03-25 22:12:22 +03:00
Cosmin Tanislav
fca7d19da0 sensors: Make sensor flush function virtual
Change-Id: I46532fc726d9e0c2073100ff1f6008fcde9e821c
2025-03-25 22:12:22 +03:00
Cosmin Tanislav
c6c9c0a95d sensors: Make sensor run function virtual
Change-Id: Ie50900903bbf4a302baff084f229c37c5c324742
2025-03-25 22:12:22 +03:00
Cosmin Tanislav
0160b1d635 sensors: Make sensor batch function virtual
Change-Id: I2de1e919234c4893b0b70390c0189cae38dbbe6c
2025-03-25 22:12:22 +03:00
Cosmin Tanislav
7970b54542 Add dummy sensors sub HAL
Change-Id: Ie20ed775344990de3e16e2eefba1754d831027fb
2025-03-25 22:12:22 +03:00
Haky86
7b96104345 vintf: Import common entries for Universal8825 platform
Change-Id: Ib4d2eff621d304bd73e5159ae2ffca1f3c0b6e22
2025-03-17 19:18:31 +00:00
Bruno Martins
c562f5037c hidl: keymaster: Convert to blueprint
Retained order of dependencies as per commit 0ba76af24d.

Change-Id: Id59ec33635e955c554aa1e913c30ef2f1b1a7c24
2025-03-12 22:20:53 +00:00
Daniel Zheng
e039a221cf Revert^2 "SensorHAL: add moisture detection"
919258a5867165de9abe377f30a0b7a8fc9a2c99

Change-Id: I351625927ce9259967218565abaf56035e97674a
2025-03-12 21:09:49 +00:00
Tim Zimmermann
86d3d9e494 aidl: sensors: Use multihal sources directly from hardware/interfaces
* Possible after 5a856698db

Change-Id: I7b4beaf08327431740ab24dd651bc133bdf65cf1
2025-03-11 05:33:07 +01:00
matthuang
40267448b8 Add group 'uhid' to AIDL sensors multi-HAL
Allow sensor hal to send SW_LID event through HID transport
drivers when hall_effect event is detected.

Bug: 262056923
Test: Build pass.
Change-Id: I9b583df6090a5e415abac7bef4bc3b7d28c31b8f
2025-03-11 05:33:07 +01:00
Roy Luo
9e92719095 Usb compliance warning extension
Add new warnings to enum ComplianceWarning

Test: atest VtsAidlUsbTargetTest
Bug: 296119135
Bug: 300340959
Change-Id: I5dcfe50285589d35dd2a2ab87020de8e2b92c181
2025-03-11 05:33:07 +01:00
RD Babiera
1a82c7b700 Usb DisplayPort alt mode aidl interfaces
Adds enums for DisplayPortAltModeStatus and DisplayPortAltModePinAssignment.
Adds AltModeData and DisplayPortAltModeData.
Updates PortStatus to reflect these new enums and parcelables.

Test: atest VtsAidlUsbTargetTest
Bug: 253534975
Change-Id: I0fc62601dfc162b909e796586110686beed137ea
2025-03-11 05:33:07 +01:00
RD Babiera
8f880d69b0 Usb non-compliant port partner aidl extension
Adds aidl api definitions for notifying if the plugged Type-C
port partner (power source/accessory/cable) is non-compliant
with type-c power delivery specification. PortStatus is extended to have
a boolean that states whether or not this feature is supported as well
as an array for a new enum ComplianceWarning.

Test: atest VtsAidlUsbTargetTest
new test nonCompliantChargerStatus expects expects array to be empty
when the feature is not supported. new test nonCompliantChargerValues
expects any values in array to be in range of ComplianceWarning enums
if feature is supported.

Bug: 236322506
Change-Id: Ie3c2365e7c713327b44421c4d132b321d0e03d5f
2025-03-11 05:33:07 +01:00
Bruno Martins
931340ff18 ril: Remove outdated libsecril-client and libsecril-client-sap
Change-Id: I640541b3c765103d7a0355805540771a07fc09ea
2025-03-09 20:59:58 +00:00
Bruno Martins
6a8f052b13 ril: Remove custom libril
No one is using this anymore.

Change-Id: I75b14bd23cfc0da8471dbdbde0f1ee63232d84b3
2025-03-09 20:59:58 +00:00
Bruno Martins
bd98acb3f6 Remove legacy audio HAL
Change-Id: Ic870caaf1dee035eefe80c5ef52b19c5cc3c66af
2025-03-09 20:59:58 +00:00
Bruno Martins
f578c79f84 Nuke macloader, modemloader and wifiloader
Change-Id: I0c0bcd45e5af9c98115c12a757acaebb58b10148
2025-03-09 20:59:58 +00:00
Tim Zimmermann
e77198f821 aidl: Remove thermal HAL
* Pixel thermal HAL can now be used directly

Change-Id: Ied8350355b819453e84026585f47e097d3f502f5
2025-03-09 19:41:38 +00:00
Thomas Turner
2490de1f76 AdvancedDisplay: res: Correct file permissions
Change-Id: I9ba608be3e32b7767610c69b1fc24c9f83517f9d
2025-03-09 14:39:17 +00:00
Thomas Turner
dc3b4b368a ril: Fix source file permissions
Change-Id: I104ee3b7767cfaebfc07432894b422a1d9c35df5
2025-03-09 14:39:14 +00:00
Tim Zimmermann
dc6fc85dbc aidl: light: Update to V2
Change-Id: I126448662234741a158f41ebdc1577e9c3a44816
2025-03-09 00:04:27 +00:00
Atakan
635168b492 libsecril-client: Turn into a vendor module
Change-Id: Ic15a50f9e79a230af0c517ec595b92919aa8ff59
2025-03-08 22:25:05 +00:00
Bruno Martins
92ba912eaa vintf: Add additional entries for bluetooth/gnss/nfc/vaultkeeper
Change-Id: I5ca2e578f44de95786bbc5c8e79c0f8fb0a568c4
2025-03-08 22:22:48 +00:00
Ying Wang
24a95a3347 ril: Cleanup Obsolete LOCAL_PRELINK_MODULE.
Bug: 18675947
Change-Id: Idbf25db61cecb2016a506b75028ce675f6e5294b
2025-03-08 22:19:05 +00:00
LineageOS Infra
7516bae991 Automatic translation import
Change-Id: I5a5d3f67522cf3e076084497d679000665a20975
2025-02-15 15:47:19 +00:00
Tim Zimmermann
a6cc5c543d aidl: Add missing vintf version entries
* This is required for devices using a target-level that actually
  has these HALs in their compatibility matrix

Change-Id: I29cba455ab92e7708ece405bb29ea1c46e46cf41
2025-02-04 10:04:42 +00:00
LineageOS Infra
8fdab0127b Automatic translation import
Change-Id: Ifebaf51208d113fc16997e7ef62b7db4d6d64093
2025-02-01 14:28:34 +00:00
Michael Bestas
c50248a1ac Remove unused multimedia sources
This code hasn't been touched since 2016 and is not included in the
main Android.mk

Change-Id: I2f457abe5b9ba6de287af1c3d21c9e241e5d624c
2025-01-26 13:41:22 +02:00
Michael Bestas
2f7d0cf7c0 Remove exynos4 support
This code hasn't been touched since 2016 and exynos4 is not shipping

Change-Id: Icd5f01e49e483f8f21c87dd7a4ab7736aeb36742
2025-01-26 13:38:17 +02:00
Michael Bestas
838f6c7a0c Remove exynos3 support
This code hasn't been touched since 2014 and exynos3 is not shipping

Change-Id: If33b21427dfc613fffc36d1c1d53267568cf17fb
2025-01-26 13:21:27 +02:00
LuK1337
833a0b62b4 hidl: camera: Add libbase to provider 2.4 deps
Reference: I13a3bd186e7fc48e797e3c6f9039a1dae1fb733f
Change-Id: Idec64ba8b79cb910e88bc3f31081b9e42123d24a
2025-01-07 08:34:59 +01:00
borbelyvince
d218757325 fixup fingerprint: Use soong config instead of kernel headers
The previous naming was misleading

Change-Id: I2969b5f1097eeea791aa6f2a5a32aca8148862a1
2024-12-30 20:02:48 +01:00
Tim Zimmermann
ad61fd8001 fingerprint: Use soong config instead of kernel headers
* This way it also becomes usable for exynos devices.

Change-Id: I56793fdb63bf6e2542caa1f6da68ba57ccf85b0e
2024-12-30 14:25:18 +00:00
Bruno Martins
9fbc3a3667 samsung: Run bpfix
Change-Id: Ic7f98ed28a7b42e70c62768a9a1672544893a970
2024-12-30 14:24:39 +00:00
borbelyvince
f7b6bc1a81 aidl/sensors: Implement wrapper for waiting for MCU startup
Change-Id: Id6194013a0161a5acbcca7851722f3022e4e1d94
2024-12-29 13:14:10 +01:00
Nolen Johnson
c4c9b3520c Revert "fingerprint: Use device kernel headers"
This reverts commit dca8ebaf57.

Reason: Breaks pixel build when this repo is synced.
Change-Id: Iaf9158b1968671b865a531074931d1b94e70ff47
2024-12-20 21:25:32 -05:00
Atakan
dca8ebaf57 fingerprint: Use device kernel headers
Change-Id: I92b3822f28c87117c52ab6fcdfcf52a48426a246
2024-12-18 20:21:07 +03:00
Michael Benedict
b22e45c386 fingerprint: add additional gralloc bits for FOD
Signed-off-by: Michael Benedict <michaelbt@live.com>
Change-Id: I57b8ee4bc0878f040e5bd9d4aa697607bdabe90a
2024-12-18 16:58:03 +00:00
pjgowtham
02dbe51831 fingerprint: Set dim layer zOrder
Requires: I367b2c395aeb8cb7cb9e3cc38eca98477befe007
Change-Id: I881db78186fa9c7b350e79ac4ef90f53ee4cfbcf
2024-12-18 16:58:03 +00:00
LuK1337
f42484e931 fingerprint: Fix sde_drm.h include path on 5.4+ kernel
Change-Id: Idac59471ae329eabf8484cc1238c35dabaa64827
2024-12-18 16:58:03 +00:00
Abhishek Aggarwal
082a0b2810 fingerprint: Add surfaceflinger extension lib
Change-Id: I51fb56c0a20e3cac83afb46ed6a6e2f967159d18
2024-12-18 16:58:03 +00:00
LineageOS Infra
ac076a6da3 Automatic translation import
Change-Id: I9917a89e0cb147fbd986c60fc57c7e94c3e80731
2024-12-16 06:29:58 +00:00
LineageOS Infra
dbf51b317c Automatic translation import
Change-Id: I8b724f304475273b180d3143909e83b4e5a808e9
2024-12-02 02:54:16 +00:00
LineageOS Infra
6b55511e98 Automatic translation import
Change-Id: Ib7a2631e004cc80b9c4d560254e206f5bd5410ef
2024-11-16 06:48:06 +00:00
Ryan Prichard
bdf34c8aa4 aidl: light: Add missing <functional> includes
The new libc++ omits some transitive includes, triggering build
failures in places that don't include the headers they need.

Bug: 175635923
Change-Id: I0d4918f292f05286cfd3547e50b4e37ab2780bd0
2024-10-28 07:11:12 +00:00
LineageOS Infra
9f252a234a Automatic translation import
Change-Id: If495588f6fe7648d762e67ac30df1ec5e8d2179a
2024-09-15 16:02:27 +00:00
774 changed files with 6080 additions and 170242 deletions

View File

@@ -1 +0,0 @@
../../build/soong/scripts/system-clang-format

13
.clang-format Normal file
View File

@@ -0,0 +1,13 @@
BasedOnStyle: Google
Standard: Cpp11
AccessModifierOffset: -2
AllowShortFunctionsOnASingleLine: Inline
ColumnLimit: 100
CommentPragmas: NOLINT:.*
DerivePointerAlignment: false
IncludeBlocks: Preserve
IndentWidth: 4
ContinuationIndentWidth: 8
PointerAlignment: Left
TabWidth: 4
UseTab: Never

13
.github/workflows/build/action.yml vendored Normal file
View File

@@ -0,0 +1,13 @@
name: build
runs:
using: composite
steps:
- name: Install dependencies
shell: bash
run: pip install pre-commit
- name: Lint
shell: bash
run: pre-commit run --all

38
.github/workflows/gerrit.yml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: gerrit checks
on:
workflow_dispatch:
inputs:
ref:
type: string
gerrit-ref:
type: string
change:
type: string
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: lineageos-infra/fetch-gerrit-change@main
with:
gerrit-ref: ${{ inputs.gerrit-ref }}
ref: ${{ inputs.ref }}
- name: Check if build/action.yml exists
id: check
run: |
if [ -f ./.github/workflows/build/action.yml ]; then
echo "run=1" >> "$GITHUB_OUTPUT"
fi
- name: Build
if: ${{ steps.check.outputs.run }}
uses: ./.github/workflows/build
- uses: lineageos-infra/gerrit-vote@main
if: ${{ steps.check.outputs.run && always() }}
with:
auth: ${{ secrets.GERRIT_VOTE_CREDS }}
change: ${{ inputs.change }}
ref: ${{ inputs.ref }}

20
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,20 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v21.1.8
hooks:
- id: clang-format
types_or: [c, c++]
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.15.0
hooks:
- id: pretty-format-kotlin
args: [--autofix, --ktfmt, --ktfmt-style=kotlinlang]

View File

@@ -8,7 +8,7 @@ android_app {
name: "AdvancedDisplay",
srcs: ["src/**/*.java"],
resource_dirs: ["res"],
certificate: "platform",
platform_apis: true,

View File

@@ -27,6 +27,9 @@
<meta-data
android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.display" />
<meta-data
android:name="com.android.settings.group_key"
android:value="category_key_color" />
<meta-data
android:name="com.android.settings.summary"
android:value="@string/summary_empty" />

View File

@@ -1,5 +1,3 @@
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keep class ** extends android.support.v14.preference.PreferenceFragment

1
AdvancedDisplay/res/layout/framelayout.xml Executable file → Normal file
View File

@@ -2,4 +2,3 @@
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" />

View File

@@ -21,8 +21,8 @@
<string name="screen_colors_title">Rənglər</string>
<string name="mdnie_scenario_title_head">Ekran rejimi</string>
<string name="mdnie_scenario_summary_head">mDNle ssenarisini ayarla</string>
<string name="mdnie_accessibility_title_head">Əlçatımlılıq rejimi</string>
<string name="mdnie_accessibility_summary_head">mDNIe əlçatımlılıq rejimini ayarla</string>
<string name="mdnie_accessibility_title_head">Erişiləbilənlik rejimi</string>
<string name="mdnie_accessibility_summary_head">mDNIe erişiləbilənlik rejimini ayarla</string>
<string name="mdnie_scenario_ui">LineageOS (ilkin)</string>
<string name="mdnie_scenario_video">Video</string>
<string name="mdnie_scenario_video_warm">Video - isti</string>

View File

@@ -16,7 +16,6 @@
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Налады экрана</string>
<string name="category_screen_title">Экран</string>
<string name="screen_colors_title">Колеры</string>
<string name="mdnie_scenario_video_warm">Відэа (цёплыя тоны)</string>
@@ -26,6 +25,7 @@
<string name="mdnie_scenario_vt">Відэавыклік</string>
<string name="mdnie_scenario_browser">Браўзер</string>
<string name="mdnie_scenario_tdmb">Лічбавае тэлебачанне</string>
<string name="mdnie_accessibility_normal">Звычайны</string>
<string name="mdnie_accessibility_inverse">Інвертаваны</string>
<string name="mdnie_accessibility_color_blind">Дальтанізм</string>
<string name="mdnie_accessibility_grayscale">Шэры</string>

View File

@@ -33,5 +33,12 @@
<string name="mdnie_scenario_vt">Videollamada</string>
<string name="mdnie_scenario_browser">Navegador</string>
<string name="mdnie_scenario_ebook">Libro electrónico</string>
<string name="mdnie_scenario_email">Correo electrónico</string>
<string name="mdnie_scenario_tdmb">Televisión digital</string>
<string name="mdnie_accessibility_normal">Normal</string>
<string name="mdnie_accessibility_inverse">Invertido</string>
<string name="mdnie_accessibility_color_blind">Daltonismo</string>
<string name="mdnie_accessibility_screen_curtain">Cortina de pantalla</string>
<string name="mdnie_accessibility_grayscale">Gris</string>
<string name="mdnie_accessibility_gray_negative">Gris invertido</string>
</resources>

View File

@@ -21,4 +21,24 @@
<string name="screen_colors_title">رنگ‌ها</string>
<string name="mdnie_scenario_title_head">خط مشی</string>
<string name="mdnie_scenario_summary_head">تنظیم خط مشی mDNIe</string>
<string name="mdnie_accessibility_title_head">حالت دسترسی</string>
<string name="mdnie_accessibility_summary_head">تنظیم حالت دسترسی mDNIe</string>
<string name="mdnie_scenario_ui">LineageOS (پیش فرض)</string>
<string name="mdnie_scenario_video">ویدئو</string>
<string name="mdnie_scenario_video_warm">ویدئو گرم</string>
<string name="mdnie_scenario_video_cold">ویدئو سرد</string>
<string name="mdnie_scenario_camera">دوربین</string>
<string name="mdnie_scenario_navigation">پیمایش</string>
<string name="mdnie_scenario_gallery">گالری</string>
<string name="mdnie_scenario_vt">تماس تصویری</string>
<string name="mdnie_scenario_browser">مرورگر</string>
<string name="mdnie_scenario_ebook">کتاب</string>
<string name="mdnie_scenario_email">ایمیل</string>
<string name="mdnie_scenario_tdmb">تلویزیون دیجیتال</string>
<string name="mdnie_accessibility_normal">عادی</string>
<string name="mdnie_accessibility_inverse">معکوس</string>
<string name="mdnie_accessibility_color_blind">کور رنگی</string>
<string name="mdnie_accessibility_screen_curtain">پرده صفحه نمایش</string>
<string name="mdnie_accessibility_grayscale">خاکستری</string>
<string name="mdnie_accessibility_gray_negative">خاکستری معکوس</string>
</resources>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2012-2014 The CyanogenMod Project
Copyright (C) 2018 The LineageOS 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.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Taispeáint chun cinn</string>
<string name="category_screen_title">Scáileán</string>
<string name="screen_colors_title">Dathanna</string>
<string name="mdnie_scenario_title_head">Cás</string>
<string name="mdnie_scenario_summary_head">Socraigh an cás mDNIe</string>
<string name="mdnie_accessibility_title_head">Mód inrochtaineachta</string>
<string name="mdnie_accessibility_summary_head">Socraigh modh inrochtaineachta mDNIe</string>
<string name="mdnie_scenario_ui">LineageOS (réamhshocraithe)</string>
<string name="mdnie_scenario_video">Físeán</string>
<string name="mdnie_scenario_video_warm">Físeán te</string>
<string name="mdnie_scenario_video_cold">Físeán fuar</string>
<string name="mdnie_scenario_camera">Ceamara</string>
<string name="mdnie_scenario_navigation">Loingseoireacht</string>
<string name="mdnie_scenario_gallery">Gailearaí</string>
<string name="mdnie_scenario_vt">Glao físe</string>
<string name="mdnie_scenario_browser">Brabhsálaí</string>
<string name="mdnie_scenario_ebook">r-leabhar</string>
<string name="mdnie_scenario_email">R-phost</string>
<string name="mdnie_scenario_tdmb">Teilifís dhigiteach</string>
<string name="mdnie_accessibility_normal">Gnáth</string>
<string name="mdnie_accessibility_inverse">Inbhéartaithe</string>
<string name="mdnie_accessibility_color_blind">Dath dall</string>
<string name="mdnie_accessibility_screen_curtain">Cuirtín scáileáin</string>
<string name="mdnie_accessibility_grayscale">Liath</string>
<string name="mdnie_accessibility_gray_negative">Liath inbhéartaithe</string>
</resources>

View File

@@ -22,6 +22,7 @@
<string name="mdnie_scenario_title_head">תרחיש</string>
<string name="mdnie_scenario_summary_head">הגדר תרחיש mDNIe</string>
<string name="mdnie_accessibility_title_head">מצב נגישות</string>
<string name="mdnie_accessibility_summary_head">הגדרת מצב הנגישות mDNIe</string>
<string name="mdnie_scenario_ui">LineageOS (ברירת מחדל)</string>
<string name="mdnie_scenario_video">וידאו</string>
<string name="mdnie_scenario_video_warm">וידאו חם</string>
@@ -37,4 +38,7 @@
<string name="mdnie_accessibility_normal">רגיל</string>
<string name="mdnie_accessibility_inverse">הפוך</string>
<string name="mdnie_accessibility_color_blind">עיוור צבעים</string>
<string name="mdnie_accessibility_screen_curtain">וילון מסך</string>
<string name="mdnie_accessibility_grayscale">אפור</string>
<string name="mdnie_accessibility_gray_negative">אפור הפוך</string>
</resources>

View File

@@ -20,9 +20,9 @@
<string name="category_screen_title">Tela</string>
<string name="screen_colors_title">Cores</string>
<string name="mdnie_scenario_title_head">Cenário</string>
<string name="mdnie_scenario_summary_head">Defina o cenário mDNIe</string>
<string name="mdnie_scenario_summary_head">Configure o cenário mDNIe</string>
<string name="mdnie_accessibility_title_head">Modo de acessibilidade</string>
<string name="mdnie_accessibility_summary_head">Definir o modo de acessibilidade do mDNIe</string>
<string name="mdnie_accessibility_summary_head">Configure o modo de acessibilidade do mDNIe</string>
<string name="mdnie_scenario_ui">LineageOS (padrão)</string>
<string name="mdnie_scenario_video">Vídeo</string>
<string name="mdnie_scenario_video_warm">Vídeo quente</string>
@@ -32,9 +32,9 @@
<string name="mdnie_scenario_gallery">Galeria</string>
<string name="mdnie_scenario_vt">Chamada de vídeo</string>
<string name="mdnie_scenario_browser">Navegador</string>
<string name="mdnie_scenario_ebook">e-book</string>
<string name="mdnie_scenario_ebook">eBook</string>
<string name="mdnie_scenario_email">E-mail</string>
<string name="mdnie_scenario_tdmb">Televisão digital</string>
<string name="mdnie_scenario_tdmb">TV digital</string>
<string name="mdnie_accessibility_normal">Normal</string>
<string name="mdnie_accessibility_inverse">Invertido</string>
<string name="mdnie_accessibility_color_blind">Daltônico</string>

View File

@@ -16,7 +16,27 @@
limitations under the License.
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="app_name">Ischermu avantzadu</string>
<string name="category_screen_title">Ischermu</string>
<string name="screen_colors_title">Colores</string>
<string name="mdnie_accessibility_title_head">Modalidade de atzessu fatzilitadu</string>
<string name="mdnie_accessibility_summary_head">Cunfigura sa modalidade de atzessu fatzilitadu mDNIe</string>
<string name="mdnie_scenario_ui">LineageOS (predefinidu)</string>
<string name="mdnie_scenario_video">Vìdeu</string>
<string name="mdnie_scenario_video_warm">Tonu vìdeu callente</string>
<string name="mdnie_scenario_video_cold">Tonu vìdeu fritu</string>
<string name="mdnie_scenario_camera">Càmera</string>
<string name="mdnie_scenario_navigation">Navigatzione</string>
<string name="mdnie_scenario_gallery">Galleria</string>
<string name="mdnie_scenario_vt">Mutida de vìdeu</string>
<string name="mdnie_scenario_browser">Navigadore</string>
<string name="mdnie_scenario_ebook">Libru electrònicu</string>
<string name="mdnie_scenario_email">Posta eletrònica</string>
<string name="mdnie_scenario_tdmb">Televisione digitale</string>
<string name="mdnie_accessibility_normal">Normale</string>
<string name="mdnie_accessibility_inverse">Invertidu</string>
<string name="mdnie_accessibility_color_blind">Modalidade daltònica</string>
<string name="mdnie_accessibility_screen_curtain">Modalidade ischermu iscuru</string>
<string name="mdnie_accessibility_grayscale">Murru</string>
<string name="mdnie_accessibility_gray_negative">Murru invertidu</string>
</resources>

View File

@@ -21,4 +21,17 @@
<string name="screen_colors_title">நிறங்கள்</string>
<string name="mdnie_scenario_title_head">சூழ்நிலை</string>
<string name="mdnie_scenario_summary_head">mDNIe சூழ்நிலையை அமை</string>
<string name="mdnie_scenario_ui">LineageOS (இயல்புநிலை)</string>
<string name="mdnie_scenario_video">காணொளி</string>
<string name="mdnie_scenario_camera">படமி</string>
<string name="mdnie_scenario_gallery">தொகுப்பு</string>
<string name="mdnie_scenario_vt">ஒளி அழைப்பு</string>
<string name="mdnie_scenario_browser">உலாவி</string>
<string name="mdnie_scenario_ebook">மின்னூல்</string>
<string name="mdnie_scenario_email">மின்னஞ்சல்</string>
<string name="mdnie_scenario_tdmb"> எண்முறை தொலைக்காட்சி</string>
<string name="mdnie_accessibility_normal">இயல்பு</string>
<string name="mdnie_accessibility_color_blind">நிறக்குருடு</string>
<string name="mdnie_accessibility_screen_curtain">திரை மறைப்பு</string>
<string name="mdnie_accessibility_grayscale">சாம்பல்நிறம்</string>
</resources>

View File

@@ -21,4 +21,24 @@
<string name="screen_colors_title">رەڭلەر</string>
<string name="mdnie_scenario_title_head">كۆرۈنۈش</string>
<string name="mdnie_scenario_summary_head">mDNIe لايىھە تەڭشىكى</string>
<string name="mdnie_accessibility_title_head">ئاجىزلار ھالىتى</string>
<string name="mdnie_accessibility_summary_head">mDNIe نى ئاجىزلار ھالىتىگە تەڭشەيدۇ</string>
<string name="mdnie_scenario_ui">LineageOS (كۆڭۈلدىكى)</string>
<string name="mdnie_scenario_video">سىن</string>
<string name="mdnie_scenario_video_warm">سىن ئىسسىق</string>
<string name="mdnie_scenario_video_cold">سىن سوغۇق</string>
<string name="mdnie_scenario_camera">كامېرا</string>
<string name="mdnie_scenario_navigation">يولباشچى</string>
<string name="mdnie_scenario_gallery">سۈرەتدان</string>
<string name="mdnie_scenario_vt">سىن چاقىرىش</string>
<string name="mdnie_scenario_browser">تور كۆرگۈچ</string>
<string name="mdnie_scenario_ebook">ئې-كىتاب</string>
<string name="mdnie_scenario_email">ئېلخەت</string>
<string name="mdnie_scenario_tdmb">رەقەملىك تېلېۋىزور</string>
<string name="mdnie_accessibility_normal">ئادەتتىكى</string>
<string name="mdnie_accessibility_inverse">تەتۈر</string>
<string name="mdnie_accessibility_color_blind">رەڭ قارىغۇسى</string>
<string name="mdnie_accessibility_screen_curtain">ئېكران توسۇش</string>
<string name="mdnie_accessibility_grayscale">كۈلرەڭ</string>
<string name="mdnie_accessibility_gray_negative">ئەكسى كۈلرەڭ</string>
</resources>

View File

@@ -25,7 +25,7 @@ public class AdvancedDisplayActivity extends CollapsingToolbarBaseActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getFragmentManager().beginTransaction().replace(
getSupportFragmentManager().beginTransaction().replace(
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
new AdvancedDisplayFragment()).commit();
}

View File

@@ -19,19 +19,19 @@ package org.lineageos.settings.device;
import android.content.res.Resources;
import android.os.Bundle;
import androidx.preference.PreferenceFragment;
import androidx.preference.PreferenceFragmentCompat;
import org.lineageos.settings.device.R;
import org.lineageos.internal.util.FileUtils;
public class AdvancedDisplayFragment extends PreferenceFragment {
public class AdvancedDisplayFragment extends PreferenceFragmentCompat {
private mDNIeScenario mmDNIeScenario;
private mDNIeAccessibility mmDNIeAccessibility;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
addPreferencesFromResource(R.xml.screen_preferences);
setPreferencesFromResource(R.xml.screen_preferences, rootKey);
Resources res = getResources();
/* mDNIe */

View File

@@ -1,43 +0,0 @@
# Copyright (C) 2012 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.
SAM_ROOT := $(call my-dir)
# Exynos 4
ifeq ($(TARGET_BOARD_PLATFORM),exynos4)
ifeq ($(TARGET_SOC),exynos4210)
include $(SAM_ROOT)/exynos4210.mk
endif
ifeq ($(TARGET_SOC),exynos4x12)
include $(SAM_ROOT)/exynos4x12.mk
endif
endif
# Exynos 3
ifeq ($(TARGET_BOARD_PLATFORM),s5pc110)
include $(SAM_ROOT)/s5pc110.mk
endif
# Wifi
ifeq ($(BOARD_HAVE_SAMSUNG_WIFI),true)
include $(SAM_ROOT)/macloader/Android.mk
include $(SAM_ROOT)/wifiloader/Android.mk
endif
ifeq ($(BOARD_VENDOR),samsung)
include $(SAM_ROOT)/audio/Android.mk
include $(SAM_ROOT)/hidl/Android.mk
include $(SAM_ROOT)/modemloader/Android.mk
include $(SAM_ROOT)/ril/Android.mk
endif

View File

@@ -1,10 +1,15 @@
//
// SPDX-FileCopyrightText: 2024-2026 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
cc_library_static {
name: "android.hardware.camera.common-helper.samsung",
vendor_available: true,
defaults: [
"hidl_defaults",
"samsung_camera3_defaults",
],
vendor_available: true,
srcs: [
"CameraModule.cpp",
"CameraMetadata.cpp",
@@ -30,14 +35,9 @@ cc_library_static {
],
include_dirs: ["system/media/private/camera/include"],
header_libs: ["libhardware_headers.camera3_samsung"],
export_include_dirs: ["include", "include_samsung"],
export_include_dirs: [
"include",
"include_samsung",
],
export_shared_lib_headers: ["libui"],
}
// NOTE: Deprecated module kept for compatibility reasons.
// Depend on "android.hardware.camera.common-helper.samsung" instead
cc_library_static {
name: "android.hardware.camera.common@1.0-helper.samsung",
vendor_available: true,
whole_static_libs: ["android.hardware.camera.common-helper.samsung"],
}

View File

@@ -66,13 +66,16 @@ ndk::ScopedAStatus CameraDevice::getCameraCharacteristics(CameraMetadata* _aidl_
struct camera_info info;
int ret = mModule->getCameraInfo(mCameraIdInt, &info);
if (ret == OK && info.static_camera_characteristics != NULL) {
common::helper::CameraMetadata metadata = (camera_metadata_t*)info.static_camera_characteristics;
common::helper::CameraMetadata metadata =
(camera_metadata_t*)info.static_camera_characteristics;
camera_metadata_entry_t entry = metadata.find(ANDROID_FLASH_INFO_AVAILABLE);
if (entry.count > 0 && *entry.data.u8 != 0 && mModule->isSetTorchModeStrengthSupported()) {
if (entry.count > 0 && *entry.data.u8 != 0 &&
mModule->isSetTorchModeStrengthSupported()) {
// Samsung always has 5 supported torch strength levels
int32_t defaultTorchStrength = 1;
int32_t torchStrengthLevels = 5;
metadata.update(ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, &defaultTorchStrength, 1);
metadata.update(ANDROID_FLASH_INFO_STRENGTH_DEFAULT_LEVEL, &defaultTorchStrength,
1);
metadata.update(ANDROID_FLASH_INFO_STRENGTH_MAXIMUM_LEVEL, &torchStrengthLevels, 1);
}

View File

@@ -395,7 +395,7 @@ void CameraDeviceSession::cleanupInflightFences(std::vector<int>& allFences, siz
CameraDeviceSession::ResultBatcher::ResultBatcher(
const std::shared_ptr<ICameraDeviceCallback>& callback)
: mCallback(callback){};
: mCallback(callback) {};
bool CameraDeviceSession::ResultBatcher::InflightBatch::allDelivered() const {
if (!mShutterDelivered) return false;

View File

@@ -1,3 +1,8 @@
//
// SPDX-FileCopyrightText: 2024-2026 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
soong_config_module_type {
name: "samsung_camera3",
module_type: "cc_defaults",

View File

@@ -1573,7 +1573,6 @@ typedef enum camera3_stream_configuration_mode {
* types) see the usage field below.
*/
typedef struct camera3_stream {
/*****
* Set by framework before configure_streams()
*/
@@ -1674,7 +1673,7 @@ typedef struct camera3_stream {
* A handle to HAL-private information for the stream. Will not be inspected
* by the framework code.
*/
void *priv;
void* priv;
/**
* A field that describes the contents of the buffer. The format and buffer
@@ -1760,7 +1759,7 @@ typedef struct camera3_stream {
const char* physical_camera_id;
/* reserved for future use */
void *reserved[6];
void* reserved[6];
#ifdef CAMERA_NEEDS_SEC_RESERVED_FIELD
char reserved_sec[0x28];
@@ -1793,7 +1792,7 @@ typedef struct camera3_stream_configuration {
* At least one output-capable stream must be defined (OUTPUT or
* BIDIRECTIONAL).
*/
camera3_stream_t **streams;
camera3_stream_t** streams;
/**
* >= CAMERA_DEVICE_API_VERSION_3_3:
@@ -1821,7 +1820,7 @@ typedef struct camera3_stream_configuration {
* the parameter values and configure its internal camera pipeline
* accordingly.
*/
const camera_metadata_t *session_parameters;
const camera_metadata_t* session_parameters;
} camera3_stream_configuration_t;
/**
@@ -1858,12 +1857,12 @@ typedef struct camera3_stream_buffer {
/**
* The handle of the stream this buffer is associated with
*/
camera3_stream_t *stream;
camera3_stream_t* stream;
/**
* The native handle to the buffer
*/
buffer_handle_t *buffer;
buffer_handle_t* buffer;
/**
* Current state of the buffer, one of the camera3_buffer_status_t
@@ -1899,7 +1898,7 @@ typedef struct camera3_stream_buffer {
* fences should be handled similarly to the way they are handled for output
* buffers.
*/
int acquire_fence;
int acquire_fence;
/**
* The release sync fence for this buffer. The HAL must set this fence when
@@ -1947,7 +1946,7 @@ typedef struct camera3_stream_buffer_set {
/**
* The stream handle for the stream these buffers belong to
*/
camera3_stream_t *stream;
camera3_stream_t* stream;
/**
* The number of buffers in this stream. It is guaranteed to be at least
@@ -1961,7 +1960,7 @@ typedef struct camera3_stream_buffer_set {
* should inspect the passed-in buffers to determine any platform-private
* pixel format information.
*/
buffer_handle_t **buffers;
buffer_handle_t** buffers;
} camera3_stream_buffer_set_t;
@@ -2105,7 +2104,7 @@ typedef struct camera3_error_msg {
* Pointer to the stream that had a failure. NULL if the stream isn't
* applicable to the error.
*/
camera3_stream_t *error_stream;
camera3_stream_t* error_stream;
/**
* The code for this error; one of the CAMERA_MSG_ERROR enum values.
@@ -2140,7 +2139,6 @@ typedef struct camera3_shutter_msg {
* The message structure sent to camera3_callback_ops_t.notify()
*/
typedef struct camera3_notify_msg {
/**
* The message type. One of camera3_notify_msg_type, or a private extension.
*/
@@ -2166,7 +2164,6 @@ typedef struct camera3_notify_msg {
} camera3_notify_msg_t;
/**********************************************************************
*
* Types definition for request_stream_buffers() callback.
@@ -2278,7 +2275,7 @@ typedef struct camera3_buffer_request {
/**
* The stream HAL wants to request buffer from
*/
camera3_stream_t *stream;
camera3_stream_t* stream;
/**
* The number of buffers HAL requested
@@ -2290,7 +2287,7 @@ typedef struct camera3_stream_buffer_ret {
/**
* The stream HAL wants to request buffer from
*/
camera3_stream_t *stream;
camera3_stream_t* stream;
/**
* The status of buffer request of this stream
@@ -2309,10 +2306,9 @@ typedef struct camera3_stream_buffer_ret {
* Caller of request_stream_buffers() should supply this with enough memory
* (num_buffers_requested * sizeof(camera3_stream_buffer_t))
*/
camera3_stream_buffer_t *output_buffers;
camera3_stream_buffer_t* output_buffers;
} camera3_stream_buffer_ret_t;
/**********************************************************************
*
* Capture request/result definitions for the HAL process_capture_request()
@@ -2410,7 +2406,7 @@ typedef struct camera3_capture_request {
* NULL buffer cannot be used as the first submitted request after a
* configure_streams() call.
*/
const camera_metadata_t *settings;
const camera_metadata_t* settings;
/**
* The input stream buffer to use for this request, if any.
@@ -2436,7 +2432,7 @@ typedef struct camera3_capture_request {
* The buffers will not have been pre-registered with the HAL.
* Subsequent requests may reuse buffers, or provide entirely new buffers.
*/
camera3_stream_buffer_t *input_buffer;
camera3_stream_buffer_t* input_buffer;
/**
* The number of output buffers for this capture request. Must be at least
@@ -2463,7 +2459,7 @@ typedef struct camera3_capture_request {
* Any or all of the buffers included here may be brand new in this
* request (having never before seen by the HAL).
*/
const camera3_stream_buffer_t *output_buffers;
const camera3_stream_buffer_t* output_buffers;
/**
* <= CAMERA_DEVICE_API_VERISON_3_4:
@@ -2488,7 +2484,7 @@ typedef struct camera3_capture_request {
* In case some id is invalid, the process capture request must fail and return
* -EINVAL.
*/
const char **physcam_id;
const char** physcam_id;
/**
* <= CAMERA_DEVICE_API_VERISON_3_4:
@@ -2501,7 +2497,7 @@ typedef struct camera3_capture_request {
* case the settings at some particular index are empty, the process capture
* request must fail and return -EINVAL.
*/
const camera_metadata_t **physcam_settings;
const camera_metadata_t** physcam_settings;
} camera3_capture_request_t;
@@ -2554,7 +2550,7 @@ typedef struct camera3_capture_result {
* submitted request to uniquely identify this capture. It is also used to
* identify the request in asynchronous notifications sent to
* camera3_callback_ops_t.notify().
*/
*/
uint32_t frame_number;
/**
@@ -2582,7 +2578,7 @@ typedef struct camera3_capture_result {
* If notify has been called with ERROR_RESULT, all further partial
* results for that frame are ignored by the framework.
*/
const camera_metadata_t *result;
const camera_metadata_t* result;
/**
* The number of output buffers returned in this result structure. Must be
@@ -2632,84 +2628,84 @@ typedef struct camera3_capture_result {
* via a SHUTTER notify() call. It is highly recommended to
* dispatch that call as early as possible.
*/
const camera3_stream_buffer_t *output_buffers;
const camera3_stream_buffer_t* output_buffers;
/**
* >= CAMERA_DEVICE_API_VERSION_3_2:
*
* The handle for the input stream buffer for this capture. It may not
* yet be consumed at the time the HAL calls process_capture_result(); the
* framework will wait on the release sync fences provided by the HAL before
* reusing the buffer.
*
* The HAL should handle the sync fences the same way they are done for
* output_buffers.
*
* Only one input buffer is allowed to be sent per request. Similarly to
* output buffers, the ordering of returned input buffers must be
* maintained by the HAL.
*
* Performance considerations:
*
* The input buffer should be returned as early as possible. If the HAL
* supports sync fences, it can call process_capture_result to hand it back
* with sync fences being set appropriately. If the sync fences are not
* supported, the buffer can only be returned when it is consumed, which
* may take long time; the HAL may choose to copy this input buffer to make
* the buffer return sooner.
*/
const camera3_stream_buffer_t *input_buffer;
/**
* >= CAMERA_DEVICE_API_VERSION_3_2:
*
* The handle for the input stream buffer for this capture. It may not
* yet be consumed at the time the HAL calls process_capture_result(); the
* framework will wait on the release sync fences provided by the HAL before
* reusing the buffer.
*
* The HAL should handle the sync fences the same way they are done for
* output_buffers.
*
* Only one input buffer is allowed to be sent per request. Similarly to
* output buffers, the ordering of returned input buffers must be
* maintained by the HAL.
*
* Performance considerations:
*
* The input buffer should be returned as early as possible. If the HAL
* supports sync fences, it can call process_capture_result to hand it back
* with sync fences being set appropriately. If the sync fences are not
* supported, the buffer can only be returned when it is consumed, which
* may take long time; the HAL may choose to copy this input buffer to make
* the buffer return sooner.
*/
const camera3_stream_buffer_t* input_buffer;
/**
* >= CAMERA_DEVICE_API_VERSION_3_2:
*
* In order to take advantage of partial results, the HAL must set the
* static metadata android.request.partialResultCount to the number of
* partial results it will send for each frame.
*
* Each new capture result with a partial result must set
* this field (partial_result) to a distinct inclusive value between
* 1 and android.request.partialResultCount.
*
* HALs not wishing to take advantage of this feature must not
* set an android.request.partialResultCount or partial_result to a value
* other than 1.
*
* This value must be set to 0 when a capture result contains buffers only
* and no metadata.
*/
uint32_t partial_result;
/**
* >= CAMERA_DEVICE_API_VERSION_3_2:
*
* In order to take advantage of partial results, the HAL must set the
* static metadata android.request.partialResultCount to the number of
* partial results it will send for each frame.
*
* Each new capture result with a partial result must set
* this field (partial_result) to a distinct inclusive value between
* 1 and android.request.partialResultCount.
*
* HALs not wishing to take advantage of this feature must not
* set an android.request.partialResultCount or partial_result to a value
* other than 1.
*
* This value must be set to 0 when a capture result contains buffers only
* and no metadata.
*/
uint32_t partial_result;
/**
* >= CAMERA_DEVICE_API_VERSION_3_5:
*
* Specifies the number of physical camera metadata this capture result
* contains. It must be equal to the number of physical cameras being
* requested from.
*
* If the current camera device is not a logical multi-camera, or the
* corresponding capture_request doesn't request on any physical camera,
* this field must be 0.
*/
uint32_t num_physcam_metadata;
/**
* >= CAMERA_DEVICE_API_VERSION_3_5:
*
* Specifies the number of physical camera metadata this capture result
* contains. It must be equal to the number of physical cameras being
* requested from.
*
* If the current camera device is not a logical multi-camera, or the
* corresponding capture_request doesn't request on any physical camera,
* this field must be 0.
*/
uint32_t num_physcam_metadata;
/**
* >= CAMERA_DEVICE_API_VERSION_3_5:
*
* An array of strings containing the physical camera ids for the returned
* physical camera metadata. The length of the array is
* num_physcam_metadata.
*/
const char **physcam_ids;
/**
* >= CAMERA_DEVICE_API_VERSION_3_5:
*
* An array of strings containing the physical camera ids for the returned
* physical camera metadata. The length of the array is
* num_physcam_metadata.
*/
const char** physcam_ids;
/**
* >= CAMERA_DEVICE_API_VERSION_3_5:
*
* The array of physical camera metadata for the physical cameras being
* requested upon. This array should have a 1-to-1 mapping with the
* physcam_ids. The length of the array is num_physcam_metadata.
*/
const camera_metadata_t **physcam_metadata;
/**
* >= CAMERA_DEVICE_API_VERSION_3_5:
*
* The array of physical camera metadata for the physical cameras being
* requested upon. This array should have a 1-to-1 mapping with the
* physcam_ids. The length of the array is num_physcam_metadata.
*/
const camera_metadata_t** physcam_metadata;
} camera3_capture_result_t;
@@ -2726,7 +2722,6 @@ typedef struct camera3_capture_result {
*
*/
typedef struct camera3_callback_ops {
/**
* process_capture_result:
*
@@ -2794,8 +2789,8 @@ typedef struct camera3_callback_ops {
* 4 frame intervals, and must be less than or equal to 8 frame intervals.
*
*/
void (*process_capture_result)(const struct camera3_callback_ops *,
const camera3_capture_result_t *result);
void (*process_capture_result)(const struct camera3_callback_ops*,
const camera3_capture_result_t* result);
/**
* notify:
@@ -2827,8 +2822,7 @@ typedef struct camera3_callback_ops {
*
* This is a non-blocking call. The framework will return this call in 5ms.
*/
void (*notify)(const struct camera3_callback_ops *,
const camera3_notify_msg_t *msg);
void (*notify)(const struct camera3_callback_ops*, const camera3_notify_msg_t* msg);
/**
* request_stream_buffers:
@@ -2864,11 +2858,10 @@ typedef struct camera3_callback_ops {
* ready to fill the buffer.
*/
camera3_buffer_request_status_t (*request_stream_buffers)(
const struct camera3_callback_ops *,
uint32_t num_buffer_reqs,
const camera3_buffer_request_t *buffer_reqs,
/*out*/uint32_t *num_returned_buf_reqs,
/*out*/camera3_stream_buffer_ret_t *returned_buf_reqs);
const struct camera3_callback_ops*, uint32_t num_buffer_reqs,
const camera3_buffer_request_t* buffer_reqs,
/*out*/ uint32_t* num_returned_buf_reqs,
/*out*/ camera3_stream_buffer_ret_t* returned_buf_reqs);
/**
* return_stream_buffers:
@@ -2884,10 +2877,8 @@ typedef struct camera3_callback_ops {
* If this method is called during a configure_streams() call, it will be
* blocked until camera service finishes the ongoing configure_streams() call.
*/
void (*return_stream_buffers)(
const struct camera3_callback_ops *,
uint32_t num_buffers,
const camera3_stream_buffer_t* const* buffers);
void (*return_stream_buffers)(const struct camera3_callback_ops*, uint32_t num_buffers,
const camera3_stream_buffer_t* const* buffers);
} camera3_callback_ops_t;
@@ -2897,7 +2888,6 @@ typedef struct camera3_callback_ops {
*
*/
typedef struct camera3_device_ops {
/**
* initialize:
*
@@ -2917,8 +2907,7 @@ typedef struct camera3_device_ops {
* -ENODEV: If initialization fails. Only close() can be called successfully
* by the framework after this.
*/
int (*initialize)(const struct camera3_device *,
const camera3_callback_ops_t *callback_ops);
int (*initialize)(const struct camera3_device*, const camera3_callback_ops_t* callback_ops);
/**********************************************************************
* Stream management
@@ -3156,8 +3145,8 @@ typedef struct camera3_device_ops {
* operational. Only close() can be called successfully by the
* framework after this error is returned.
*/
int (*configure_streams)(const struct camera3_device *,
camera3_stream_configuration_t *stream_list);
int (*configure_streams)(const struct camera3_device*,
camera3_stream_configuration_t* stream_list);
/**
* register_stream_buffers:
@@ -3210,8 +3199,8 @@ typedef struct camera3_device_ops {
* operational. Only close() can be called successfully by the
* framework after this error is returned.
*/
int (*register_stream_buffers)(const struct camera3_device *,
const camera3_stream_buffer_set_t *buffer_set);
int (*register_stream_buffers)(const struct camera3_device*,
const camera3_stream_buffer_set_t* buffer_set);
/**********************************************************************
* Request creation and submission
@@ -3246,9 +3235,8 @@ typedef struct camera3_device_ops {
* the close() method can be called successfully by the
* framework.
*/
const camera_metadata_t* (*construct_default_request_settings)(
const struct camera3_device *,
int type);
const camera_metadata_t* (*construct_default_request_settings)(const struct camera3_device*,
int type);
/**
* process_capture_request:
@@ -3316,8 +3304,8 @@ typedef struct camera3_device_ops {
* called by the framework.
*
*/
int (*process_capture_request)(const struct camera3_device *,
camera3_capture_request_t *request);
int (*process_capture_request)(const struct camera3_device*,
camera3_capture_request_t* request);
/**********************************************************************
* Miscellaneous methods
@@ -3338,8 +3326,7 @@ typedef struct camera3_device_ops {
* NULL by the HAL. Please implement get_vendor_tag_ops in camera_common.h
* instead.
*/
void (*get_metadata_vendor_tag_ops)(const struct camera3_device*,
vendor_tag_query_ops_t* ops);
void (*get_metadata_vendor_tag_ops)(const struct camera3_device*, vendor_tag_query_ops_t* ops);
/**
* dump:
@@ -3359,7 +3346,7 @@ typedef struct camera3_device_ops {
* Any synchronization primitives used (such as mutex locks or semaphores)
* should be acquired with a timeout.
*/
void (*dump)(const struct camera3_device *, int fd);
void (*dump)(const struct camera3_device*, int fd);
/**
* flush:
@@ -3432,10 +3419,10 @@ typedef struct camera3_device_ops {
* need to call process_capture_result with NULL metadata or equivalent.
*
* 4. If a flush() is invoked while a process_capture_request() invocation is active, that
* process call should return as soon as possible. In addition, if a process_capture_request()
* call is made after flush() has been invoked but before flush() has returned, the
* capture request provided by the late process_capture_request call should be treated like
* a pending request in case #2 above.
* process call should return as soon as possible. In addition, if a
* process_capture_request() call is made after flush() has been invoked but before flush() has
* returned, the capture request provided by the late process_capture_request call should be
* treated like a pending request in case #2 above.
*
* flush() should only return when there are no more outstanding buffers or
* requests left in the HAL. The framework may call configure_streams (as
@@ -3465,7 +3452,7 @@ typedef struct camera3_device_ops {
* error is returned, only the close() method can be successfully
* called by the framework.
*/
int (*flush)(const struct camera3_device *);
int (*flush)(const struct camera3_device*);
/**
* signal_stream_flush:
@@ -3487,9 +3474,8 @@ typedef struct camera3_device_ops {
* skip calling this if all buffers are already returned.
*
*/
void (*signal_stream_flush)(const struct camera3_device*,
uint32_t num_streams,
const camera3_stream_t* const* streams);
void (*signal_stream_flush)(const struct camera3_device*, uint32_t num_streams,
const camera3_stream_t* const* streams);
/**
* is_reconfiguration_required:
@@ -3538,11 +3524,11 @@ typedef struct camera3_device_ops {
* reconfiguration query.
*/
int (*is_reconfiguration_required)(const struct camera3_device*,
const camera_metadata_t* old_session_params,
const camera_metadata_t* new_session_params);
const camera_metadata_t* old_session_params,
const camera_metadata_t* new_session_params);
/* reserved for future use */
void *reserved[6];
void* reserved[6];
} camera3_device_ops_t;
/**********************************************************************
@@ -3563,8 +3549,8 @@ typedef struct camera3_device {
*
*/
hw_device_t common;
camera3_device_ops_t *ops;
void *priv;
camera3_device_ops_t* ops;
void* priv;
} camera3_device_t;
__END_DECLS

View File

@@ -19,15 +19,15 @@
#ifndef ANDROID_INCLUDE_CAMERA_COMMON_H
#define ANDROID_INCLUDE_CAMERA_COMMON_H
#include <stdint.h>
#include <cutils/native_handle.h>
#include <hardware/gralloc.h>
#include <hardware/hardware.h>
#include <stdbool.h>
#include <stdint.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <cutils/native_handle.h>
#include <system/camera.h>
#include <system/camera_vendor_tags.h>
#include <hardware/hardware.h>
#include <hardware/gralloc.h>
__BEGIN_DECLS
@@ -36,6 +36,11 @@ __BEGIN_DECLS
*/
#define CAMERA_HARDWARE_MODULE_ID "camera"
/**
* The id of Samsung UniHAL module
*/
#define SEC_CAMERA_HARDWARE_MODULE_ID "camera.unihal"
/**
* Module versioning information for the Camera hardware module, based on
* camera_module_t.common.module_api_version. The two most significant hex
@@ -157,11 +162,11 @@ __BEGIN_DECLS
* All device versions <= HARDWARE_DEVICE_API_VERSION(1, 0xFF) must be treated
* as CAMERA_DEVICE_API_VERSION_1_0
*/
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_1_0 HARDWARE_DEVICE_API_VERSION(1, 0) // DEPRECATED
#define CAMERA_DEVICE_API_VERSION_2_0 HARDWARE_DEVICE_API_VERSION(2, 0) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_2_1 HARDWARE_DEVICE_API_VERSION(2, 1) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_3_0 HARDWARE_DEVICE_API_VERSION(3, 0) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_3_1 HARDWARE_DEVICE_API_VERSION(3, 1) // NO LONGER SUPPORTED
#define CAMERA_DEVICE_API_VERSION_3_2 HARDWARE_DEVICE_API_VERSION(3, 2)
#define CAMERA_DEVICE_API_VERSION_3_3 HARDWARE_DEVICE_API_VERSION(3, 3)
#define CAMERA_DEVICE_API_VERSION_3_4 HARDWARE_DEVICE_API_VERSION(3, 4)
@@ -257,7 +262,7 @@ typedef struct camera_info {
* otherwise.
*
*/
const camera_metadata_t *static_camera_characteristics;
const camera_metadata_t* static_camera_characteristics;
/**
* The total resource "cost" of using this camera, represented as an integer
@@ -611,7 +616,6 @@ typedef enum torch_mode_status {
*/
typedef struct camera_module_callbacks {
/**
* camera_device_status_change:
*
@@ -632,9 +636,8 @@ typedef struct camera_module_callbacks {
* or a platform-specific status.
*
*/
void (*camera_device_status_change)(const struct camera_module_callbacks*,
int camera_id,
int new_status);
void (*camera_device_status_change)(const struct camera_module_callbacks*, int camera_id,
int new_status);
/**
* torch_mode_status_change:
@@ -655,10 +658,8 @@ typedef struct camera_module_callbacks {
*
* new_status: The new status code, one of the torch_mode_status_t enums.
*/
void (*torch_mode_status_change)(const struct camera_module_callbacks*,
const char* camera_id,
int new_status);
void (*torch_mode_status_change)(const struct camera_module_callbacks*, const char* camera_id,
int new_status);
} camera_module_callbacks_t;
@@ -796,7 +797,7 @@ typedef struct camera_stream_combination {
*
* At least one output-capable stream must be defined.
*/
camera_stream_t *streams;
camera_stream_t* streams;
/**
* The operation mode of streams in this stream combination, one of the value
@@ -906,7 +907,7 @@ typedef struct camera_module {
int (*get_number_of_cameras)(void);
#ifdef CAMERA_NEEDS_SEC_GET_CAM_POS_V1
/**
/**
* get_cam_pos:
*
* Unknown. Needed by prebuilt camera module from the Samsung GTO device.
@@ -945,10 +946,10 @@ typedef struct camera_module {
* this method with this invalid camera id will get -EINVAL and NULL camera
* static metadata (camera_info.static_camera_characteristics).
*/
int (*get_camera_info)(int camera_id, struct camera_info *info);
int (*get_camera_info)(int camera_id, struct camera_info* info);
#ifdef CAMERA_NEEDS_SEC_GET_CAM_POS_V2
/**
/**
* get_cam_pos:
*
* Unknown. Needed by prebuilt camera module from the Samsung GTA4L device.
@@ -992,7 +993,7 @@ typedef struct camera_module {
* -EINVAL: The input arguments are invalid, i.e. the callbacks are
* null
*/
int (*set_callbacks)(const camera_module_callbacks_t *callbacks);
int (*set_callbacks)(const camera_module_callbacks_t* callbacks);
/**
* get_vendor_tag_ops:
@@ -1058,8 +1059,8 @@ typedef struct camera_module {
* opened concurrently were opened already, either by
* this method or common.methods->open method.
*/
int (*open_legacy)(const struct hw_module_t* module, const char* id,
uint32_t halVersion, struct hw_device_t** device);
int (*open_legacy)(const struct hw_module_t* module, const char* id, uint32_t halVersion,
struct hw_device_t** device);
/**
* set_torch_mode:
@@ -1175,8 +1176,7 @@ typedef struct camera_module {
* framework. Calling this function with invalid physical_camera_id will
* get -EINVAL, and NULL static_metadata.
*/
int (*get_physical_camera_info)(int physical_camera_id,
camera_metadata_t **static_metadata);
int (*get_physical_camera_info)(int physical_camera_id, camera_metadata_t** static_metadata);
/**
* is_stream_combination_supported:
@@ -1200,7 +1200,7 @@ typedef struct camera_module {
* Valid to be called by the framework.
*/
int (*is_stream_combination_supported)(int camera_id,
const camera_stream_combination_t *streams);
const camera_stream_combination_t* streams);
/**
* notify_device_state_change:

View File

@@ -1,35 +1,18 @@
//
// Copyright (C) 2024 The LineageOS Project
//
// SPDX-FileCopyrightText: 2024-2026 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
soong_config_module_type {
name: "extra_ids",
module_type: "cc_defaults",
config_namespace: "samsungCameraVars",
value_variables: ["extra_ids"],
properties: ["cppflags"],
}
extra_ids {
name: "extra_id_defaults",
soong_config_variables: {
extra_ids: {
cppflags: ["-DEXTRA_IDS=%s"],
},
},
}
cc_defaults {
name: "camera_service_aidl_defaults.samsung",
defaults: [
"extra_id_defaults",
"samsung_camera3_defaults"
],
defaults: ["samsung_camera3_defaults"],
vintf_fragments: ["android.hardware.camera.provider-service.samsung.xml"],
vendor: true,
relative_install_path: "hw",
cppflags: select(soong_config_variable("samsungCameraVars", "extra_ids"), {
any @ flag_val: ["-DEXTRA_IDS=" + flag_val],
default: [],
}),
srcs: [
"service.cpp",
"CameraProvider.cpp",

View File

@@ -183,10 +183,13 @@ bool CameraProvider::initCamera(int id) {
bool CameraProvider::initialize() {
camera_module_t* rawModule;
int err = hw_get_module(CAMERA_HARDWARE_MODULE_ID, (const hw_module_t**)&rawModule);
int err = hw_get_module(SEC_CAMERA_HARDWARE_MODULE_ID, (const hw_module_t**)&rawModule);
if (err < 0) {
ALOGE("Could not load camera HAL module: %d (%s)", err, strerror(-err));
return true;
err = hw_get_module(CAMERA_HARDWARE_MODULE_ID, (const hw_module_t**)&rawModule);
if (err < 0) {
ALOGE("Could not load camera HAL module: %d (%s)", err, strerror(-err));
return true;
}
}
mModule = new SamsungCameraModule(rawModule);
@@ -221,7 +224,7 @@ bool CameraProvider::initialize() {
}
std::vector<int> extraIDs = {
#ifdef EXTRA_IDS
EXTRA_IDS
EXTRA_IDS
#endif
};
for (int i : extraIDs) {

View File

@@ -1,6 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.camera.provider</name>
<version>1</version>
<fqname>ICameraProvider/internal/0</fqname>
</hal>
</manifest>

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2022 The Android Open Source Project
* Copyright (C) 2024 The LineageOS Project
* Copyright (C) 2024-2025 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,14 +35,14 @@ int main() {
ALOGI("CameraProvider: samsung service is starting.");
ABinderProcess_setThreadPoolMaxThreadCount(HWBINDER_THREAD_COUNT);
ABinderProcess_startThreadPool();
std::shared_ptr<CameraProvider> defaultProvider = ndk::SharedRefBase::make<CameraProvider>();
const std::string serviceName = std::string(CameraProvider::descriptor) + "/internal/0";
binder_exception_t ret =
AServiceManager_addService(defaultProvider->asBinder().get(), serviceName.c_str());
LOG_ALWAYS_FATAL_IF(ret != EX_NONE, "Error while registering camera provider service: %d",
ret);
LOG_ALWAYS_FATAL_IF(ret != EX_NONE, "Error while registering camera provider service: %d", ret);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach

88
aidl/codec2/Android.bp Normal file
View File

@@ -0,0 +1,88 @@
/*
* Copyright 2019 The Android Open Source Project
* Copyright 2025 The LineageOS 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.
*/
cc_binary {
name: "android.software.media.c2-service.samsung",
vendor: true,
relative_install_path: "hw",
init_rc: ["android.software.media.c2-service.samsung.rc"],
//
// default -> For devices that already have a c2@1.2 or c2-V1 service in their vendor (QTI c2, Samsung hardware c2 etc.)
// legacy_default0 -> For devices that already have a c2@1.0 service in their vendor (QTI c2, Samsung hardware c2 etc.)
// legacy_default -> For devices without a c2 service in their vendor
//
vintf_fragments: select(soong_config_variable("samsungCodec2Vars", "c2_instance_type"), {
any @ fragment: ["samsung_media_c2_" + fragment + ".xml"],
default: ["samsung_media_c2_default.xml"],
}),
defaults: [
"libcodec2-hidl-defaults",
"libcodec2-aidl-defaults",
],
srcs: [
"vendor.cpp",
],
// minijail is used to protect against unexpected system calls.
shared_libs: [
"libavservices_minijail",
"libbinder",
"libbinder_ndk",
] + select(soong_config_variable("samsungCodec2Vars", "target_componentstore_library"), {
any @ flag_val: [flag_val],
default: [],
}),
cflags: select(soong_config_variable("samsungCodec2Vars", "uses_legacy_component_store"), {
"true": ["-DLEGACY_COMPONENT_STORE" ],
default: [],
}),
required: ["android.software.media.c2-default-seccomp_policy"],
}
prebuilt_etc {
name: "android.software.media.c2-default-seccomp_policy",
vendor: true,
sub_dir: "seccomp_policy",
// If a specific architecture is targeted, multiple choices are not needed.
arch: {
arm: {
src: "seccomp_policy/android.software.media.c2-default-arm.policy",
},
arm64: {
src: "seccomp_policy/android.software.media.c2-default-arm64.policy",
},
riscv64: {
src: "seccomp_policy/android.software.media.c2-default-riscv64.policy",
},
x86: {
src: "seccomp_policy/android.software.media.c2-default-x86.policy",
},
x86_64: {
src: "seccomp_policy/android.software.media.c2-default-x86_64.policy",
},
},
// This may be removed.
required: ["crash_dump.policy"],
}

View File

@@ -0,0 +1,6 @@
service samsung-software-media-c2-hal /vendor/bin/hw/android.software.media.c2-service.samsung
class hal
user mediacodec
group camera mediadrm drmrpc
ioprio rt 4
task_profiles ProcessCapacityHigh

View File

@@ -0,0 +1,18 @@
<manifest version="1.0" type="device">
<!-- HIDL fragment -->
<hal>
<name>android.hardware.media.c2</name>
<transport>hwbinder</transport>
<version>1.2</version>
<interface>
<name>IComponentStore</name>
<instance>default0</instance>
</interface>
</hal>
<!-- AIDL fragment -->
<hal format="aidl">
<name>android.hardware.media.c2</name>
<version>1</version>
<fqname>IComponentStore/default1</fqname>
</hal>
</manifest>

View File

@@ -1,11 +1,11 @@
<manifest version="1.0" type="device">
<hal format="hidl">
<name>vendor.lineage.fastcharge</name>
<hal format="hidl" override="true">
<name>android.hardware.media.c2</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IFastCharge</name>
<name>IComponentStore</name>
<instance>default</instance>
</interface>
</hal>
</hal>
</manifest>

View File

@@ -0,0 +1,11 @@
<manifest version="1.0" type="device">
<hal format="hidl" override="true">
<name>android.hardware.media.c2</name>
<transport>hwbinder</transport>
<version>1.0</version>
<interface>
<name>IComponentStore</name>
<instance>default0</instance>
</interface>
</hal>
</manifest>

View File

@@ -0,0 +1,86 @@
# Copyright (C) 2019 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.
futex: 1
# ioctl calls are filtered via the selinux policy.
ioctl: 1
sched_yield: 1
close: 1
dup: 1
ppoll: 1
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
mmap2: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
memfd_create: 1
ftruncate: 1
ftruncate64: 1
# mremap: Ensure |flags| are (MREMAP_MAYMOVE | MREMAP_FIXED) TODO: Once minijail
# parser support for '<' is in this needs to be modified to also prevent
# |old_address| and |new_address| from touching the exception vector page, which
# on ARM is statically loaded at 0xffff 0000. See
# http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Babfeega.html
# for more details.
mremap: arg3 == 3
munmap: 1
prctl: 1
getuid32: 1
writev: 1
sigaltstack: 1
clone: 1
exit: 1
lseek: 1
rt_sigprocmask: 1
openat: 1
open: 1
fstat64: 1
write: 1
nanosleep: 1
setpriority: 1
set_tid_address: 1
getdents64: 1
readlinkat: 1
readlink: 1
read: 1
pread64: 1
fstatfs64: 1
gettimeofday: 1
faccessat: 1
_llseek: 1
fstatat64: 1
ugetrlimit: 1
exit_group: 1
restart_syscall: 1
rt_sigreturn: 1
getrandom: 1
madvise: 1
# crash dump policy additions
sigreturn: 1
clock_gettime: 1
futex: 1
getpid: 1
gettid: 1
pipe2: 1
recvmsg: 1
process_vm_readv: 1
tgkill: 1
rt_sigaction: 1
rt_tgsigqueueinfo: 1
#prctl: arg0 == PR_GET_NO_NEW_PRIVS || arg0 == 0x53564d41
#mprotect: arg2 in 0x1|0x2
#mmap2: arg2 in 0x1|0x2
geteuid32: 1
getgid32: 1
getegid32: 1
getgroups32: 1

View File

@@ -0,0 +1,80 @@
# Copyright (C) 2021 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.
futex: 1
# ioctl calls are filtered via the selinux policy.
ioctl: 1
sched_yield: 1
close: 1
dup: 1
ppoll: 1
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
mmap: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
getuid: 1
getrlimit: 1
fstat: 1
newfstatat: 1
fstatfs: 1
memfd_create: 1
ftruncate: 1
# mremap: Ensure |flags| are (MREMAP_MAYMOVE | MREMAP_FIXED) TODO: Once minijail
# parser support for '<' is in this needs to be modified to also prevent
# |old_address| and |new_address| from touching the exception vector page, which
# on ARM is statically loaded at 0xffff 0000. See
# http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0211h/Babfeega.html
# for more details.
mremap: arg3 == 3 || arg3 == MREMAP_MAYMOVE
munmap: 1
prctl: 1
writev: 1
sigaltstack: 1
clone: 1
exit: 1
lseek: 1
rt_sigprocmask: 1
openat: 1
write: 1
nanosleep: 1
setpriority: 1
set_tid_address: 1
getdents64: 1
readlinkat: 1
read: 1
pread64: 1
gettimeofday: 1
faccessat: 1
exit_group: 1
restart_syscall: 1
rt_sigreturn: 1
getrandom: 1
madvise: 1
# crash dump policy additions
clock_gettime: 1
getpid: 1
gettid: 1
pipe2: 1
recvmsg: 1
process_vm_readv: 1
tgkill: 1
rt_sigaction: 1
rt_tgsigqueueinfo: 1
#mprotect: arg2 in 0x1|0x2
munmap: 1
#mmap: arg2 in 0x1|0x2
geteuid: 1
getgid: 1
getegid: 1
getgroups: 1

View File

@@ -0,0 +1,74 @@
# Copyright (C) 2019 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.
futex: 1
# ioctl calls are filtered via the selinux policy.
ioctl: 1
sched_yield: 1
close: 1
dup: 1
ppoll: 1
mprotect: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
mmap: arg2 in ~PROT_EXEC || arg2 in ~PROT_WRITE
getuid: 1
getrlimit: 1
fstat: 1
newfstatat: 1
fstatfs: 1
memfd_create: 1
ftruncate: 1
mremap: arg3 == 3 || arg3 == MREMAP_MAYMOVE
munmap: 1
prctl: 1
writev: 1
sigaltstack: 1
clone: 1
exit: 1
lseek: 1
rt_sigprocmask: 1
openat: 1
write: 1
nanosleep: 1
setpriority: 1
set_tid_address: 1
getdents64: 1
readlinkat: 1
read: 1
pread64: 1
gettimeofday: 1
faccessat: 1
exit_group: 1
restart_syscall: 1
rt_sigreturn: 1
getrandom: 1
madvise: 1
# crash dump policy additions
clock_gettime: 1
getpid: 1
gettid: 1
pipe2: 1
recvmsg: 1
process_vm_readv: 1
tgkill: 1
rt_sigaction: 1
rt_tgsigqueueinfo: 1
#mprotect: arg2 in 0x1|0x2
munmap: 1
#mmap: arg2 in 0x1|0x2
geteuid: 1
getgid: 1
getegid: 1
getgroups: 1

View File

@@ -0,0 +1,71 @@
# Copyright (C) 2021 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.
read: 1
mprotect: 1
prctl: 1
openat: 1
open: 1
getuid32: 1
getuid: 1
getrlimit: 1
writev: 1
ioctl: 1
close: 1
mmap2: 1
mmap: 1
fstat64: 1
fstat: 1
stat64: 1
statfs64: 1
madvise: 1
fstatat64: 1
newfstatat: 1
futex: 1
munmap: 1
faccessat: 1
_llseek: 1
lseek: 1
clone: 1
sigaltstack: 1
setpriority: 1
restart_syscall: 1
exit: 1
exit_group: 1
rt_sigreturn: 1
ugetrlimit: 1
readlink: 1
readlinkat: 1
_llseek: 1
fstatfs64: 1
fstatfs: 1
pread64: 1
mremap: 1
dup: 1
set_tid_address: 1
write: 1
nanosleep: 1
sched_setscheduler: 1
uname: 1
memfd_create: 1
ftruncate: 1
ftruncate64: 1
# Required by AddressSanitizer
gettid: 1
sched_yield: 1
getpid: 1
gettid: 1
@include /system/etc/seccomp_policy/crash_dump.x86.policy

View File

@@ -0,0 +1,71 @@
# Copyright (C) 2021 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.
read: 1
mprotect: 1
prctl: 1
openat: 1
open: 1
getuid32: 1
getuid: 1
getrlimit: 1
writev: 1
ioctl: 1
close: 1
mmap2: 1
mmap: 1
fstat64: 1
fstat: 1
stat64: 1
statfs64: 1
madvise: 1
fstatat64: 1
newfstatat: 1
futex: 1
munmap: 1
faccessat: 1
_llseek: 1
lseek: 1
clone: 1
sigaltstack: 1
setpriority: 1
restart_syscall: 1
exit: 1
exit_group: 1
rt_sigreturn: 1
ugetrlimit: 1
readlink: 1
readlinkat: 1
_llseek: 1
fstatfs64: 1
fstatfs: 1
pread64: 1
mremap: 1
dup: 1
set_tid_address: 1
write: 1
nanosleep: 1
sched_setscheduler: 1
uname: 1
memfd_create: 1
ftruncate: 1
ftruncate64: 1
# Required by AddressSanitizer
gettid: 1
sched_yield: 1
getpid: 1
gettid: 1
@include /system/etc/seccomp_policy/crash_dump.x86.policy

100
aidl/codec2/vendor.cpp Normal file
View File

@@ -0,0 +1,100 @@
/*
* Copyright 2018 The Android Open Source Project
* Copyright 2025 The LineageOS 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.
*/
// #define LOG_NDEBUG 0
#define LOG_TAG "android.software.media.c2-service.samsung"
#include <android-base/logging.h>
#include <minijail.h>
// HIDL
#ifdef LEGACY_COMPONENT_STORE
#include <binder/ProcessState.h>
#include <hidl/HidlTransportSupport.h>
#endif
// AIDL
#include <codec2/aidl/ComponentStore.h>
// This is the absolute on-device path of the prebuild_etc module
// "android.software.media.c2-default-seccomp_policy" in Android.bp.
static constexpr char kBaseSeccompPolicyPath[] =
"/vendor/etc/seccomp_policy/"
"android.software.media.c2-default-seccomp_policy";
// Additional seccomp permissions can be added in this file.
// This file does not exist by default.
static constexpr char kExtSeccompPolicyPath[] =
"/vendor/etc/seccomp_policy/"
"android.software.media.c2-extended-seccomp_policy";
// We want multiple threads to be running so that a blocking operation
// on one codec does not block the other codecs.
// For HIDL: Extra threads may be needed to handle a stacked IPC sequence that
// contains alternating binder and hwbinder calls. (See b/35283480.)
static constexpr int kThreadCount = 8;
#ifndef LEGACY_COMPONENT_STORE
extern "C" void RegisterSECCodecAidlServices();
extern "C" void RegisterSECCodecHidlServices();
#else
extern "C" void RegisterSECCodecServices();
#endif
void runAidlService() {
#ifndef LEGACY_COMPONENT_STORE
RegisterSECCodecAidlServices();
#endif
}
void runHidlService() {
#ifdef LEGACY_COMPONENT_STORE
using namespace ::android;
// Enable vndbinder to allow vendor-to-vendor binder calls.
ProcessState::initWithDriver("/dev/vndbinder");
ProcessState::self()->startThreadPool();
hardware::configureRpcThreadpool(kThreadCount, true /* callerWillJoin */);
RegisterSECCodecServices();
hardware::joinRpcThreadpool();
#else
RegisterSECCodecHidlServices();
#endif
}
int main(int /* argc */, char** /* argv */) {
const bool aidlEnabled = ::aidl::android::hardware::media::c2::utils::IsSelected();
#ifdef LEGACY_COMPONENT_STORE
LOG(DEBUG) << "android.software.media.c2@1.0-service.samsung starting...";
#else
LOG(DEBUG) << "android.software.media.c2" << (aidlEnabled ? "-V1" : "@1.2")
<< "-service.samsung starting...";
#endif
// Set up minijail to limit system calls.
signal(SIGPIPE, SIG_IGN);
android::SetUpMinijail(kBaseSeccompPolicyPath, kExtSeccompPolicyPath);
if (aidlEnabled) {
runAidlService();
} else {
runHidlService();
}
return 0;
}

View File

@@ -12,16 +12,14 @@ namespace hardware {
namespace biometrics {
namespace fingerprint {
CancellationSignal::CancellationSignal(Session* session)
: mSession(session) {
}
CancellationSignal::CancellationSignal(Session* session) : mSession(session) {}
ndk::ScopedAStatus CancellationSignal::cancel() {
return mSession->cancel();
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -19,16 +19,16 @@ namespace biometrics {
namespace fingerprint {
class CancellationSignal : public BnCancellationSignal {
public:
public:
CancellationSignal(Session* session);
ndk::ScopedAStatus cancel() override;
private:
private:
Session* mSession;
};
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -37,12 +37,12 @@ constexpr char FW_VERSION[] = "1.01";
constexpr char SERIAL_NUMBER[] = "00000001";
constexpr char SW_COMPONENT_ID[] = "matchingAlgorithm";
constexpr char SW_VERSION[] = "vendor/version/revision";
}
} // namespace
static Fingerprint* sInstance;
Fingerprint::Fingerprint() {
sInstance = this; // keep track of the most recent instance
sInstance = this; // keep track of the most recent instance
if (!mHal.openHal(Fingerprint::notify)) {
LOG(ERROR) << "Can't open HAL module";
}
@@ -75,9 +75,8 @@ Fingerprint::Fingerprint() {
goto skip_uinput_setup;
}
int err = ioctl(uinputFd, UI_SET_EVBIT, EV_KEY) |
ioctl(uinputFd, UI_SET_KEYBIT, KEY_UP) |
ioctl(uinputFd, UI_SET_KEYBIT, KEY_DOWN);
int err = ioctl(uinputFd, UI_SET_EVBIT, EV_KEY) | ioctl(uinputFd, UI_SET_KEYBIT, KEY_UP) |
ioctl(uinputFd, UI_SET_KEYBIT, KEY_DOWN);
if (err != 0) {
LOG(ERROR) << "Unable to enable key events";
goto skip_uinput_setup;
@@ -109,34 +108,38 @@ ndk::ScopedAStatus Fingerprint::getSensorProps(std::vector<SensorProps>* out) {
std::vector<common::ComponentInfo> componentInfo = {
{HW_COMPONENT_ID, HW_VERSION, FW_VERSION, SERIAL_NUMBER, "" /* softwareVersion */},
{SW_COMPONENT_ID, "" /* hardwareVersion */, "" /* firmwareVersion */,
"" /* serialNumber */, SW_VERSION}};
common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH,
mMaxEnrollmentsPerUser, componentInfo};
"" /* serialNumber */, SW_VERSION}};
common::CommonProps commonProps = {SENSOR_ID, SENSOR_STRENGTH, mMaxEnrollmentsPerUser,
componentInfo};
SensorLocation sensorLocation;
std::vector<SensorLocation> sensorLocations;
std::string loc = FingerprintHalProperties::sensor_location().value_or("");
std::vector<std::string> dim = Split(loc, "|");
if (dim.size() >= 3 && dim.size() <= 4) {
ParseInt(dim[0], &sensorLocation.sensorLocationX);
ParseInt(dim[1], &sensorLocation.sensorLocationY);
ParseInt(dim[2], &sensorLocation.sensorRadius);
std::vector<std::string> sensors = Split(loc, ";");
if (dim.size() >= 4)
sensorLocation.display = dim[3];
} else if(loc.length() > 0) {
LOG(WARNING) << "Invalid sensor location input (x|y|radius|display): " << loc;
for (const auto& sensor : sensors) {
std::vector<std::string> dim = Split(sensor, "|");
if (dim.size() >= 3 && dim.size() <= 4) {
SensorLocation sensorLocation;
ParseInt(dim[0], &sensorLocation.sensorLocationX);
ParseInt(dim[1], &sensorLocation.sensorLocationY);
ParseInt(dim[2], &sensorLocation.sensorRadius);
if (dim.size() == 4) {
sensorLocation.display = dim[3];
}
sensorLocations.push_back(sensorLocation);
} else if (!sensor.empty()) {
LOG(WARNING) << "Invalid sensor location input (x|y|radius|display): " << sensor;
}
}
LOG(INFO) << "Sensor type: " << ::android::internal::ToString(mSensorType)
<< " location: " << sensorLocation.toString();
LOG(INFO) << "Sensor type: " << ::android::internal::ToString(mSensorType) << " locations:";
for (const auto& sensorLocation : sensorLocations) {
LOG(INFO) << sensorLocation.toString();
}
*out = {{commonProps,
mSensorType,
{sensorLocation},
mSupportsGestures,
false,
false,
false,
*out = {{commonProps, mSensorType, sensorLocations, mSupportsGestures, false, false, false,
std::nullopt}};
return ndk::ScopedAStatus::ok();
@@ -157,8 +160,8 @@ ndk::ScopedAStatus Fingerprint::createSession(int32_t /*sensorId*/, int32_t user
void Fingerprint::notify(const fingerprint_msg_t* msg) {
Fingerprint* thisPtr = sInstance;
if (msg->type == FINGERPRINT_ACQUIRED
&& msg->data.acquired.acquired_info > SEM_FINGERPRINT_EVENT_BASE) {
if (msg->type == FINGERPRINT_ACQUIRED &&
msg->data.acquired.acquired_info > SEM_FINGERPRINT_EVENT_BASE) {
thisPtr->handleEvent(msg->data.acquired.acquired_info);
return;
}
@@ -177,9 +180,8 @@ void Fingerprint::handleEvent(int eventCode) {
case SEM_FINGERPRINT_EVENT_GESTURE_SWIPE_UP: {
if (!mSupportsGestures) return;
struct input_event event {};
int keycode = eventCode == SEM_FINGERPRINT_EVENT_GESTURE_SWIPE_UP ?
KEY_UP : KEY_DOWN;
struct input_event event{};
int keycode = eventCode == SEM_FINGERPRINT_EVENT_GESTURE_SWIPE_UP ? KEY_UP : KEY_DOWN;
// Report the key
event.type = EV_KEY;
@@ -225,8 +227,8 @@ void Fingerprint::handleEvent(int eventCode) {
}
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -23,16 +23,16 @@ namespace biometrics {
namespace fingerprint {
class Fingerprint : public BnFingerprint {
public:
public:
Fingerprint();
ndk::ScopedAStatus getSensorProps(std::vector<SensorProps>* _aidl_return) override;
ndk::ScopedAStatus createSession(int32_t sensorId, int32_t userId,
const std::shared_ptr<ISessionCallback>& cb,
std::shared_ptr<ISession>* out) override;
private:
private:
static void notify(
const fingerprint_msg_t* msg); /* Static callback for legacy HAL implementation */
const fingerprint_msg_t* msg); /* Static callback for legacy HAL implementation */
void handleEvent(int eventCode);
LegacyHAL mHal;
@@ -45,8 +45,8 @@ private:
std::shared_ptr<Session> mSession;
};
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -36,15 +36,13 @@ inline void translate(const hw_auth_token_t& hat, HardwareAuthToken& authToken)
authToken.authenticatorId = hat.authenticator_id;
// these are in network order: translate to host
authToken.authenticatorType =
static_cast<keymaster::HardwareAuthenticatorType>(
be32toh(hat.authenticator_type));
static_cast<keymaster::HardwareAuthenticatorType>(be32toh(hat.authenticator_type));
authToken.timestamp.milliSeconds = be64toh(hat.timestamp);
authToken.mac.insert(authToken.mac.begin(), std::begin(hat.hmac),
std::end(hat.hmac));
authToken.mac.insert(authToken.mac.begin(), std::begin(hat.hmac), std::end(hat.hmac));
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -19,39 +19,40 @@ namespace fingerprint {
bool LegacyHAL::openHal(fingerprint_notify_t notify) {
void* handle = dlopen("libbauthserver.so", RTLD_NOW);
if (!handle)
if (!handle) {
handle = dlopen("libsfp_sensor.so", RTLD_NOW);
}
if (handle) {
int err;
ss_fingerprint_close =
reinterpret_cast<typeof(ss_fingerprint_close)>(dlsym(handle, "ss_fingerprint_close"));
ss_fingerprint_close = reinterpret_cast<typeof(ss_fingerprint_close)>(
dlsym(handle, "ss_fingerprint_close"));
ss_fingerprint_open =
reinterpret_cast<typeof(ss_fingerprint_open)>(dlsym(handle, "ss_fingerprint_open"));
reinterpret_cast<typeof(ss_fingerprint_open)>(dlsym(handle, "ss_fingerprint_open"));
ss_set_notify_callback = reinterpret_cast<typeof(ss_set_notify_callback)>(
dlsym(handle, "ss_set_notify_callback"));
dlsym(handle, "ss_set_notify_callback"));
ss_fingerprint_pre_enroll = reinterpret_cast<typeof(ss_fingerprint_pre_enroll)>(
dlsym(handle, "ss_fingerprint_pre_enroll"));
ss_fingerprint_enroll =
reinterpret_cast<typeof(ss_fingerprint_enroll)>(dlsym(handle, "ss_fingerprint_enroll"));
dlsym(handle, "ss_fingerprint_pre_enroll"));
ss_fingerprint_enroll = reinterpret_cast<typeof(ss_fingerprint_enroll)>(
dlsym(handle, "ss_fingerprint_enroll"));
ss_fingerprint_post_enroll = reinterpret_cast<typeof(ss_fingerprint_post_enroll)>(
dlsym(handle, "ss_fingerprint_post_enroll"));
dlsym(handle, "ss_fingerprint_post_enroll"));
ss_fingerprint_get_auth_id = reinterpret_cast<typeof(ss_fingerprint_get_auth_id)>(
dlsym(handle, "ss_fingerprint_get_auth_id"));
ss_fingerprint_cancel =
reinterpret_cast<typeof(ss_fingerprint_cancel)>(dlsym(handle, "ss_fingerprint_cancel"));
dlsym(handle, "ss_fingerprint_get_auth_id"));
ss_fingerprint_cancel = reinterpret_cast<typeof(ss_fingerprint_cancel)>(
dlsym(handle, "ss_fingerprint_cancel"));
ss_fingerprint_enumerate = reinterpret_cast<typeof(ss_fingerprint_enumerate)>(
dlsym(handle, "ss_fingerprint_enumerate"));
ss_fingerprint_remove =
reinterpret_cast<typeof(ss_fingerprint_remove)>(dlsym(handle, "ss_fingerprint_remove"));
dlsym(handle, "ss_fingerprint_enumerate"));
ss_fingerprint_remove = reinterpret_cast<typeof(ss_fingerprint_remove)>(
dlsym(handle, "ss_fingerprint_remove"));
ss_fingerprint_set_active_group = reinterpret_cast<typeof(ss_fingerprint_set_active_group)>(
dlsym(handle, "ss_fingerprint_set_active_group"));
dlsym(handle, "ss_fingerprint_set_active_group"));
ss_fingerprint_authenticate = reinterpret_cast<typeof(ss_fingerprint_authenticate)>(
dlsym(handle, "ss_fingerprint_authenticate"));
dlsym(handle, "ss_fingerprint_authenticate"));
ss_fingerprint_request = reinterpret_cast<typeof(ss_fingerprint_request)>(
dlsym(handle, "ss_fingerprint_request"));
dlsym(handle, "ss_fingerprint_request"));
if ((err = ss_fingerprint_open(nullptr)) != 0) {
LOG(ERROR) << "Can't open fingerprint, error: " << err;
@@ -76,8 +77,8 @@ int LegacyHAL::request(int cmd, int param) {
return result;
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -15,7 +15,7 @@ namespace biometrics {
namespace fingerprint {
class LegacyHAL {
public:
public:
bool openHal(fingerprint_notify_t notify);
int request(int cmd, int param);
@@ -32,11 +32,12 @@ public:
int (*ss_fingerprint_remove)(uint32_t gid, uint32_t fid);
int (*ss_fingerprint_set_active_group)(uint32_t gid, const char* store_path);
int (*ss_fingerprint_authenticate)(uint64_t operation_id, uint32_t gid);
int (*ss_fingerprint_request)(uint32_t cmd, char *inBuf, uint32_t inBuf_length, char *outBuf, uint32_t outBuf_length, uint32_t param);
int (*ss_fingerprint_request)(uint32_t cmd, char* inBuf, uint32_t inBuf_length, char* outBuf,
uint32_t outBuf_length, uint32_t param);
};
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "Fingerprint.h"
#include "LockoutTracker.h"
#include "Fingerprint.h"
#include <util/Util.h>
@@ -16,8 +16,9 @@ namespace biometrics {
namespace fingerprint {
void LockoutTracker::reset(bool clearAttemptCounter) {
if (clearAttemptCounter)
if (clearAttemptCounter) {
mFailedCount = 0;
}
mLockoutTimedStart = 0;
mCurrentMode = LockoutMode::NONE;
}
@@ -25,9 +26,9 @@ void LockoutTracker::reset(bool clearAttemptCounter) {
void LockoutTracker::addFailedAttempt() {
mFailedCount++;
if (mFailedCount >= LOCKOUT_PERMANENT_THRESHOLD)
if (mFailedCount >= LOCKOUT_PERMANENT_THRESHOLD) {
mCurrentMode = LockoutMode::PERMANENT;
else if (mFailedCount >= LOCKOUT_TIMED_THRESHOLD) {
} else if (mFailedCount >= LOCKOUT_TIMED_THRESHOLD) {
mCurrentMode = LockoutMode::TIMED;
mLockoutTimedStart = Util::getSystemNanoTime();
}
@@ -56,8 +57,8 @@ int64_t LockoutTracker::getLockoutTimeLeft() {
return res;
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -1,11 +1,13 @@
/*
* Copyright (C) 2024 The LineageOS Project
* Copyright (C) 2024-2025 The LineageOS Project
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <cstdint>
namespace aidl {
namespace android {
namespace hardware {
@@ -16,27 +18,23 @@ namespace fingerprint {
#define LOCKOUT_TIMED_DURATION 30 * 1000
#define LOCKOUT_PERMANENT_THRESHOLD 20
enum class LockoutMode {
NONE,
TIMED,
PERMANENT
};
enum class LockoutMode { NONE, TIMED, PERMANENT };
class LockoutTracker {
public:
public:
void reset(bool clearAttemptCounter);
LockoutMode getMode();
void addFailedAttempt();
int64_t getLockoutTimeLeft();
private:
private:
int32_t mFailedCount = 0;
int64_t mLockoutTimedStart;
LockoutMode mCurrentMode;
};
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include "Session.h"
#include "CancellationSignal.h"
#include "Legacy2Aidl.h"
#include "Session.h"
#include "VendorConstants.h"
#include <fingerprint.sysprop.h>
@@ -36,10 +36,7 @@ void onClientDeath(void* cookie) {
Session::Session(LegacyHAL hal, int userId, std::shared_ptr<ISessionCallback> cb,
LockoutTracker lockoutTracker)
: mHal(hal),
mLockoutTracker(lockoutTracker),
mUserId(userId),
mCb(cb) {
: mHal(hal), mLockoutTracker(lockoutTracker), mUserId(userId), mCb(cb) {
mDeathRecipient = AIBinder_DeathRecipient_new(onClientDeath);
char filename[64];
@@ -122,8 +119,9 @@ ndk::ScopedAStatus Session::enumerateEnrollments() {
if (mHal.ss_fingerprint_enumerate) {
int32_t error = mHal.ss_fingerprint_enumerate();
if (error)
if (error) {
LOG(ERROR) << "ss_fingerprint_enumerate failed: " << error;
}
} else {
std::vector<int> enrollments;
char filename[64];
@@ -135,8 +133,9 @@ ndk::ScopedAStatus Session::enumerateEnrollments() {
while ((entry = readdir(directory))) {
int uid, fid;
if (sscanf(entry->d_name, "User_%d_%dtmpl.dat", &uid, &fid)) {
if (uid == mUserId)
if (uid == mUserId) {
enrollments.push_back(fid);
}
}
}
closedir(directory);
@@ -155,8 +154,9 @@ ndk::ScopedAStatus Session::removeEnrollments(const std::vector<int32_t>& enroll
for (int32_t enrollment : enrollmentIds) {
int32_t error = mHal.ss_fingerprint_remove(mUserId, enrollment);
if (error)
if (error) {
LOG(ERROR) << "ss_fingerprint_remove failed: " << error;
}
}
return ndk::ScopedAStatus::ok();
@@ -195,8 +195,8 @@ ndk::ScopedAStatus Session::close() {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/, float /*minor*/,
float /*major*/) {
ndk::ScopedAStatus Session::onPointerDown(int32_t /*pointerId*/, int32_t /*x*/, int32_t /*y*/,
float /*minor*/, float /*major*/) {
LOG(INFO) << "onPointerDown";
if (FingerprintHalProperties::request_touch_event().value_or(false)) {
@@ -225,9 +225,9 @@ ndk::ScopedAStatus Session::onUiReady() {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Session::authenticateWithContext(
int64_t operationId, const OperationContext& /*context*/,
std::shared_ptr<ICancellationSignal>* out) {
ndk::ScopedAStatus Session::authenticateWithContext(int64_t operationId,
const OperationContext& /*context*/,
std::shared_ptr<ICancellationSignal>* out) {
return authenticate(operationId, out);
}
@@ -237,8 +237,8 @@ ndk::ScopedAStatus Session::enrollWithContext(const HardwareAuthToken& hat,
return enroll(hat, out);
}
ndk::ScopedAStatus Session::detectInteractionWithContext(const OperationContext& /*context*/,
std::shared_ptr<ICancellationSignal>* out) {
ndk::ScopedAStatus Session::detectInteractionWithContext(
const OperationContext& /*context*/, std::shared_ptr<ICancellationSignal>* out) {
return detectInteraction(out);
}
@@ -368,8 +368,7 @@ void Session::clearLockout(bool clearAttemptCounter) {
void Session::startLockoutTimer(int64_t timeout) {
mIsLockoutTimerAborted = false;
std::function<void()> action =
std::bind(&Session::lockoutTimerExpired, this);
std::function<void()> action = std::bind(&Session::lockoutTimerExpired, this);
std::thread([timeout, action]() {
std::this_thread::sleep_for(std::chrono::milliseconds(timeout));
action();
@@ -379,8 +378,9 @@ void Session::startLockoutTimer(int64_t timeout) {
}
void Session::lockoutTimerExpired() {
if (!mIsLockoutTimerAborted)
if (!mIsLockoutTimerAborted) {
clearLockout(false);
}
mIsLockoutTimerStarted = false;
mIsLockoutTimerAborted = false;
@@ -397,18 +397,19 @@ void Session::notify(const fingerprint_msg_t* msg) {
case FINGERPRINT_ACQUIRED: {
int32_t vendorCode = 0;
AcquiredInfo result =
VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode);
VendorAcquiredFilter(msg->data.acquired.acquired_info, &vendorCode);
LOG(DEBUG) << "onAcquired(" << static_cast<int>(result) << ")";
mCb->onAcquired(result, vendorCode);
} break;
case FINGERPRINT_TEMPLATE_ENROLLING:
if (FingerprintHalProperties::uses_percentage_samples().value_or(false)) {
const_cast<fingerprint_msg_t*>(msg)->data.enroll.samples_remaining =
100 - msg->data.enroll.samples_remaining;
100 - msg->data.enroll.samples_remaining;
}
if (FingerprintHalProperties::cancel_on_enroll_completion().value_or(false)) {
if (msg->data.enroll.samples_remaining == 0)
if (msg->data.enroll.samples_remaining == 0) {
mHal.ss_fingerprint_cancel();
}
}
LOG(DEBUG) << "onEnrollResult(fid=" << msg->data.enroll.finger.fid
<< ", gid=" << msg->data.enroll.finger.gid
@@ -458,8 +459,8 @@ void Session::onCaptureReady() {
mCaptureReady = true;
}
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -30,7 +30,7 @@ namespace fingerprint {
void onClientDeath(void* cookie);
class Session : public BnSession {
public:
public:
Session(LegacyHAL hal, int userId, std::shared_ptr<ISessionCallback> cb,
LockoutTracker lockoutTracker);
ndk::ScopedAStatus generateChallenge() override;
@@ -39,8 +39,7 @@ public:
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus authenticate(int64_t operationId,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus detectInteraction(
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus detectInteraction(std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus enumerateEnrollments() override;
ndk::ScopedAStatus removeEnrollments(const std::vector<int32_t>& enrollmentIds) override;
ndk::ScopedAStatus getAuthenticatorId() override;
@@ -51,15 +50,13 @@ public:
float major) override;
ndk::ScopedAStatus onPointerUp(int32_t pointerId) override;
ndk::ScopedAStatus onUiReady() override;
ndk::ScopedAStatus authenticateWithContext(
int64_t operationId, const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus enrollWithContext(
const HardwareAuthToken& hat, const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus authenticateWithContext(int64_t operationId, const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus enrollWithContext(const HardwareAuthToken& hat,
const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus detectInteractionWithContext(
const OperationContext& context,
std::shared_ptr<ICancellationSignal>* out) override;
const OperationContext& context, std::shared_ptr<ICancellationSignal>* out) override;
ndk::ScopedAStatus onPointerDownWithContext(const PointerContext& context) override;
ndk::ScopedAStatus onPointerUpWithContext(const PointerContext& context) override;
ndk::ScopedAStatus onContextChanged(const OperationContext& context) override;
@@ -69,11 +66,10 @@ public:
ndk::ScopedAStatus cancel();
binder_status_t linkToDeath(AIBinder* binder);
bool isClosed();
void notify(
const fingerprint_msg_t* msg);
void notify(const fingerprint_msg_t* msg);
void onCaptureReady();
private:
private:
LegacyHAL mHal;
LockoutTracker mLockoutTracker;
bool mClosed = false;
@@ -102,8 +98,8 @@ private:
AIBinder_DeathRecipient* mDeathRecipient;
};
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace fingerprint
} // namespace biometrics
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -1,5 +1,5 @@
service vendor.fingerprint-default /vendor/bin/hw/android.hardware.biometrics.fingerprint-service.samsung
class hal
class late_start
user system
group system input uhid
shutdown critical

View File

@@ -1,6 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.biometrics.fingerprint</name>
<version>4</version>
<fqname>IFingerprint/default</fqname>
</hal>
</manifest>

View File

@@ -6,9 +6,9 @@
#include "Fingerprint.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <android-base/logging.h>
using ::aidl::android::hardware::biometrics::fingerprint::Fingerprint;
@@ -17,9 +17,10 @@ int main() {
std::shared_ptr<Fingerprint> fingerprint = ndk::SharedRefBase::make<Fingerprint>();
const std::string instance = std::string() + Fingerprint::descriptor + "/default";
binder_status_t status = AServiceManager_addService(fingerprint->asBinder().get(), instance.c_str());
binder_status_t status =
AServiceManager_addService(fingerprint->asBinder().get(), instance.c_str());
CHECK(status == STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
return EXIT_FAILURE; // should not reach
}

View File

@@ -42,11 +42,11 @@ static constexpr std::string_view gChargerArg{"--charger"};
#if !CHARGER_FORCE_NO_UI
namespace aidl::android::hardware::health {
class ChargerCallbackImpl : public ChargerCallback {
public:
public:
using ChargerCallback::ChargerCallback;
bool ChargerEnableSuspend() override { return true; }
};
} // namespace aidl::android::hardware::health
} // namespace aidl::android::hardware::health
#endif
int main(int argc, char** argv) {
@@ -64,7 +64,9 @@ int main(int argc, char** argv) {
// If charger shouldn't have UI for your device, simply drop the line below
// for your service implementation. This corresponds to
// ro.charger.no_ui=true
return ChargerModeMain(binder, std::make_shared<aidl::android::hardware::health::ChargerCallbackImpl>(binder));
return ChargerModeMain(
binder,
std::make_shared<aidl::android::hardware::health::ChargerCallbackImpl>(binder));
#endif
LOG(INFO) << "Starting charger mode without UI.";

View File

@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.health</name>
<version>1</version>
<version>4</version>
<fqname>IHealth/default</fqname>
</hal>
</manifest>

View File

@@ -17,7 +17,7 @@ cc_binary {
shared_libs: [
"libbase",
"libbinder_ndk",
"android.hardware.light-V1-ndk",
"android.hardware.light-V2-ndk",
],
vendor: true,
}

View File

@@ -41,10 +41,12 @@ Lights::Lights() {
mLights.emplace(LightType::BACKLIGHT,
std::bind(&Lights::handleBacklight, this, std::placeholders::_1));
#ifdef BUTTON_BRIGHTNESS_NODE
mLights.emplace(LightType::BUTTONS, std::bind(&Lights::handleButtons, this, std::placeholders::_1));
mLights.emplace(LightType::BUTTONS,
std::bind(&Lights::handleButtons, this, std::placeholders::_1));
#endif /* BUTTON_BRIGHTNESS_NODE */
#ifdef LED_BLINK_NODE
mLights.emplace(LightType::BATTERY, std::bind(&Lights::handleBattery, this, std::placeholders::_1));
mLights.emplace(LightType::BATTERY,
std::bind(&Lights::handleBattery, this, std::placeholders::_1));
mLights.emplace(LightType::NOTIFICATIONS,
std::bind(&Lights::handleNotifications, this, std::placeholders::_1));
mLights.emplace(LightType::ATTENTION,
@@ -147,7 +149,7 @@ void Lights::setNotificationLED() {
state.color = calibrateColor(state.color & COLOR_MASK, adjusted_brightness);
set(LED_BLINK_NODE, ::android::base::StringPrintf("0x%08x %d %d", state.color, state.flashOnMs,
state.flashOffMs));
state.flashOffMs));
#ifdef LED_BLN_NODE
if (bln) {
@@ -168,7 +170,7 @@ uint32_t Lights::calibrateColor(uint32_t color, int32_t brightness) {
#define AutoHwLight(light) {.id = (int32_t)light, .type = light, .ordinal = 0}
ndk::ScopedAStatus Lights::getLights(std::vector<HwLight> *_aidl_return) {
ndk::ScopedAStatus Lights::getLights(std::vector<HwLight>* _aidl_return) {
for (auto const& light : mLights) {
_aidl_return->push_back(AutoHwLight(light.first));
}
@@ -179,11 +181,12 @@ ndk::ScopedAStatus Lights::getLights(std::vector<HwLight> *_aidl_return) {
uint32_t Lights::rgbToBrightness(const HwLightState& state) {
uint32_t color = state.color & COLOR_MASK;
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) + (29 * (color & 0xff))) >>
return ((77 * ((color >> 16) & 0xff)) + (150 * ((color >> 8) & 0xff)) +
(29 * (color & 0xff))) >>
8;
}
} // namespace light
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace light
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -9,10 +9,11 @@
#include <aidl/android/hardware/light/BnLights.h>
#include <samsung_lights.h>
#include <functional>
#include <unordered_map>
using ::aidl::android::hardware::light::HwLightState;
using ::aidl::android::hardware::light::HwLight;
using ::aidl::android::hardware::light::HwLightState;
namespace aidl {
namespace android {
@@ -20,13 +21,13 @@ namespace hardware {
namespace light {
class Lights : public BnLights {
public:
public:
Lights();
ndk::ScopedAStatus setLightState(int32_t id, const HwLightState& state) override;
ndk::ScopedAStatus getLights(std::vector<HwLight> *_aidl_return) override;
ndk::ScopedAStatus getLights(std::vector<HwLight>* _aidl_return) override;
private:
private:
void handleBacklight(const HwLightState& state);
#ifdef BUTTON_BRIGHTNESS_NODE
void handleButtons(const HwLightState& state);
@@ -49,7 +50,7 @@ private:
std::unordered_map<LightType, std::function<void(const HwLightState&)>> mLights;
};
} // namespace light
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace light
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -1,6 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.light</name>
<version>2</version>
<fqname>ILights/default</fqname>
</hal>
</manifest>

View File

@@ -31,7 +31,7 @@
#define LED_BLN_NODE "/sys/class/misc/backlightnotification/notification_led"
// Uncomment to enable variable button brightness
//#define VAR_BUTTON_BRIGHTNESS 1
// #define VAR_BUTTON_BRIGHTNESS 1
/*
* Brightness adjustment factors

View File

@@ -8,9 +8,9 @@
#include "Lights.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <android-base/logging.h>
using ::aidl::android::hardware::light::Lights;
@@ -23,5 +23,5 @@ int main() {
CHECK(status == STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
return EXIT_FAILURE; // should not reach
}

View File

@@ -0,0 +1,55 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include <android-base/file.h>
#include <android-base/strings.h>
#include <livedisplay/samsung/AdaptiveBacklight.h>
#include <fstream>
using android::base::ReadFileToString;
using android::base::Trim;
using android::base::WriteStringToFile;
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
static constexpr const char* kBacklightPath = "/sys/class/lcd/panel/power_reduce";
bool AdaptiveBacklight::isSupported() {
std::fstream file(kBacklightPath, file.in | file.out);
return file.good();
}
// Methods from ::aidl::vendor::lineage::livedisplay::BnAdaptiveBacklight follow.
ndk::ScopedAStatus AdaptiveBacklight::getEnabled(bool* _aidl_return) {
std::string tmp;
int32_t contents = 0;
if (!ReadFileToString(kBacklightPath, &tmp)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
contents = std::stoi(Trim(tmp));
*_aidl_return = contents > 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus AdaptiveBacklight::setEnabled(bool enabled) {
if (!WriteStringToFile(enabled ? "1" : "0", kBacklightPath, true)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
return ndk::ScopedAStatus::ok();
}
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,65 @@
//
// SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
filegroup {
name: "vendor.lineage.livedisplay-samsung-exynos",
srcs: [
"AdaptiveBacklight.cpp",
"DisplayColorCalibration.cpp",
"DisplayModes.cpp",
"ReadingEnhancementExynos.cpp",
"SunlightEnhancementExynos.cpp",
"serviceExynos.cpp",
],
}
filegroup {
name: "vendor.lineage.livedisplay-samsung-qcom",
srcs: [
"AdaptiveBacklight.cpp",
"DisplayColorCalibration.cpp",
"DisplayModes.cpp",
"SunlightEnhancement.cpp",
"service.cpp",
],
}
cc_defaults {
name: "livedisplay_samsung_defaults",
defaults: ["hidl_defaults"],
relative_install_path: "hw",
shared_libs: [
"libbase",
"libbinder_ndk",
"libbinder",
"libutils",
"vendor.lineage.livedisplay-V1-ndk",
],
header_libs: [
"vendor.lineage.livedisplay-samsung-headers",
],
}
cc_library_headers {
name: "vendor.lineage.livedisplay-samsung-headers",
vendor_available: true,
export_include_dirs: ["include"],
}
cc_binary {
name: "vendor.lineage.livedisplay-service.samsung-exynos",
defaults: ["livedisplay_samsung_defaults"],
init_rc: ["vendor.lineage.livedisplay-service.samsung-exynos.rc"],
srcs: [":vendor.lineage.livedisplay-samsung-exynos"],
vendor: true,
}
cc_binary {
name: "vendor.lineage.livedisplay-service.samsung-qcom",
defaults: ["livedisplay_samsung_defaults"],
init_rc: ["vendor.lineage.livedisplay-service.samsung-qcom.rc"],
srcs: [":vendor.lineage.livedisplay-samsung-qcom"],
vendor: true,
}

View File

@@ -0,0 +1,76 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include <android-base/file.h>
#include <android-base/strings.h>
#include <livedisplay/samsung/DisplayColorCalibration.h>
#include <fstream>
using android::base::ReadFileToString;
using android::base::Split;
using android::base::Trim;
using android::base::WriteStringToFile;
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
static constexpr const char* kRGBPath = "/sys/class/mdnie/mdnie/sensorRGB";
bool DisplayColorCalibration::isSupported() {
std::fstream file(kRGBPath, file.in | file.out);
return file.good();
}
// Methods from ::aidl::vendor::lineage::livedisplay::BnDisplayColorCalibration follow.
ndk::ScopedAStatus DisplayColorCalibration::getMaxValue(int32_t* _aidl_return) {
*_aidl_return = 255;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus DisplayColorCalibration::getMinValue(int32_t* _aidl_return) {
*_aidl_return = 1;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus DisplayColorCalibration::getCalibration(std::vector<int32_t>* _aidl_return) {
std::vector<int32_t> rgb;
std::string tmp;
if (ReadFileToString(kRGBPath, &tmp)) {
std::vector<std::string> colors = Split(Trim(tmp), " ");
for (const std::string& color : colors) {
rgb.push_back(std::stoi(color));
}
} else {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
*_aidl_return = rgb;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus DisplayColorCalibration::setCalibration(const std::vector<int32_t>& rgb) {
std::string contents;
for (const int32_t& color : rgb) {
contents += std::to_string(color) + " ";
}
if (!WriteStringToFile(Trim(contents), kRGBPath, true)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
return ndk::ScopedAStatus::ok();
}
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -1,48 +1,34 @@
/*
* Copyright (C) 2019 The LineageOS 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.
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "DisplayModesService"
#include "DisplayModes.h"
#include <android-base/logging.h>
#include <livedisplay/samsung/DisplayModes.h>
#include <fstream>
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace V2_0 {
namespace samsung {
static constexpr const char* kModePath = "/sys/class/mdnie/mdnie/mode";
static constexpr const char* kModeMaxPath = "/sys/class/mdnie/mdnie/mode_max";
#ifdef LIVES_IN_SYSTEM
static constexpr const char* kDefaultPath = "/data/misc/display/.displaymodedefault";
#else
static constexpr const char* kDefaultPath = "/data/vendor/display/.displaymodedefault";
#endif
const std::map<int32_t, std::string> DisplayModes::kModeMap = {
// clang-format off
// clang-format off
{0, "Dynamic"},
{1, "Standard"},
{2, "Natural"},
{3, "Cinema"},
{4, "Adaptive"},
{5, "Reading"},
// clang-format on
// clang-format on
};
DisplayModes::DisplayModes() : mDefaultModeId(0) {
@@ -71,7 +57,7 @@ bool DisplayModes::isSupported() {
}
// Methods from ::vendor::lineage::livedisplay::V2_0::IDisplayModes follow.
Return<void> DisplayModes::getDisplayModes(getDisplayModes_cb resultCb) {
ndk::ScopedAStatus DisplayModes::getDisplayModes(std::vector<DisplayMode>* _aidl_return) {
std::ifstream maxModeFile(kModeMaxPath);
int value;
std::vector<DisplayMode> modes;
@@ -83,11 +69,12 @@ Return<void> DisplayModes::getDisplayModes(getDisplayModes_cb resultCb) {
for (const auto& entry : kModeMap) {
if (entry.first < value) modes.push_back({entry.first, entry.second});
}
resultCb(modes);
return Void();
*_aidl_return = modes;
return ndk::ScopedAStatus::ok();
}
Return<void> DisplayModes::getCurrentDisplayMode(getCurrentDisplayMode_cb resultCb) {
ndk::ScopedAStatus DisplayModes::getCurrentDisplayMode(DisplayMode* _aidl_return) {
int32_t currentModeId = mDefaultModeId;
std::ifstream modeFile(kModePath);
int value;
@@ -100,41 +87,40 @@ Return<void> DisplayModes::getCurrentDisplayMode(getCurrentDisplayMode_cb result
}
}
}
resultCb({currentModeId, kModeMap.at(currentModeId)});
return Void();
*_aidl_return = DisplayMode{currentModeId, kModeMap.at(currentModeId)};
return ndk::ScopedAStatus::ok();
}
Return<void> DisplayModes::getDefaultDisplayMode(getDefaultDisplayMode_cb resultCb) {
resultCb({mDefaultModeId, kModeMap.at(mDefaultModeId)});
return Void();
ndk::ScopedAStatus DisplayModes::getDefaultDisplayMode(DisplayMode* _aidl_return) {
*_aidl_return = DisplayMode{mDefaultModeId, kModeMap.at(mDefaultModeId)};
return ndk::ScopedAStatus::ok();
}
Return<bool> DisplayModes::setDisplayMode(int32_t modeID, bool makeDefault) {
ndk::ScopedAStatus DisplayModes::setDisplayMode(int32_t modeID, bool makeDefault) {
const auto iter = kModeMap.find(modeID);
if (iter == kModeMap.end()) {
return false;
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
std::ofstream modeFile(kModePath);
modeFile << iter->first;
if (modeFile.fail()) {
return false;
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
if (makeDefault) {
std::ofstream defaultFile(kDefaultPath);
defaultFile << iter->first;
if (defaultFile.fail()) {
return false;
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
mDefaultModeId = iter->first;
}
return true;
return ndk::ScopedAStatus::ok();
}
// Methods from ::android::hidl::base::V1_0::IBase follow.
} // namespace samsung
} // namespace V2_0
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,55 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include <android-base/file.h>
#include <android-base/strings.h>
#include <livedisplay/samsung/ReadingEnhancementExynos.h>
#include <fstream>
using android::base::ReadFileToString;
using android::base::Trim;
using android::base::WriteStringToFile;
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
static constexpr const char* kREPath = "/sys/class/mdnie/mdnie/accessibility";
bool ReadingEnhancementExynos::isSupported() {
std::fstream file(kREPath, file.in | file.out);
return file.good();
}
// Methods from ::aidl::vendor::lineage::livedisplay::BnReadingEnhancement follow.
ndk::ScopedAStatus ReadingEnhancementExynos::getEnabled(bool* _aidl_return) {
std::string contents;
if (!ReadFileToString(kREPath, &contents)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
contents = Trim(contents);
*_aidl_return =
!contents.compare("Current accessibility : DSI0 : GRAYSCALE") || !contents.compare("4");
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus ReadingEnhancementExynos::setEnabled(bool enabled) {
if (!WriteStringToFile(enabled ? "4" : "0", kREPath, true)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
return ndk::ScopedAStatus::ok();
}
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,56 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include <android-base/file.h>
#include <android-base/strings.h>
#include <livedisplay/samsung/SunlightEnhancement.h>
#include <fstream>
using android::base::ReadFileToString;
using android::base::Trim;
using android::base::WriteStringToFile;
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
// Note: Exynos method is also available on Qualcomm
static constexpr const char* kSREPath = "/sys/class/mdnie/mdnie/outdoor";
bool SunlightEnhancement::isSupported() {
std::fstream file(kSREPath, file.in | file.out);
return file.good();
}
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
ndk::ScopedAStatus SunlightEnhancement::getEnabled(bool* _aidl_return) {
std::string tmp;
int32_t contents = 0;
if (!ReadFileToString(kSREPath, &tmp)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
contents = std::stoi(Trim(tmp));
*_aidl_return = contents == 1;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus SunlightEnhancement::setEnabled(bool enabled) {
if (!WriteStringToFile(enabled ? "1" : "0", kSREPath, true)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
return ndk::ScopedAStatus::ok();
}
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,56 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include <android-base/file.h>
#include <android-base/strings.h>
#include <livedisplay/samsung/SunlightEnhancementExynos.h>
#include <fstream>
using android::base::ReadFileToString;
using android::base::Trim;
using android::base::WriteStringToFile;
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
static constexpr const char* kLUXPath = "/sys/class/mdnie/mdnie/lux";
bool SunlightEnhancementExynos::isSupported() {
std::fstream file(kLUXPath, file.in | file.out);
return file.good();
}
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
ndk::ScopedAStatus SunlightEnhancementExynos::getEnabled(bool* _aidl_return) {
std::string tmp;
int32_t contents = 0;
if (!ReadFileToString(kLUXPath, &tmp)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
contents = std::stoi(Trim(tmp));
*_aidl_return = contents > 0;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus SunlightEnhancementExynos::setEnabled(bool enabled) {
/* see drivers/video/fbdev/exynos/decon_7880/panels/mdnie_lite_table*, get_hbm_index */
if (!WriteStringToFile(enabled ? "40000" : "0", kLUXPath, true)) {
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
return ndk::ScopedAStatus::ok();
}
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/lineage/livedisplay/BnAdaptiveBacklight.h>
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
class AdaptiveBacklight : public BnAdaptiveBacklight {
public:
bool isSupported();
// Methods from ::aidl::vendor::lineage::livedisplay::BnAdaptiveBacklight follow.
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
ndk::ScopedAStatus setEnabled(bool enabled) override;
};
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,31 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/lineage/livedisplay/BnDisplayColorCalibration.h>
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
class DisplayColorCalibration : public BnDisplayColorCalibration {
public:
bool isSupported();
// Methods from ::aidl::vendor::lineage::livedisplay::BnDisplayColorCalibration follow.
ndk::ScopedAStatus getMaxValue(int32_t* _aidl_return) override;
ndk::ScopedAStatus getMinValue(int32_t* _aidl_return) override;
ndk::ScopedAStatus getCalibration(std::vector<int32_t>* _aidl_return) override;
ndk::ScopedAStatus setCalibration(const std::vector<int32_t>& rgb) override;
};
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,38 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/lineage/livedisplay/BnDisplayModes.h>
#include <map>
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
class DisplayModes : public BnDisplayModes {
public:
DisplayModes();
bool isSupported();
// Methods from ::aidl::vendor::lineage::livedisplay::BnDisplayModes follow.
ndk::ScopedAStatus getDisplayModes(std::vector<DisplayMode>* _aidl_return) override;
ndk::ScopedAStatus getCurrentDisplayMode(DisplayMode* _aidl_return) override;
ndk::ScopedAStatus getDefaultDisplayMode(DisplayMode* _aidl_return) override;
ndk::ScopedAStatus setDisplayMode(int32_t modeID, bool makeDefault) override;
private:
static const std::map<int32_t, std::string> kModeMap;
int32_t mDefaultModeId;
};
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/lineage/livedisplay/BnReadingEnhancement.h>
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
class ReadingEnhancementExynos : public BnReadingEnhancement {
public:
bool isSupported();
// Methods from ::aidl::vendor::lineage::livedisplay::BnReadingEnhancement follow.
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
ndk::ScopedAStatus setEnabled(bool enabled) override;
};
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/lineage/livedisplay/BnSunlightEnhancement.h>
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
class SunlightEnhancement : public BnSunlightEnhancement {
public:
bool isSupported();
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
ndk::ScopedAStatus setEnabled(bool enabled) override;
};
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,29 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/lineage/livedisplay/BnSunlightEnhancement.h>
namespace aidl {
namespace vendor {
namespace lineage {
namespace livedisplay {
namespace samsung {
class SunlightEnhancementExynos : public BnSunlightEnhancement {
public:
bool isSupported();
// Methods from ::aidl::vendor::lineage::livedisplay::BnSunlightEnhancement follow.
ndk::ScopedAStatus getEnabled(bool* _aidl_return) override;
ndk::ScopedAStatus setEnabled(bool enabled) override;
};
} // namespace samsung
} // namespace livedisplay
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,111 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "vendor.lineage.livedisplay-service.samsung-qcom"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <binder/ProcessState.h>
#include <livedisplay/samsung/AdaptiveBacklight.h>
#include <livedisplay/samsung/DisplayColorCalibration.h>
#include <livedisplay/samsung/DisplayModes.h>
#include <livedisplay/samsung/SunlightEnhancement.h>
using ::aidl::vendor::lineage::livedisplay::samsung::AdaptiveBacklight;
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayColorCalibration;
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayModes;
using ::aidl::vendor::lineage::livedisplay::samsung::SunlightEnhancement;
int main() {
android::ProcessState::self()->setThreadPoolMaxThreadCount(1);
android::ProcessState::self()->startThreadPool();
std::shared_ptr<AdaptiveBacklight> adaptiveBacklight =
ndk::SharedRefBase::make<AdaptiveBacklight>();
std::shared_ptr<DisplayColorCalibration> displayColorCalibration =
ndk::SharedRefBase::make<DisplayColorCalibration>();
std::shared_ptr<DisplayModes> displayModes = ndk::SharedRefBase::make<DisplayModes>();
std::shared_ptr<SunlightEnhancement> sunlightEnhancement =
ndk::SharedRefBase::make<SunlightEnhancement>();
binder_status_t status;
LOG(INFO) << "LiveDisplay HAL service is starting.";
if (adaptiveBacklight == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, "
"exiting.";
goto shutdown;
}
if (displayColorCalibration == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration "
"Iface, exiting.";
goto shutdown;
}
if (displayModes == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting.";
goto shutdown;
}
if (sunlightEnhancement == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, "
"exiting.";
goto shutdown;
}
if (adaptiveBacklight->isSupported()) {
std::string instance = std::string(AdaptiveBacklight::descriptor) + "/default";
status = AServiceManager_addService(adaptiveBacklight->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface ("
<< status << ")";
goto shutdown;
}
}
if (displayColorCalibration->isSupported()) {
std::string instance = std::string(DisplayColorCalibration::descriptor) + "/default";
status = AServiceManager_addService(displayColorCalibration->asBinder().get(),
instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayColorCalibration "
"Iface ("
<< status << ")";
goto shutdown;
}
}
if (displayModes->isSupported()) {
std::string instance = std::string(DisplayModes::descriptor) + "/default";
status = AServiceManager_addService(displayModes->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface ("
<< status << ")";
goto shutdown;
}
}
if (sunlightEnhancement->isSupported()) {
std::string instance = std::string(SunlightEnhancement::descriptor) + "/default";
status =
AServiceManager_addService(sunlightEnhancement->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR)
<< "Could not register service for LiveDisplay HAL SunlightEnhancement Iface ("
<< status << ")";
goto shutdown;
}
}
LOG(INFO) << "LiveDisplay HAL service is ready.";
ABinderProcess_joinThreadPool();
shutdown:
// In normal operation, we don't expect the thread pool to shutdown
LOG(ERROR) << "LiveDisplay HAL service is shutting down.";
return EXIT_FAILURE;
}

View File

@@ -0,0 +1,132 @@
/*
* SPDX-FileCopyrightText: 2019-2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "vendor.lineage.livedisplay-service.samsung-exynos"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
#include <binder/ProcessState.h>
#include <livedisplay/samsung/AdaptiveBacklight.h>
#include <livedisplay/samsung/DisplayColorCalibration.h>
#include <livedisplay/samsung/DisplayModes.h>
#include <livedisplay/samsung/ReadingEnhancementExynos.h>
#include <livedisplay/samsung/SunlightEnhancementExynos.h>
using ::aidl::vendor::lineage::livedisplay::samsung::AdaptiveBacklight;
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayColorCalibration;
using ::aidl::vendor::lineage::livedisplay::samsung::DisplayModes;
using ::aidl::vendor::lineage::livedisplay::samsung::ReadingEnhancementExynos;
using ::aidl::vendor::lineage::livedisplay::samsung::SunlightEnhancementExynos;
int main() {
android::ProcessState::self()->setThreadPoolMaxThreadCount(1);
android::ProcessState::self()->startThreadPool();
std::shared_ptr<AdaptiveBacklight> adaptiveBacklight =
ndk::SharedRefBase::make<AdaptiveBacklight>();
std::shared_ptr<DisplayColorCalibration> displayColorCalibration =
ndk::SharedRefBase::make<DisplayColorCalibration>();
std::shared_ptr<DisplayModes> displayModes = ndk::SharedRefBase::make<DisplayModes>();
std::shared_ptr<ReadingEnhancementExynos> readingEnhancement =
ndk::SharedRefBase::make<ReadingEnhancementExynos>();
std::shared_ptr<SunlightEnhancementExynos> sunlightEnhancement =
ndk::SharedRefBase::make<SunlightEnhancementExynos>();
binder_status_t status;
LOG(INFO) << "LiveDisplay HAL service is starting.";
if (adaptiveBacklight == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL AdaptiveBacklight Iface, "
"exiting.";
goto shutdown;
}
if (displayColorCalibration == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayColorCalibration "
"Iface, exiting.";
goto shutdown;
}
if (displayModes == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL DisplayModes Iface, exiting.";
goto shutdown;
}
if (readingEnhancement == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL ReadingEnhancement Iface, "
"exiting.";
goto shutdown;
}
if (sunlightEnhancement == nullptr) {
LOG(ERROR) << "Can not create an instance of LiveDisplay HAL SunlightEnhancement Iface, "
"exiting.";
goto shutdown;
}
if (adaptiveBacklight->isSupported()) {
std::string instance = std::string(AdaptiveBacklight::descriptor) + "/default";
status = AServiceManager_addService(adaptiveBacklight->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR) << "Could not register service for LiveDisplay HAL AdaptiveBacklight Iface ("
<< status << ")";
goto shutdown;
}
}
if (displayColorCalibration->isSupported()) {
std::string instance = std::string(DisplayColorCalibration::descriptor) + "/default";
status = AServiceManager_addService(displayColorCalibration->asBinder().get(),
instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayColorCalibration "
"Iface ("
<< status << ")";
goto shutdown;
}
}
if (displayModes->isSupported()) {
std::string instance = std::string(DisplayModes::descriptor) + "/default";
status = AServiceManager_addService(displayModes->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR) << "Could not register service for LiveDisplay HAL DisplayModes Iface ("
<< status << ")";
goto shutdown;
}
}
if (readingEnhancement->isSupported()) {
std::string instance = std::string(ReadingEnhancementExynos::descriptor) + "/default";
status = AServiceManager_addService(readingEnhancement->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR)
<< "Could not register service for LiveDisplay HAL ReadingEnhancement Iface ("
<< status << ")";
goto shutdown;
}
}
if (sunlightEnhancement->isSupported()) {
std::string instance = std::string(SunlightEnhancementExynos::descriptor) + "/default";
status =
AServiceManager_addService(sunlightEnhancement->asBinder().get(), instance.c_str());
if (status != STATUS_OK) {
LOG(ERROR)
<< "Could not register service for LiveDisplay HAL SunlightEnhancement Iface ("
<< status << ")";
goto shutdown;
}
}
LOG(INFO) << "LiveDisplay HAL service is ready.";
ABinderProcess_joinThreadPool();
shutdown:
// In normal operation, we don't expect the thread pool to shutdown
LOG(ERROR) << "LiveDisplay HAL service is shutting down.";
return EXIT_FAILURE;
}

View File

@@ -0,0 +1,7 @@
on post-fs-data
mkdir /data/vendor/display 0770 system system
service vendor.livedisplay-hal-samsung-exynos /vendor/bin/hw/vendor.lineage.livedisplay-service.samsung-exynos
class hal
user system
group system

View File

@@ -0,0 +1,7 @@
on post-fs-data
mkdir /data/vendor/display 0770 system system
service vendor.livedisplay-hal-samsung-qcom /vendor/bin/hw/vendor.lineage.livedisplay-service.samsung-qcom
class late_start
user system
group system

View File

@@ -38,11 +38,15 @@ uint64_t readNode(const std::string node, pid_t pid) {
return out;
}
} // namespace
} // namespace
uint64_t GpuSysfsReader::getDmaBufGpuMem(pid_t pid) { return readNode(kDmaBufGpuMemNode, pid); }
uint64_t GpuSysfsReader::getDmaBufGpuMem(pid_t pid) {
return readNode(kDmaBufGpuMemNode, pid);
}
uint64_t GpuSysfsReader::getGpuMemTotal(pid_t pid) { return readNode(kTotalGpuMemNode, pid); }
uint64_t GpuSysfsReader::getGpuMemTotal(pid_t pid) {
return readNode(kTotalGpuMemNode, pid);
}
uint64_t GpuSysfsReader::getPrivateGpuMem(pid_t pid) {
auto dma_buf_size = getDmaBufGpuMem(pid);

View File

@@ -14,4 +14,4 @@ constexpr char kProcessDir[] = "kprcs";
constexpr char kMappedDmaBufsDir[] = "dma_bufs";
constexpr char kTotalGpuMemNode[] = "total_gpu_mem";
constexpr char kDmaBufGpuMemNode[] = "dma_buf_gpu_mem";
} // namespace GpuSysfsReader
} // namespace GpuSysfsReader

View File

@@ -18,22 +18,26 @@ namespace memtrack {
ndk::ScopedAStatus Memtrack::getMemory(int pid, MemtrackType type,
std::vector<MemtrackRecord>* _aidl_return) {
if (pid < 0)
if (pid < 0) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT));
}
if (type != MemtrackType::OTHER && type != MemtrackType::GL && type != MemtrackType::GRAPHICS &&
type != MemtrackType::MULTIMEDIA && type != MemtrackType::CAMERA)
type != MemtrackType::MULTIMEDIA && type != MemtrackType::CAMERA) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
_aidl_return->clear();
// Other types are retained only for backward compatibility
if (type != MemtrackType::GL && type != MemtrackType::GRAPHICS)
if (type != MemtrackType::GL && type != MemtrackType::GRAPHICS) {
return ndk::ScopedAStatus::ok();
}
// pid 0 is only supported for GL type to report total private memory
if (pid == 0 && type != MemtrackType::GL)
if (pid == 0 && type != MemtrackType::GL) {
return ndk::ScopedAStatus::ok();
}
uint64_t size = 0;
switch (type) {
@@ -73,7 +77,7 @@ ndk::ScopedAStatus Memtrack::getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_ret
return ndk::ScopedAStatus::ok();
}
} // namespace memtrack
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace memtrack
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -12,14 +12,14 @@ namespace hardware {
namespace memtrack {
class Memtrack : public BnMemtrack {
public:
public:
ndk::ScopedAStatus getMemory(int pid, MemtrackType type,
std::vector<MemtrackRecord>* _aidl_return) override;
ndk::ScopedAStatus getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_return) override;
};
} // namespace memtrack
} // namespace hardware
} // namespace android
} // namespace aidl
} // namespace memtrack
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -19,16 +19,18 @@ bool exists(const path& p) {
bool is_directory(const path& p) {
struct stat s;
if (stat(p.string().c_str(), &s))
if (stat(p.string().c_str(), &s)) {
return false;
}
return S_ISDIR(s.st_mode);
}
bool is_symlink(const path& p) {
struct stat s;
if (lstat(p.string().c_str(), &s))
if (lstat(p.string().c_str(), &s)) {
return false;
}
return S_ISLNK(s.st_mode);
}
@@ -45,8 +47,9 @@ path read_symlink(const path& p) {
}
std::vector<directory_entry> directory_iterator(const path& p) {
if (!exists(p) || !is_directory(p))
if (!exists(p) || !is_directory(p)) {
return {};
}
std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(p.string().c_str()), &closedir);
if (!dir) {
@@ -56,8 +59,9 @@ std::vector<directory_entry> directory_iterator(const path& p) {
std::vector<directory_entry> out;
struct dirent* dent;
while ((dent = readdir(dir.get()))) {
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, ".."))
if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) {
continue;
}
std::stringstream ss(p.string());
ss << "/" << dent->d_name;
@@ -67,4 +71,4 @@ std::vector<directory_entry> directory_iterator(const path& p) {
return out;
}
} // namespace filesystem
} // namespace filesystem

View File

@@ -16,13 +16,12 @@
namespace filesystem {
class path {
public:
public:
path(const std::string _path) : strPath(_path) {}
path filename() const {
auto pos = strPath.rfind('/');
if (pos == std::string::npos)
return path(strPath);
if (pos == std::string::npos) return path(strPath);
pos++;
auto l = strPath.size();
@@ -31,19 +30,17 @@ public:
std::string string() const { return strPath; }
private:
private:
std::string strPath;
};
class directory_entry {
public:
public:
directory_entry(const std::string _path) : p(_path) {}
class path path() {
return p;
}
class path path() { return p; }
private:
private:
class path p;
};
@@ -57,4 +54,4 @@ path read_symlink(const path& p);
// Vector is easier to create than an iterator and serves our purposes well
std::vector<directory_entry> directory_iterator(const path& p);
} // namespace filesystem
} // namespace filesystem

View File

@@ -19,5 +19,5 @@ int main() {
CHECK(status == STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // Unreachable
return EXIT_FAILURE; // Unreachable
}

View File

@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.memtrack</name>
<version>1</version>
<fqname>IMemtrack/default</fqname>
</hal>
</manifest>

View File

@@ -0,0 +1,24 @@
//
// SPDX-FileCopyrightText: 2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
cc_binary {
name: "vendor.lineage.powershare-service.samsung",
defaults: ["samsung_header_path_defaults"],
vintf_fragments: ["vendor.lineage.powershare-service.samsung.xml"],
init_rc: ["vendor.lineage.powershare-service.samsung.rc"],
vendor: true,
relative_install_path: "hw",
srcs: [
"PowerShare.cpp",
"service.cpp",
],
shared_libs: [
"libbase",
"liblog",
"libbinder_ndk",
"libutils",
"vendor.lineage.powershare-V1-ndk",
],
}

View File

@@ -0,0 +1,69 @@
/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#define LOG_TAG "vendor.lineage.powershare-service.samsung"
#include "PowerShare.h"
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/strings.h>
#include <samsung_powershare.h>
using ::android::base::ReadFileToString;
using ::android::base::Trim;
using ::android::base::WriteStringToFile;
namespace aidl {
namespace vendor {
namespace lineage {
namespace powershare {
ndk::ScopedAStatus PowerShare::getMinBattery(int32_t* _aidl_return) {
std::string value;
if (!ReadFileToString(POWERSHARE_STOP_CAPACITY_PATH, &value)) {
LOG(ERROR) << "Failed to get PowerShare minimum battery level";
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
*_aidl_return = std::stoi(value);
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus PowerShare::isEnabled(bool* _aidl_return) {
std::string value;
if (!ReadFileToString(POWERSHARE_PATH, &value)) {
LOG(ERROR) << "Failed to read current PowerShare state";
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}
*_aidl_return = Trim(value) == POWERSHARE_ENABLED;
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus PowerShare::setEnabled(bool enable) {
std::string value = enable ? POWERSHARE_ENABLED : POWERSHARE_DISABLED;
if (!WriteStringToFile(value, POWERSHARE_PATH)) {
LOG(ERROR) << "Failed to write PowerShare state";
return ndk::ScopedAStatus::fromExceptionCode(EX_SERVICE_SPECIFIC);
}
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus PowerShare::setMinBattery(int32_t minBattery) {
if (!WriteStringToFile(std::to_string(minBattery), POWERSHARE_STOP_CAPACITY_PATH)) {
LOG(ERROR) << "Failed to set PowerShare minimum battery level";
return ndk::ScopedAStatus::fromExceptionCode(EX_SERVICE_SPECIFIC);
}
return ndk::ScopedAStatus::ok();
}
} // namespace powershare
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,26 @@
/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <aidl/vendor/lineage/powershare/BnPowerShare.h>
namespace aidl {
namespace vendor {
namespace lineage {
namespace powershare {
class PowerShare : public BnPowerShare {
public:
ndk::ScopedAStatus getMinBattery(int32_t* _aidl_return) override;
ndk::ScopedAStatus isEnabled(bool* _aidl_return) override;
ndk::ScopedAStatus setEnabled(bool enable) override;
ndk::ScopedAStatus setMinBattery(int32_t minBattery) override;
};
} // namespace powershare
} // namespace lineage
} // namespace vendor
} // namespace aidl

View File

@@ -0,0 +1,12 @@
/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#define POWERSHARE_DISABLED "0"
#define POWERSHARE_ENABLED "1"
#define POWERSHARE_PATH "/sys/class/power_supply/battery/wc_tx_en"
#define POWERSHARE_STOP_CAPACITY_PATH "/sys/class/power_supply/battery/wc_tx_stop_capacity"

View File

@@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: 2025 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
#include "PowerShare.h"
#include <android-base/logging.h>
#include <android/binder_manager.h>
#include <android/binder_process.h>
using aidl::vendor::lineage::powershare::PowerShare;
int main() {
ABinderProcess_setThreadPoolMaxThreadCount(0);
std::shared_ptr<PowerShare> powershare = ndk::SharedRefBase::make<PowerShare>();
const std::string instance = std::string(PowerShare::descriptor) + "/default";
binder_status_t status =
AServiceManager_addService(powershare->asBinder().get(), instance.c_str());
CHECK_EQ(status, STATUS_OK);
ABinderProcess_joinThreadPool();
return EXIT_FAILURE; // should not reach
}

View File

@@ -0,0 +1,10 @@
on init
chown system system /sys/class/power_supply/battery/wc_tx_en
chown system system /sys/class/power_supply/battery/wc_tx_stop_capacity
chmod 0664 /sys/class/power_supply/battery/wc_tx_en
chmod 0664 /sys/class/power_supply/battery/wc_tx_stop_capacity
service vendor.powershare-hal /vendor/bin/hw/vendor.lineage.powershare-service.samsung
class hal
user system
group system

View File

@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.thermal</name>
<name>vendor.lineage.powershare</name>
<version>1</version>
<fqname>IThermal/default</fqname>
<fqname>IPowerShare/default</fqname>
</hal>
</manifest>

View File

@@ -1,5 +1,6 @@
//
// Copyright (C) 2020 The Android Open Source Project
// Copyright (C) 2022-2024 The LineageOS Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -15,27 +16,23 @@
cc_binary {
name: "android.hardware.sensors-service.samsung-multihal",
defaults: [
"hidl_defaults",
],
vendor: true,
relative_install_path: "hw",
srcs: [
"ConvertUtils.cpp",
"HalProxyAidl.cpp",
"HalProxySamsung.cpp",
"service.cpp",
],
local_include_dirs: ["include"],
init_rc: ["android.hardware.sensors-service.samsung-multihal.rc"],
vintf_fragments: ["android.hardware.sensors-samsung-multihal.xml"],
header_libs: [
"android.hardware.sensors@2.X-multihal.header",
"android.hardware.sensors@2.X-shared-utils",
],
shared_libs: [
"android.hardware.sensors@2.0",
"android.hardware.sensors@2.0-ScopedWakelock",
"android.hardware.sensors@2.1",
"android.hardware.sensors-V1-ndk",
"android.hardware.sensors-V3-ndk",
"libbase",
"libbinder_ndk",
"libcutils",
@@ -48,6 +45,13 @@ cc_binary {
static_libs: [
"android.hardware.sensors@1.0-convert",
"android.hardware.sensors@2.X-multihal",
"android.hardware.sensors@aidl-multihal",
"libaidlcommonsupport",
],
}
cc_library_shared {
name: "sensors.sensorhub_wait_for_mcu",
srcs: ["SensorHubWaitForMCUInit.cpp"],
vendor: true,
}

View File

@@ -1,363 +0,0 @@
/*
* Copyright (C) 2021 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 "ConvertUtils.h"
#include <android-base/logging.h>
#include <log/log.h>
using AidlSensorInfo = ::aidl::android::hardware::sensors::SensorInfo;
using AidlSensorType = ::aidl::android::hardware::sensors::SensorType;
using AidlEvent = ::aidl::android::hardware::sensors::Event;
using AidlSensorStatus = ::aidl::android::hardware::sensors::SensorStatus;
using ::aidl::android::hardware::sensors::AdditionalInfo;
using ::aidl::android::hardware::sensors::DynamicSensorInfo;
using ::android::hardware::sensors::V1_0::MetaDataEventType;
using V1_0SensorStatus = ::android::hardware::sensors::V1_0::SensorStatus;
using ::android::hardware::sensors::V1_0::AdditionalInfoType;
using V2_1SensorInfo = ::android::hardware::sensors::V2_1::SensorInfo;
using V2_1Event = ::android::hardware::sensors::V2_1::Event;
using V2_1SensorType = ::android::hardware::sensors::V2_1::SensorType;
namespace aidl {
namespace android {
namespace hardware {
namespace sensors {
namespace implementation {
AidlSensorInfo convertSensorInfo(const V2_1SensorInfo& sensorInfo) {
AidlSensorInfo aidlSensorInfo;
aidlSensorInfo.sensorHandle = sensorInfo.sensorHandle;
aidlSensorInfo.name = sensorInfo.name;
aidlSensorInfo.vendor = sensorInfo.vendor;
aidlSensorInfo.version = sensorInfo.version;
aidlSensorInfo.type = (AidlSensorType)sensorInfo.type;
aidlSensorInfo.typeAsString = sensorInfo.typeAsString;
aidlSensorInfo.maxRange = sensorInfo.maxRange;
aidlSensorInfo.resolution = sensorInfo.resolution;
aidlSensorInfo.power = sensorInfo.power;
aidlSensorInfo.minDelayUs = sensorInfo.minDelay;
aidlSensorInfo.fifoReservedEventCount = sensorInfo.fifoReservedEventCount;
aidlSensorInfo.fifoMaxEventCount = sensorInfo.fifoMaxEventCount;
aidlSensorInfo.requiredPermission = sensorInfo.requiredPermission;
aidlSensorInfo.maxDelayUs = sensorInfo.maxDelay;
aidlSensorInfo.flags = sensorInfo.flags;
return aidlSensorInfo;
}
void convertToHidlEvent(const AidlEvent& aidlEvent, V2_1Event* hidlEvent) {
static_assert(decltype(hidlEvent->u.data)::elementCount() == 16);
hidlEvent->timestamp = aidlEvent.timestamp;
hidlEvent->sensorHandle = aidlEvent.sensorHandle;
hidlEvent->sensorType = (V2_1SensorType)aidlEvent.sensorType;
switch (aidlEvent.sensorType) {
case AidlSensorType::META_DATA:
hidlEvent->u.meta.what =
(MetaDataEventType)aidlEvent.payload.get<Event::EventPayload::meta>().what;
break;
case AidlSensorType::ACCELEROMETER:
case AidlSensorType::MAGNETIC_FIELD:
case AidlSensorType::ORIENTATION:
case AidlSensorType::GYROSCOPE:
case AidlSensorType::GRAVITY:
case AidlSensorType::LINEAR_ACCELERATION:
hidlEvent->u.vec3.x = aidlEvent.payload.get<Event::EventPayload::vec3>().x;
hidlEvent->u.vec3.y = aidlEvent.payload.get<Event::EventPayload::vec3>().y;
hidlEvent->u.vec3.z = aidlEvent.payload.get<Event::EventPayload::vec3>().z;
hidlEvent->u.vec3.status =
(V1_0SensorStatus)aidlEvent.payload.get<Event::EventPayload::vec3>().status;
break;
case AidlSensorType::GAME_ROTATION_VECTOR:
hidlEvent->u.vec4.x = aidlEvent.payload.get<Event::EventPayload::vec4>().x;
hidlEvent->u.vec4.y = aidlEvent.payload.get<Event::EventPayload::vec4>().y;
hidlEvent->u.vec4.z = aidlEvent.payload.get<Event::EventPayload::vec4>().z;
hidlEvent->u.vec4.w = aidlEvent.payload.get<Event::EventPayload::vec4>().w;
break;
case AidlSensorType::ROTATION_VECTOR:
case AidlSensorType::GEOMAGNETIC_ROTATION_VECTOR:
std::copy(aidlEvent.payload.get<Event::EventPayload::data>().values.data(),
aidlEvent.payload.get<Event::EventPayload::data>().values.data() + 5,
hidlEvent->u.data.data());
break;
case AidlSensorType::ACCELEROMETER_UNCALIBRATED:
case AidlSensorType::MAGNETIC_FIELD_UNCALIBRATED:
case AidlSensorType::GYROSCOPE_UNCALIBRATED:
hidlEvent->u.uncal.x = aidlEvent.payload.get<Event::EventPayload::uncal>().x;
hidlEvent->u.uncal.y = aidlEvent.payload.get<Event::EventPayload::uncal>().y;
hidlEvent->u.uncal.z = aidlEvent.payload.get<Event::EventPayload::uncal>().z;
hidlEvent->u.uncal.x_bias = aidlEvent.payload.get<Event::EventPayload::uncal>().xBias;
hidlEvent->u.uncal.y_bias = aidlEvent.payload.get<Event::EventPayload::uncal>().yBias;
hidlEvent->u.uncal.z_bias = aidlEvent.payload.get<Event::EventPayload::uncal>().zBias;
break;
case AidlSensorType::DEVICE_ORIENTATION:
case AidlSensorType::LIGHT:
case AidlSensorType::PRESSURE:
case AidlSensorType::PROXIMITY:
case AidlSensorType::RELATIVE_HUMIDITY:
case AidlSensorType::AMBIENT_TEMPERATURE:
case AidlSensorType::SIGNIFICANT_MOTION:
case AidlSensorType::STEP_DETECTOR:
case AidlSensorType::TILT_DETECTOR:
case AidlSensorType::WAKE_GESTURE:
case AidlSensorType::GLANCE_GESTURE:
case AidlSensorType::PICK_UP_GESTURE:
case AidlSensorType::WRIST_TILT_GESTURE:
case AidlSensorType::STATIONARY_DETECT:
case AidlSensorType::MOTION_DETECT:
case AidlSensorType::HEART_BEAT:
case AidlSensorType::LOW_LATENCY_OFFBODY_DETECT:
case AidlSensorType::HINGE_ANGLE:
hidlEvent->u.scalar = aidlEvent.payload.get<Event::EventPayload::scalar>();
break;
case AidlSensorType::STEP_COUNTER:
hidlEvent->u.stepCount = aidlEvent.payload.get<AidlEvent::EventPayload::stepCount>();
break;
case AidlSensorType::HEART_RATE:
hidlEvent->u.heartRate.bpm =
aidlEvent.payload.get<AidlEvent::EventPayload::heartRate>().bpm;
hidlEvent->u.heartRate.status =
(V1_0SensorStatus)aidlEvent.payload.get<Event::EventPayload::heartRate>()
.status;
break;
case AidlSensorType::POSE_6DOF:
std::copy(std::begin(aidlEvent.payload.get<AidlEvent::EventPayload::pose6DOF>().values),
std::end(aidlEvent.payload.get<AidlEvent::EventPayload::pose6DOF>().values),
hidlEvent->u.pose6DOF.data());
break;
case AidlSensorType::DYNAMIC_SENSOR_META:
hidlEvent->u.dynamic.connected =
aidlEvent.payload.get<Event::EventPayload::dynamic>().connected;
hidlEvent->u.dynamic.sensorHandle =
aidlEvent.payload.get<Event::EventPayload::dynamic>().sensorHandle;
std::copy(
std::begin(
aidlEvent.payload.get<AidlEvent::EventPayload::dynamic>().uuid.values),
std::end(aidlEvent.payload.get<AidlEvent::EventPayload::dynamic>().uuid.values),
hidlEvent->u.dynamic.uuid.data());
break;
case AidlSensorType::ADDITIONAL_INFO: {
const AdditionalInfo& additionalInfo =
aidlEvent.payload.get<AidlEvent::EventPayload::additional>();
hidlEvent->u.additional.type = (AdditionalInfoType)additionalInfo.type;
hidlEvent->u.additional.serial = additionalInfo.serial;
switch (additionalInfo.payload.getTag()) {
case AdditionalInfo::AdditionalInfoPayload::Tag::dataInt32: {
const auto& aidlData =
additionalInfo.payload
.get<AdditionalInfo::AdditionalInfoPayload::dataInt32>()
.values;
std::copy(std::begin(aidlData), std::end(aidlData),
hidlEvent->u.additional.u.data_int32.data());
break;
}
case AdditionalInfo::AdditionalInfoPayload::Tag::dataFloat: {
const auto& aidlData =
additionalInfo.payload
.get<AdditionalInfo::AdditionalInfoPayload::dataFloat>()
.values;
std::copy(std::begin(aidlData), std::end(aidlData),
hidlEvent->u.additional.u.data_float.data());
break;
}
default:
ALOGE("Invalid sensor additioanl info tag: %d",
static_cast<int32_t>(additionalInfo.payload.getTag()));
break;
}
break;
}
case AidlSensorType::HEAD_TRACKER: {
const auto& ht = aidlEvent.payload.get<Event::EventPayload::headTracker>();
hidlEvent->u.data[0] = ht.rx;
hidlEvent->u.data[1] = ht.ry;
hidlEvent->u.data[2] = ht.rz;
hidlEvent->u.data[3] = ht.vx;
hidlEvent->u.data[4] = ht.vy;
hidlEvent->u.data[5] = ht.vz;
// IMPORTANT: Because we want to preserve the data range of discontinuityCount,
// we assume the data can be interpreted as an int32_t directly (e.g. the underlying
// HIDL HAL must be using memcpy or equivalent to store this value).
*(reinterpret_cast<int32_t*>(&hidlEvent->u.data[6])) = ht.discontinuityCount;
break;
}
default: {
CHECK_GE((int32_t)aidlEvent.sensorType, (int32_t)SensorType::DEVICE_PRIVATE_BASE);
std::copy(std::begin(aidlEvent.payload.get<AidlEvent::EventPayload::data>().values),
std::end(aidlEvent.payload.get<AidlEvent::EventPayload::data>().values),
hidlEvent->u.data.data());
break;
}
}
}
void convertToAidlEvent(const V2_1Event& hidlEvent, AidlEvent* aidlEvent) {
static_assert(decltype(hidlEvent.u.data)::elementCount() == 16);
aidlEvent->timestamp = hidlEvent.timestamp;
aidlEvent->sensorHandle = hidlEvent.sensorHandle;
aidlEvent->sensorType = (AidlSensorType)hidlEvent.sensorType;
switch (hidlEvent.sensorType) {
case V2_1SensorType::META_DATA: {
AidlEvent::EventPayload::MetaData meta;
meta.what = (Event::EventPayload::MetaData::MetaDataEventType)hidlEvent.u.meta.what;
aidlEvent->payload.set<Event::EventPayload::meta>(meta);
break;
}
case V2_1SensorType::ACCELEROMETER:
case V2_1SensorType::MAGNETIC_FIELD:
case V2_1SensorType::ORIENTATION:
case V2_1SensorType::GYROSCOPE:
case V2_1SensorType::GRAVITY:
case V2_1SensorType::LINEAR_ACCELERATION: {
AidlEvent::EventPayload::Vec3 vec3;
vec3.x = hidlEvent.u.vec3.x;
vec3.y = hidlEvent.u.vec3.y;
vec3.z = hidlEvent.u.vec3.z;
vec3.status = (SensorStatus)hidlEvent.u.vec3.status;
aidlEvent->payload.set<Event::EventPayload::vec3>(vec3);
break;
}
case V2_1SensorType::GAME_ROTATION_VECTOR: {
AidlEvent::EventPayload::Vec4 vec4;
vec4.x = hidlEvent.u.vec4.x;
vec4.y = hidlEvent.u.vec4.y;
vec4.z = hidlEvent.u.vec4.z;
vec4.w = hidlEvent.u.vec4.w;
aidlEvent->payload.set<Event::EventPayload::vec4>(vec4);
break;
}
case V2_1SensorType::ROTATION_VECTOR:
case V2_1SensorType::GEOMAGNETIC_ROTATION_VECTOR: {
AidlEvent::EventPayload::Data data;
std::copy(hidlEvent.u.data.data(), hidlEvent.u.data.data() + 5,
std::begin(data.values));
aidlEvent->payload.set<Event::EventPayload::data>(data);
break;
}
case V2_1SensorType::MAGNETIC_FIELD_UNCALIBRATED:
case V2_1SensorType::GYROSCOPE_UNCALIBRATED:
case V2_1SensorType::ACCELEROMETER_UNCALIBRATED: {
AidlEvent::EventPayload::Uncal uncal;
uncal.x = hidlEvent.u.uncal.x;
uncal.y = hidlEvent.u.uncal.y;
uncal.z = hidlEvent.u.uncal.z;
uncal.xBias = hidlEvent.u.uncal.x_bias;
uncal.yBias = hidlEvent.u.uncal.y_bias;
uncal.zBias = hidlEvent.u.uncal.z_bias;
aidlEvent->payload.set<Event::EventPayload::uncal>(uncal);
break;
}
case V2_1SensorType::DEVICE_ORIENTATION:
case V2_1SensorType::LIGHT:
case V2_1SensorType::PRESSURE:
case V2_1SensorType::PROXIMITY:
case V2_1SensorType::RELATIVE_HUMIDITY:
case V2_1SensorType::AMBIENT_TEMPERATURE:
case V2_1SensorType::SIGNIFICANT_MOTION:
case V2_1SensorType::STEP_DETECTOR:
case V2_1SensorType::TILT_DETECTOR:
case V2_1SensorType::WAKE_GESTURE:
case V2_1SensorType::GLANCE_GESTURE:
case V2_1SensorType::PICK_UP_GESTURE:
case V2_1SensorType::WRIST_TILT_GESTURE:
case V2_1SensorType::STATIONARY_DETECT:
case V2_1SensorType::MOTION_DETECT:
case V2_1SensorType::HEART_BEAT:
case V2_1SensorType::LOW_LATENCY_OFFBODY_DETECT:
case V2_1SensorType::HINGE_ANGLE:
aidlEvent->payload.set<Event::EventPayload::scalar>(hidlEvent.u.scalar);
break;
case V2_1SensorType::STEP_COUNTER:
aidlEvent->payload.set<Event::EventPayload::stepCount>(hidlEvent.u.stepCount);
break;
case V2_1SensorType::HEART_RATE: {
AidlEvent::EventPayload::HeartRate heartRate;
heartRate.bpm = hidlEvent.u.heartRate.bpm;
heartRate.status = (SensorStatus)hidlEvent.u.heartRate.status;
aidlEvent->payload.set<Event::EventPayload::heartRate>(heartRate);
break;
}
case V2_1SensorType::POSE_6DOF: {
AidlEvent::EventPayload::Pose6Dof pose6Dof;
std::copy(hidlEvent.u.pose6DOF.data(),
hidlEvent.u.pose6DOF.data() + hidlEvent.u.pose6DOF.size(),
std::begin(pose6Dof.values));
aidlEvent->payload.set<Event::EventPayload::pose6DOF>(pose6Dof);
break;
}
case V2_1SensorType::DYNAMIC_SENSOR_META: {
DynamicSensorInfo dynamicSensorInfo;
dynamicSensorInfo.connected = hidlEvent.u.dynamic.connected;
dynamicSensorInfo.sensorHandle = hidlEvent.u.dynamic.sensorHandle;
std::copy(hidlEvent.u.dynamic.uuid.data(),
hidlEvent.u.dynamic.uuid.data() + hidlEvent.u.dynamic.uuid.size(),
std::begin(dynamicSensorInfo.uuid.values));
aidlEvent->payload.set<Event::EventPayload::dynamic>(dynamicSensorInfo);
break;
}
case V2_1SensorType::ADDITIONAL_INFO: {
AdditionalInfo additionalInfo;
additionalInfo.type = (AdditionalInfo::AdditionalInfoType)hidlEvent.u.additional.type;
additionalInfo.serial = hidlEvent.u.additional.serial;
AdditionalInfo::AdditionalInfoPayload::Int32Values int32Values;
std::copy(hidlEvent.u.additional.u.data_int32.data(),
hidlEvent.u.additional.u.data_int32.data() +
hidlEvent.u.additional.u.data_int32.size(),
std::begin(int32Values.values));
additionalInfo.payload.set<AdditionalInfo::AdditionalInfoPayload::dataInt32>(
int32Values);
aidlEvent->payload.set<Event::EventPayload::additional>(additionalInfo);
break;
}
default: {
if (static_cast<int32_t>(hidlEvent.sensorType) ==
static_cast<int32_t>(AidlSensorType::HEAD_TRACKER)) {
Event::EventPayload::HeadTracker headTracker;
headTracker.rx = hidlEvent.u.data[0];
headTracker.ry = hidlEvent.u.data[1];
headTracker.rz = hidlEvent.u.data[2];
headTracker.vx = hidlEvent.u.data[3];
headTracker.vy = hidlEvent.u.data[4];
headTracker.vz = hidlEvent.u.data[5];
// IMPORTANT: Because we want to preserve the data range of discontinuityCount,
// we assume the data can be interpreted as an int32_t directly (e.g. the underlying
// HIDL HAL must be using memcpy or equivalent to store this value).
headTracker.discontinuityCount =
*(reinterpret_cast<const int32_t*>(&hidlEvent.u.data[6]));
aidlEvent->payload.set<Event::EventPayload::Tag::headTracker>(headTracker);
} else {
CHECK_GE((int32_t)hidlEvent.sensorType,
(int32_t)V2_1SensorType::DEVICE_PRIVATE_BASE);
AidlEvent::EventPayload::Data data;
std::copy(hidlEvent.u.data.data(),
hidlEvent.u.data.data() + hidlEvent.u.data.size(),
std::begin(data.values));
aidlEvent->payload.set<Event::EventPayload::data>(data);
}
break;
}
}
}
} // namespace implementation
} // namespace sensors
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -1,269 +0,0 @@
/*
* Copyright (C) 2021 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.
*/
//#define VERBOSE
#include "HalProxyAidl.h"
#include <aidlcommonsupport/NativeHandle.h>
#include <fmq/AidlMessageQueue.h>
#include <hidl/Status.h>
#include "ConvertUtils.h"
#include "EventMessageQueueWrapperAidl.h"
#include "ISensorsCallbackWrapperAidl.h"
#include "WakeLockMessageQueueWrapperAidl.h"
#include "convertV2_1.h"
using ::aidl::android::hardware::common::fmq::MQDescriptor;
using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite;
using ::aidl::android::hardware::sensors::ISensors;
using ::aidl::android::hardware::sensors::ISensorsCallback;
using ::aidl::android::hardware::sensors::SensorInfo;
using ::android::hardware::sensors::V2_1::implementation::convertToOldEvent;
using ::ndk::ScopedAStatus;
namespace aidl {
namespace android {
namespace hardware {
namespace sensors {
namespace implementation {
static ScopedAStatus
resultToAStatus(::android::hardware::sensors::V1_0::Result result) {
switch (result) {
case ::android::hardware::sensors::V1_0::Result::OK:
return ScopedAStatus::ok();
case ::android::hardware::sensors::V1_0::Result::PERMISSION_DENIED:
return ScopedAStatus::fromExceptionCode(EX_SECURITY);
case ::android::hardware::sensors::V1_0::Result::NO_MEMORY:
return ScopedAStatus::fromServiceSpecificError(ISensors::ERROR_NO_MEMORY);
case ::android::hardware::sensors::V1_0::Result::BAD_VALUE:
return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
case ::android::hardware::sensors::V1_0::Result::INVALID_OPERATION:
return ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
default:
return ScopedAStatus::fromExceptionCode(EX_TRANSACTION_FAILED);
}
}
static ::android::hardware::sensors::V1_0::RateLevel convertRateLevel(
ISensors::RateLevel rateLevel) {
switch (rateLevel) {
case ISensors::RateLevel::STOP:
return ::android::hardware::sensors::V1_0::RateLevel::STOP;
case ISensors::RateLevel::NORMAL:
return ::android::hardware::sensors::V1_0::RateLevel::NORMAL;
case ISensors::RateLevel::FAST:
return ::android::hardware::sensors::V1_0::RateLevel::FAST;
case ISensors::RateLevel::VERY_FAST:
return ::android::hardware::sensors::V1_0::RateLevel::VERY_FAST;
default:
assert(false);
}
}
static ::android::hardware::sensors::V1_0::OperationMode convertOperationMode(
ISensors::OperationMode operationMode) {
switch (operationMode) {
case ISensors::OperationMode::NORMAL:
return ::android::hardware::sensors::V1_0::OperationMode::NORMAL;
case ISensors::OperationMode::DATA_INJECTION:
return ::android::hardware::sensors::V1_0::OperationMode::DATA_INJECTION;
default:
assert(false);
}
}
static ::android::hardware::sensors::V1_0::SharedMemType convertSharedMemType(
ISensors::SharedMemInfo::SharedMemType sharedMemType) {
switch (sharedMemType) {
case ISensors::SharedMemInfo::SharedMemType::ASHMEM:
return ::android::hardware::sensors::V1_0::SharedMemType::ASHMEM;
case ISensors::SharedMemInfo::SharedMemType::GRALLOC:
return ::android::hardware::sensors::V1_0::SharedMemType::GRALLOC;
default:
assert(false);
}
}
static ::android::hardware::sensors::V1_0::SharedMemFormat convertSharedMemFormat(
ISensors::SharedMemInfo::SharedMemFormat sharedMemFormat) {
switch (sharedMemFormat) {
case ISensors::SharedMemInfo::SharedMemFormat::SENSORS_EVENT:
return ::android::hardware::sensors::V1_0::SharedMemFormat::SENSORS_EVENT;
default:
assert(false);
}
}
static ::android::hardware::sensors::V1_0::SharedMemInfo convertSharedMemInfo(
const ISensors::SharedMemInfo& sharedMemInfo) {
::android::hardware::sensors::V1_0::SharedMemInfo v1SharedMemInfo;
v1SharedMemInfo.type = convertSharedMemType(sharedMemInfo.type);
v1SharedMemInfo.format = convertSharedMemFormat(sharedMemInfo.format);
v1SharedMemInfo.size = sharedMemInfo.size;
v1SharedMemInfo.memoryHandle =
::android::hardware::hidl_handle(::android::makeFromAidl(sharedMemInfo.memoryHandle));
return v1SharedMemInfo;
}
ScopedAStatus HalProxyAidl::activate(int32_t in_sensorHandle, bool in_enabled) {
return resultToAStatus(HalProxy::activate(in_sensorHandle, in_enabled));
}
ScopedAStatus HalProxyAidl::batch(int32_t in_sensorHandle,
int64_t in_samplingPeriodNs,
int64_t in_maxReportLatencyNs) {
return resultToAStatus(HalProxy::batch(in_sensorHandle, in_samplingPeriodNs,
in_maxReportLatencyNs));
}
ScopedAStatus HalProxyAidl::configDirectReport(int32_t in_sensorHandle,
int32_t in_channelHandle,
ISensors::RateLevel in_rate,
int32_t *_aidl_return) {
ScopedAStatus status =
ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
HalProxy::configDirectReport(
in_sensorHandle, in_channelHandle, convertRateLevel(in_rate),
[&status, _aidl_return](::android::hardware::sensors::V1_0::Result result,
int32_t reportToken) {
status = resultToAStatus(result);
*_aidl_return = reportToken;
});
return status;
}
ScopedAStatus HalProxyAidl::flush(int32_t in_sensorHandle) {
return resultToAStatus(HalProxy::flush(in_sensorHandle));
}
ScopedAStatus HalProxyAidl::getSensorsList(
std::vector<::aidl::android::hardware::sensors::SensorInfo> *_aidl_return) {
for (const auto &sensor : HalProxy::getSensors()) {
SensorInfo dst = sensor.second;
if (dst.requiredPermission == "com.samsung.permission.SSENSOR") {
dst.requiredPermission = "";
}
if (dst.typeAsString == "com.samsung.sensor.physical_proximity" ||
dst.typeAsString == "com.samsung.sensor.hover_proximity") {
ALOGI("Fixing %s", dst.typeAsString.c_str());
dst.type = ::android::hardware::sensors::V2_1::SensorType::PROXIMITY;
dst.typeAsString = SENSOR_STRING_TYPE_PROXIMITY;
dst.maxRange = 1;
}
#ifdef VERBOSE
ALOGI( "SENSOR NAME:%s ", dst.name.c_str());
ALOGI( " VENDOR:%s ", dst.name.c_str());
ALOGI( " TYPE:%d ", (uint32_t)dst.type);
ALOGI( " TYPE_AS_STRING:%s ", dst.typeAsString.c_str());
#endif
_aidl_return->push_back(convertSensorInfo(dst));
}
return ScopedAStatus::ok();
}
ScopedAStatus HalProxyAidl::initialize(
const MQDescriptor<::aidl::android::hardware::sensors::Event,
SynchronizedReadWrite> &in_eventQueueDescriptor,
const MQDescriptor<int32_t, SynchronizedReadWrite> &in_wakeLockDescriptor,
const std::shared_ptr<ISensorsCallback> &in_sensorsCallback) {
::android::sp<::android::hardware::sensors::V2_1::implementation::
ISensorsCallbackWrapperBase>
dynamicCallback = new ISensorsCallbackWrapperAidl(in_sensorsCallback);
auto aidlEventQueue = std::make_unique<::android::AidlMessageQueue<
::aidl::android::hardware::sensors::Event, SynchronizedReadWrite>>(
in_eventQueueDescriptor, true /* resetPointers */);
std::unique_ptr<::android::hardware::sensors::V2_1::implementation::
EventMessageQueueWrapperBase>
eventQueue =
std::make_unique<EventMessageQueueWrapperAidl>(aidlEventQueue);
auto aidlWakeLockQueue = std::make_unique<
::android::AidlMessageQueue<int32_t, SynchronizedReadWrite>>(
in_wakeLockDescriptor, true /* resetPointers */);
std::unique_ptr<::android::hardware::sensors::V2_1::implementation::
WakeLockMessageQueueWrapperBase>
wakeLockQueue =
std::make_unique<WakeLockMessageQueueWrapperAidl>(aidlWakeLockQueue);
return resultToAStatus(
initializeCommon(eventQueue, wakeLockQueue, dynamicCallback));
}
ScopedAStatus HalProxyAidl::injectSensorData(
const ::aidl::android::hardware::sensors::Event &in_event) {
::android::hardware::sensors::V2_1::Event hidlEvent;
convertToHidlEvent(in_event, &hidlEvent);
return resultToAStatus(
HalProxy::injectSensorData(convertToOldEvent(hidlEvent)));
}
ScopedAStatus
HalProxyAidl::registerDirectChannel(const ISensors::SharedMemInfo &in_mem,
int32_t *_aidl_return) {
ScopedAStatus status =
ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
::android::hardware::sensors::V1_0::SharedMemInfo sharedMemInfo =
convertSharedMemInfo(in_mem);
HalProxy::registerDirectChannel(
sharedMemInfo,
[&status, _aidl_return](::android::hardware::sensors::V1_0::Result result,
int32_t reportToken) {
status = resultToAStatus(result);
*_aidl_return = reportToken;
});
native_handle_delete(const_cast<native_handle_t *>(
sharedMemInfo.memoryHandle.getNativeHandle()));
return status;
}
ScopedAStatus HalProxyAidl::setOperationMode(
::aidl::android::hardware::sensors::ISensors::OperationMode in_mode) {
return resultToAStatus(
HalProxy::setOperationMode(convertOperationMode(in_mode)));
}
ScopedAStatus HalProxyAidl::unregisterDirectChannel(int32_t in_channelHandle) {
return resultToAStatus(HalProxy::unregisterDirectChannel(in_channelHandle));
}
binder_status_t HalProxyAidl::dump(int fd, const char ** /* args */,
uint32_t /* numArgs */) {
native_handle_t *nativeHandle =
native_handle_create(1 /* numFds */, 0 /* numInts */);
nativeHandle->data[0] = fd;
HalProxy::debug(nativeHandle, {} /* args */);
native_handle_delete(nativeHandle);
return STATUS_OK;
}
} // namespace implementation
} // namespace sensors
} // namespace hardware
} // namespace android
} // namespace aidl

Some files were not shown because too many files have changed in this diff Show More