83 Commits
bka ... vic

Author SHA1 Message Date
7854cf6443 sepolicy: qti: Allow system server to detect oem charging
Signed-off-by: AnierinB <anierin@evolution-x.org>
2025-09-12 13:53:12 -04:00
DragonEmperor9480
87797f25be sepolicy: adress fingerprint denials
*1565  1775 E [ANC_TAC][File]: AncMkDir: fail to mkdir /data/vendor/fingerprint/info, errno = 13, errnostr = Permission denied
*667   667 W qseecomd: type=1400 audit(0.0:82): avc:  denied  { write } for  name="debase_context" dev="sda2" ino=565 scontext=u:r:tee:s0 tcontext=u:object_r:vendor_persist_fingerprint_file:s0 tclass=file permissive=0
*1565  1565 W fingerprint@2.1: type=1400 audit(0.0:106): avc:  denied  { write } for  name="tee_bind_core" dev="proc" ino=4026532098 scontext=u:r:hal_fingerprint_default:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=0
*667   667 W qseecomd: type=1400 audit(0.0:107): avc:  denied  { write } for  name="debase_context" dev="sda2" ino=565 scontext=u:r:tee:s0 tcontext=u:object_r:vendor_persist_fingerprint_file:s0 tclass=file permissive=0
*1565  1565 W fingerprint@2.1: type=1400 audit(0.0:78): avc:  denied  { write } for  name="tee_bind_core" dev="proc" ino=4026532098 scontext=u:r:hal_fingerprint_default:s0 tcontext=u:object_r:proc:s0 tclass=file permissive=0
*1565  1565 W fingerprint@2.1: type=1400 audit(0.0:79): avc:  denied  { read } for  name="u:object_r:serialno_prop:s0" dev="tmpfs" ino=3880 scontext=u:r:hal_fingerprint_default:s0 tcontext=u:object_r:serialno_prop:s0 tclass=file permissive=0
*1565  1565 W fingerprint@2.1: type=1400 audit(0.0:80): avc:  denied  { create } for  name="image_raw" scontext=u:r:hal_fingerprint_default:s0 tcontext=u:object_r:fingerprint_vendor_data_file:s0 tclass=dir permissive=0
2025-09-12 13:53:12 -04:00
bc83d6ab33 sepolicy: qti: Allow system_server to r/w oplus_chg nodes 2025-09-12 13:53:12 -04:00
Broly1
55220ee27f keyhandler: Move Alert Slider to Sound settings and remove icon 2025-09-12 13:53:12 -04:00
Adhitya Mohan
6d23f9acaa Add icon and summary for alert slider settings 2025-09-12 13:53:12 -04:00
Adhitya Mohan
30dc0eecac Keyhandler: Export Keyhandler setting and service 2025-09-12 13:53:12 -04:00
inferno0230
da51d42fd5 sensors: Bump android.hardware.sensors to V3-ndk
Signed-off-by: inferno0230 <mail@inferno0230.in>
2025-09-12 13:53:12 -04:00
Alcatraz323
1a522811ae Implement DSPVolumeSynchronizer
Some Xiaomi devices have a speaker that needs a framework to cooperate
with DSP to synchronize volume so that the DSP can limit bass when the
volume is high to prevent distortion.

Change-Id: I750803d94161e1e7482552d2a39566f42e82fc0a
2025-09-12 13:53:12 -04:00
Ghosuto
99ff16bb54 dolby: Update to use new tooltip position provider API 2025-09-12 13:53:12 -04:00
Sugakesshaa
636b4d6428 vintf: Add oplus Dolby Atmos entries to FCM
Change-Id: Ifc4dff53e516f33b9e5581d56ce6f9c00f0da8cf
2025-09-12 13:53:12 -04:00
Sugakesshaa
fa4fe970ce dolby: Create a split makefile for Dolby
Change-Id: Ie191d7af0ee55c44cc939fc5dd1b6e45c965dbf4
2025-09-12 13:53:12 -04:00
Adithya R
9a9ac9f666 sepolicy: qti: Add sepolicy for Dolby Atmos
Change-Id: I8c41ff32e579cec9c871d6a0177ca027034281c8
2025-09-12 13:53:12 -04:00
Sugakesshaa
f725f3be91 dolby: Rebrand to oplus
Change-Id: Ic54a93647c0dcbe3b1ef8b576d80cc4c6bf74992
2025-09-12 13:53:12 -04:00
Fabian Leutenegger
cd00f3d796 dolby: Switch to MaterialTheme settingsBackground for EqualizerScreen background color
Change-Id: I546e3528814276eb857a650cb6c173d914550fb5
2025-09-12 13:53:12 -04:00
Bruno Martins
a726af6db4 dolby: Use all shared resources from devicesettings
Change-Id: Icd7f381c574ea36eb4d797cefd60ba9f1a0941bd
2025-09-12 13:53:12 -04:00
Pranav Vashi
9e91203f38 dolby: Remove deprecated PlainTooltipBox
Change-Id: I70ffff5ba30c5eeaff431e46c82eaf05d46e4cb0
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
2025-09-12 13:53:12 -04:00
basamaryan
fe45968ff3 dolby: Fix build with kotlinc 1.9.0
Reformat the code while at it

Change-Id: I4f9fdc9d25eb57240612cff1b3bef3663014f9a8
2025-09-12 13:53:12 -04:00
Michael Bestas
556ea40ab7 dolby: Convert to SwitchPreferenceCompat
Change-Id: Ic1cbaba37d499da1855af9c3930f2df426e2d3af
2025-09-12 13:53:12 -04:00
Chaohui Wang
fcb33262c5 dolby: Migrate to CompoundButton.OnCheckedChangeListener
Switch and SwitchCompat are both CompoundButton.

Using CompoundButton in Java will helps migration in the future.

Bug: 306658427 | AOSP | AOSP
Test: manual - check Settings pages
Test: m RunSettingsLibRoboTests
Change-Id: I85a70d4c504d8584030ea4a058f30d74206ab835
2025-09-12 13:53:12 -04:00
Peter Kalauskas
8f6493a247 dolby: Enable use_resource_processor for all sysui deps
This will make the build faster

Test: m checkbuild
Bug: 295208392
Change-Id: I0c1bd901429bbe3bf81c1530e156735f8637a96e
2025-09-12 13:53:12 -04:00
Adithya R
2d7496345c dolby: Add intelligent equalizer setting
Move preference-related classes to a new package while we're at it,
to reduce code clutter.

Change-Id: I2430e8ab9b6758503ce1777ec985a3e400b55b8e
2025-09-12 13:53:12 -04:00
Adithya R
460a99212e dolby: Introduce graphical equalizer
Squashed:

dolby: Refresh preset name on main screen

Change-Id: I96783e2a03c384f031787f4cc9140f7d64dadb2f
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Change-Id: I38ee6ce594e5671af42afc3d4bf0f004329482b9
2025-09-12 13:53:12 -04:00
Pranav Vashi
a9875242af dolby: Add launcher icon
Change-Id: I4d36842ca96048f9b55604d66cc7741759d657f3
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
[adithya2306: Add monochrome icon as well]
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2025-09-12 13:53:12 -04:00
Adithya R
cb104e3d65 dolby: Restore current profile _after_ resetting profiles
Ensure to end the onBootCompleted routine with the correct profile set.

Change-Id: I2d5f74a7c0145af2f9d064cd98fa2dc70e5a7acd
2025-09-12 13:53:12 -04:00
Adithya R
e5a3466a01 dolby: Do not set volume leveler amount
This value is set to zero in almost every known dax-default.xml,
including ours.
DaxService also doesn't mess with this value, instead only sets
VolumeLevelerEnabled.

Change-Id: Ib944728d478cff58aebc4f47128bcd5fe32ff9f6
2025-09-12 13:53:12 -04:00
Adithya R
791acfda43 dolby: Restore all settings upon bootup
Dolby often messes up restoring profile-specific settings after a reboot.
"Fine. I'll do it myself."

Change-Id: Ic255c6922eabae0b522c05110f87e2c10a97fb6c
2025-09-12 13:53:12 -04:00
Adithya R
e7acd1fa7f dolby: Rewrite in Kotlin
Some cleanup and restructuring while we're at it.

Change-Id: I2f1fc53c202d91421c7b6af68c814c25398a62e4
2025-09-12 13:53:12 -04:00
Adithya R
55a0e6b7fc dolby: Revert "Re-enable speaker virtualization after bootup"
No longer necessary

Change-Id: Iac820eafa71ea3e4ccaad2bfa0fb76c37279a22a
2025-09-12 13:53:12 -04:00
Adithya R
b46821b47c xiaomi: Introduce Dolby Atmos
Moved from marble/sm8450-common

History:

commit 82fe03168c0402e4cb10d25859c3b398c0ef654a
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Thu Mar 21 21:35:36 2024 +0530

    marble: parts: Restore dolby profile on audio changes

    Something keeps resetting back at random times, from what I observed,
    after resuming media or on a device change, lets workaround that.

    Change-Id: Id065f2482636194655c2399f0c35ad56b8e7a29d

commit c4400bd1326f65aeac1d0f26bb830ce7fd079773
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Fri Feb 2 09:29:08 2024 +0530

    marble: parts/keyhandler: Guard debug logging

    Change-Id: I246941f26cd1f71b696eb3c996794c9baa5dbc00

commit f11b70a98a11d0b89673d73002996aed9f11fbd7
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Sun Dec 31 20:36:52 2023 +0530

    marble: parts: Re-enable speaker virtualization after bootup

    For whatever reason, speaker virtualization isn't automatically
    restored at bootup unlike the other parameters. It was reported to be
    fixed by connecting and disconnecting headphones or disabling and
    enabling the toggle, so let's just automate that at bootup.

commit abcff4fb947c89b69c1d25bd290fd91b7873af6a
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Fri Oct 20 06:49:19 2023 +0530

    marble: parts: Implement profile-specific Dolby settings

    Some refactoring and cleanup while we're at it.

commit dc54f9ddeff212d017b0cba16e56516e99335bb3
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Mon Oct 9 21:58:58 2023 +0530

    marble: parts: Remove play/pause hack while toggling Dolby

    Not required with/fixed by:
    35217: audioflinger: Do not allow DAP effect to be suspended | https://gerrit.aospa.co/c/AOSPA/android_frameworks_av/+/35217

commit dd2acc8e0c10d05f86ff229412cc9f72ea242b44
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Wed Sep 13 21:41:20 2023 +0530

    marble: parts: Set proper summary for dolby settings

    Show the current status in Settings > Sound as well as the QS tile.

commit 92d341ba3d22f323eded525487db4289d6edc0fe
Author: Fabian Leutenegger <fabian.leutenegger@bluewin.ch>
Date:   Fri Aug 25 10:26:53 2023 +0200

    marble: parts: Always refresh playback if status changed

     * otherwise dolby would stay active even if you disable its setting

    Change-Id: If59d8081fa12da2aa67e5149db97965c0805d76e

commit b1944744649b6fddcb7bc3864b92f298b6e78821
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Mon Aug 21 13:21:18 2023 +0530

    marble: parts: Introduce Dolby Atmos

    Based on existing dirac implementation and observing stock
    sound effects app and daxservice.

    Thanks to jhenrique09 for the hack from old dirac parts
    "Pause/play music stream to get effects applied".

    TODO: bring back misound (same as stock)

    Co-authored-by: Henrique Silva <jhenrique09.mcz@hotmail.com>

Change-Id: I79841c045fe7b92c438177916f756faab72ff0e9
2025-09-12 13:53:12 -04:00
Sugakesshaa
3fec8a2160 sepolicy: qti: Allow powerhal write to /proc
Change-Id: Id894d56fdf0df323e75004c90c0b904eb450837c
2025-09-12 13:53:12 -04:00
Sugakesshaa
55c9700299 sepolicy: qti: Allow binder calls for sensor hal to system_server
Change-Id: Ic624ff754f0bf7f60f443a449987e30ca2691dfd
2025-09-12 13:53:12 -04:00
pjgowtham
1e93163668 aidl: sensors: Add clang-format
Change-Id: Ifece344ef765d5437eefd59ecbe4cd50ce1295f5
2025-09-12 13:53:12 -04:00
pjgowtham
e5e0f18f31 overlay/sensors: Configure Doze brightness sensor
Oplus doze brightness sensors either reports 0 or 1

0.0 - Dark environment
1.0 - Bright environment

aod_light_mode value of 1 enables qcom,mdss-dsi-aod-low-mode-command
and any other value would enable qcom,mdss-dsi-aod-high-mode-command

Change-Id: I98e3ea6abe0375ca75dad1b82e0bc6a1551cbb0e
2025-09-12 13:53:12 -04:00
pjgowtham
373f8335ec overlay: qssi: Define quick_pickup sensor string
Tests: Ensure quick pickup works when the "Lift to check phone"
is enabled under settings (with fingerprint enrolled)

Change-Id: I00626512dcca51d666e37dda4b281575bf1a2ea7
2025-09-12 13:53:12 -04:00
Sebastiano Barezzi
4b6662f6cf overlay: qssi: Enable config_dozePulsePickup
Change-Id: Ice5cd780eb77e2ae78a3a84a0140c321ad84f143
2025-09-12 13:53:12 -04:00
pjgowtham
35c76b7f85 sepolicy: qti: Label sensors AIDL multihal
Change-Id: I51d1f5542f3bb6922d0f3d9b39777bc8b1ff58ff
Signed-off-by: Vaisakh Murali <mvaisakh@statixos.com>
2025-09-12 13:53:12 -04:00
pjgowtham
62f85bdab9 aidl: sensors: Standardize qti.sensor.amd to glance sensor
Change-Id: I65150cffde2bd8a48c33b26a0f139a24687f8591
2025-09-12 13:53:12 -04:00
Sugakesshaa
37f2b80fcc aidl: sensors: Invert value for pickup gesture event
- oplus pickup sensor inverts the value for it to work properly;
- Hence, invert the event check for it to work accordingly.

thanks to @ cyberknight777 for the idea

Test: Build, test lift to check phone.

Change-Id: If09de1758823e2246106d6e278ecc80ca5327ee5
2025-09-12 13:53:12 -04:00
Cosmin Tanislav
a71cd8bba5 aidl: sensors: Change standard tilt_detector to pickup_gesture
* ignore non-wakeup sensor variant
* ignore events that do not properly match a pickup

pjgowtham: The tilt_detector sensor already has inverted sensor events
for it to be any useful as standard sensor. Thus repurpose them as
pickup sensor.

Change-Id: Ibe2f9fee1551da613713d40c1b8d0a26d38a93ae
Signed-off-by: ralph950412 <ralph950412@gmail.com>
Signed-off-by: Sugakesshaa <sugakesshaa@pixelos.net>
2025-09-12 13:53:12 -04:00
Cosmin Tanislav
07a7277cc7 aidl: sensors: Avoid target name conflicts
Change-Id: Ib6426caf68fe1a7a7f637bdc5c4f0036866f8b78
Signed-off-by: ralph950412 <ralph950412@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
2025-09-12 13:53:12 -04:00
Arian
357e7bdd36 aidl: sensors: Change default applicable license to Android-Apache-2.0
hardware_interfaces_license is not available here.

Change-Id: I8c8d00cdeda2739c3e4419f979f1fbf0ef66fc0a
2025-09-12 13:53:12 -04:00
ralph950412
f1565a99e2 aidl: sensors: Import 2.X sensors hal proxy
* From android-14.0.0_r15

Change-Id: Id6f37920db2869574ca1b8e04c10e6ec3268ad4b
Signed-off-by: ralph950412 <ralph950412@gmail.com>
Signed-off-by: Cyber Knight <cyberknight755@gmail.com>
2025-09-12 13:53:12 -04:00
ralph950412
5dc2395c1a aidl: sensors: Import aidl sensors MultiHal
* From android-14.0.0_r15

Change-Id: Id7d8dfae1290bdba84d5a9f4c6583d54a2769ba8
Signed-off-by: ralph950412 <ralph950412@gmail.com>
2025-09-12 13:53:12 -04:00
pjgowtham
b93792e127 aidl: vibrator: Use THUD effect from wly for DOUBLE_CLICK
Change-Id: I4f1a718254ca1df5167956371e11b4102b10094c
2025-09-12 13:53:12 -04:00
pjgowtham
befcb928b3 aidl: vibrator: Minimize code for ledVibratorDevice
This fixes vibration on ziti where it works only when strace is used.

* Minimize code wherever applicable.
* Remove writes to /rtp since we are not using them.

Change-Id: I385fe64b33e541bc398e58dbbf67a728edff8b24
2025-09-12 13:53:12 -04:00
pjgowtham
7f3969b7c7 sepolicy: qti: Allow init to write to usb nodes for enabling OTG
Change-Id: I14d209d1d04ba6aae077f828a71f5683b4a6405c
2025-09-12 13:53:12 -04:00
inferno0230
34a24318a8 sepolicy: qti: Label SM7550 charging sysfs path
Change-Id: Ia79079f3df34714e5a8f9294d3db6048552609e6
Signed-off-by: inferno0230 <mail@inferno0230.in>
2025-09-09 22:06:47 +02:00
LuK1337
495cfb6640 sepolicy: qti: Allow vendor_init to set vendor_fingerprint_prop
Change-Id: Icc898bba9d8a06b79e1cfcf34412871471a9bdf7
Signed-off-by: inferno0230 <mail@inferno0230.in>
2025-09-09 19:54:53 +05:30
dianlujitao
7a643a4105 sepolicy: qti: Move proc_horae to vendor
This fixes booting AOSP GSIs.

Fixes: 8acb73ff6a ("sepolicy: qti: Add support for horae service")
Change-Id: Ica812bb31d6c60b4ec5f6837de7712bd0c275543
2025-09-07 15:29:03 +08:00
dianlujitao
8ae5447fc5 Euicc: Add China version support
Despite lack of native eSIM hardware, this enables managing removable
eUICCs through EuiccGoogle

Change-Id: I9d5a360dde85ede18761ff795641e199507ff688
2025-09-06 14:39:20 +00:00
LuK1337
20b9ca79d6 livedisplay: Use PWM turbo for IAntiFlicker if available
Change-Id: I4162f79c5309038dfff1bd00f2ca8a726c7eb206
2025-09-06 13:56:59 +00:00
LuK1337
b7e4686284 kernel-headers: Add PANEL_IOCTL_{GET,SET}_PWM_TURBO
Change-Id: I0c63693be15a09baa582d14113b642e086e94d6e
2025-09-06 13:56:59 +00:00
grep
641f44934c vintf: Bump vendor.oplus.hardware.charger to V8
lexus shipped with V8.

Change-Id: I0b4733fcb7f5e3ac0834b8526e1ec5a99fd0e8c3
2025-09-06 12:25:27 +02:00
Bruno Martins
d2e134e7c0 interfaces: Mark all aidl interfaces as system_ext_specific
Change-Id: I62d8099cae1d3c2cbe98d5bc514a0713eb84cbe9
2025-09-05 17:11:22 +01:00
Bruno Martins
860533d2bb interfaces: Update ICharger all the way to V8
V7 adds GET_RX_DISABLE_STATUS and SET_RX_DISABLE enum entries on top of
V6 and V8 finally adds only GET_BATTERY_SEC_IC_TEST_STATUS.

Change-Id: I134bac4ffc536280dbb778a4a349943b67c175dc
2025-09-05 15:49:48 +01:00
Bruno Martins
70168c51f2 interfaces: Bump ICharger directly to V5
Looks like V4 never existed.

Change-Id: I1999da190461411913e98d98c258a2825fb039d5
2025-09-05 15:48:10 +01:00
Bruno Martins
c0d70dc0f9 interfaces: Update ICharger to V3
Change-Id: Ife15bb3b9f51dbc83bb975a7603f47985e1178bd
2025-09-05 15:47:13 +01:00
Bruno Martins
e8d95112d7 interfaces: Update ICharger to V2
Change-Id: I2ffe384dad647c3e115d6bb1d2e7d85e94d720e5
2025-09-05 15:46:18 +01:00
Bruno Martins
8c1e19bdb8 interfaces: Add vendor.oplus.hardware.charger V1
Change-Id: Ia3916a80e106c3b92428b1239c0fae90b8a5eaf3
2025-09-05 15:45:00 +01:00
Bruno Martins
a9438581bb sepolicy: qti: Add inital eSIM support
Change-Id: Iae2d3c17a6eb5a9b1c71198c8ac861ad4e5f85d5
2025-09-05 13:42:42 +00:00
Bruno Martins
63795ed4d4 sepolicy: qti: Update compatibility mapping files
Change-Id: I6d10fa03042e4f360a494a7eb2c9ffd0502c86a4
2025-09-04 16:05:55 +01:00
chandu078
8acb73ff6a sepolicy: qti: Add support for horae service
Service required for thermal management, as it reports and updates shell
temperature to /proc/shell-temp.

Change-Id: I02e2ddeda461cbb2ead1348edc6ebf57b8f7fdde
2025-09-04 13:30:17 +01:00
LuK1337
3633fe6cbe oplus: Get rid of in_ prefix
Change-Id: Ibdafd315098ccc54ec19f298bdb28cb894017489
2025-09-04 11:17:09 +00:00
pjgowtham
b122025d2d Introduce vendor.oplus.hardware.performance-service
Dummy service named differently from the stock one to avoid conflicts.

This can be used on devices that do not include CPU ricing, but still
require the service to register for camera and prebuilt audio stack to
actually work.

Change-Id: I41087aefe9af57e7a1161a3a71ab3b9e849925f2
2025-09-04 10:14:22 +00:00
pjgowtham
8ecfa3412a interfaces: Add vendor.oplus.hardware.performance V1
Change-Id: I5a56cdc826495e1770905e3286bcbc2bef0cf2a3
2025-09-04 10:16:09 +01:00
LineageOS Infra
826524b2cb Automatic translation import
Change-Id: I433a0975161c90f6e9cec98e824f56c3c80e39a1
2025-09-01 14:54:29 +00:00
Bruno Martins
8393454ee6 usb_compositions: Restore QCOM VID/PID combos for diag
This re-allows installing Qualcomm drivers for accessing diag,
serial_cdev, rmnet (and others) devices. Needed for QPST Flash Tool.

Change-Id: Iafe2236bb63adb005bfecae46887c58c69db8ca2
2025-09-01 14:03:27 +00:00
dianlujitao
0b09eeb4b7 KeyHandler: Populate tri-state-key state on boot
Change-Id: I11e785b5824d581f748e038f292c8846b2a13a0f
2025-09-01 14:50:41 +01:00
LuK1337
23a4f0c429 sepolicy: qti: Add system_oplus_radio_prop to *.ignore.cil
Change-Id: If943028a54f7a7f32f289bf080f6565052bdaf40
2025-08-31 20:00:33 +02:00
pjgowtham
0ad31fba1e sepolicy: qti: Let qti secure_element rw /dev/nq-nci
vendor.qti.secu: type=1400 audit(0.0:2346): avc:  denied  { getattr }
for  path=/dev/nq-nci dev=tmpfs ino=1371
scontext=u:r:hal_secure_element_default:s0
tcontext=u:object_r:nfc_device:s0 tclass=chr_file permissive=1

Spotted on ferrari.

Change-Id: I8869fffae3cc6028b6b8ff009bd84108e2a53ada
2025-08-25 13:59:35 +02:00
pjgowtham
9b27b2665b fingerprint: Shim property_get() as well
On OnePlus Nord CE3 (ziti), shimming `__system_property_get()` is not
enough. Without this change, `vendor.fingerprint.cali` is set to 0 when
`ro.boot.vbmeta.device_state` is unset.

Test: Ensure adb logcat | grep "lcd LockState" does not show up as NULL
      Ensure adb shell getprop vendor.fingerprint.cali is 1
Change-Id: I913f00db1542a28aaaa11dba93fcce67b39717bf
2025-08-25 09:49:43 +00:00
pjgowtham
1477e8b42e sepolicy: qti: Label awinic vibrator sysfs for ziti
Change-Id: I6543983b6de8f7852015ea6a304be9aa809dc65f
2025-08-24 21:23:41 +05:30
LuK1337
4af7f26d3f sepolicy: qti: oplusSensor -> oplus_sensor
Matches new AIDL naming style.

Change-Id: I93a22091f54df5c48d105bc82d51b90bcf1e59e3
2025-08-22 10:06:40 +02:00
pjgowtham
04441ff343 sepolicy: qti: Label and add rules for oplusSensor AIDL
Change-Id: I451d7bf6bb110ed900ff5258cdcf6566945ab490
2025-08-22 10:06:39 +02:00
pjgowtham
93e8cfc069 sepolicy: qti: Let vendor_hal_oplusSensor_default search /dev/block
Change-Id: I248bd96c9753a4c9f51643368a0a5f67d52729df
2025-08-22 09:58:37 +02:00
pjgowtham
17d525da8f sepolicy: qti: Let hal_oplus_charger_aidl rw /dev/oplus_chg
Change-Id: I222aed7542f5750a3fe2f062998237bc00d22a3a
2025-08-22 09:49:45 +02:00
pjgowtham
af977627d4 sepolicy: qti: Let hal_oplus_charger_aidl rw vendor_sysfs_battery_supply
Change-Id: I058aad89acba10eaae84734341d30d1efa8e4a2f
2025-08-22 09:49:45 +02:00
pjgowtham
00c112c97a sepolicy: qti: Update qseecom rules for fingerprint
Change-Id: I34cbd4642f1c03446d1e57da079e5e495c2326cc
2025-08-22 07:43:54 +00:00
pjgowtham
9914060348 sepolicy: qti: Label goodix fingerprint property
W /system/bin/init: type=1107 audit(0.0:13): uid=0 auid=4294967295
ses=4294967295 subj=u:r:init:s0 msg='avc:  denied  { set } for
property=gf.debug.dump_data pid=1873 uid=1000 gid=1000
scontext=u:r:hal_fingerprint_default:s0 tcontext=u:object_r:default_prop:s0
tclass=property_service permissive=0'

Change-Id: I07acc42f6a5cba7e7b94f8473feb0540eee9096c
2025-08-22 07:43:54 +00:00
pjgowtham
abe43816a2 sepolicy: qti: Let camera hal rw /proc/qcom_flash
On Ziti (OnePlus Nord CE 3), this seems necessary for the torchlight
function to work.

Change-Id: I37ac5d7a1578d939d61728e8292c47b2fa9d870d
2025-08-22 09:35:36 +02:00
pjgowtham
655f8c1814 sepolicy: qti: Label wly wakeup nodes
wly / # cat /sys/devices/platform/soc/984000.i2c/i2c-5/5-003b/name
p9415-rx
wly / # cat /sys/devices/platform/soc/990000.i2c/i2c-6/6-004b/name
synaptics-s3908
wly / # cat /sys/devices/platform/soc/a84000.i2c/i2c-8/8-0028/name
sn-nci

Change-Id: I8aef0c21df2af86b06515ef609729c352770a260
2025-08-22 09:28:01 +02:00
pjgowtham
8da66b3786 sepolicy: qti: Label ferrari wakeup nodes
ferrari / # cat /sys/devices/platform/soc/990000.i2c/i2c-5/5-004b/name
synaptics-s3908
ferrari / # cat /sys/devices/platform/soc/a84000.i2c/i2c-7/7-0028/name
sn-nci

Change-Id: Ia2af6499a912697694ee24f209726a974887545f
2025-08-22 09:26:25 +02:00
pjgowtham
19cd98ab96 sepolicy: qti: Label lunaa/ziti wakeup nodes
lunaa / # cat /sys/devices/platform/soc/a84000.i2c/i2c-1/1-0008/name
st21nfc
lunaa / # cat /sys/devices/platform/soc/a94000.i2c/i2c-2/2-0038/name
fts
ziti / # ls /sys/devices/platform/soc/a94000.spi/spi_master/spi1/spi1.0/
driver           fts_rw_reg  supplier:18200000.rsc:rpmh-regulator-ldoc12
driver_override  input       supplier:18200000.rsc:rpmh-regulator-ldoc3
fts_dump_reg     modalias    supplier:f000000.pinctrl
fts_esd_check    of_node     supplier:regulator.36
fts_fw_version   power       supplier:regulator.47
fts_hw_reset     statistics  uevent
fts_irq          subsystem   wakeup

Change-Id: I2933a1fb695f72cd859d6654947ac37bd7f3f77f
2025-08-21 17:22:41 +05:30
257 changed files with 891 additions and 5340 deletions

View File

@@ -1,13 +0,0 @@
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

1
.clang-format Symbolic link
View File

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

View File

@@ -1,13 +0,0 @@
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

View File

@@ -1,38 +0,0 @@
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 }}

View File

@@ -1,20 +0,0 @@
# 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

@@ -1,5 +1,5 @@
//
// SPDX-FileCopyrightText: 2022-2026 The LineageOS Project
// SPDX-FileCopyrightText: 2022-2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
@@ -23,10 +23,3 @@ prebuilt_hidl_interfaces {
"vendor.pixelworks.hardware.feature@1.0::IIrisFeature",
],
}
prebuilt_hidl_interfaces {
name: "hidl_zeku_explorer_interface",
interfaces: [
"vendor.zeku.hardware.explorer@1.0::IMmsProvider",
],
}

View File

@@ -1,17 +1,40 @@
//
// SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
// Copyright (C) 2023 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
phony {
android_app {
name: "OplusEuicc",
srcs: ["src/**/*.kt"],
sdk_version: "current",
product_specific: true,
certificate: "platform",
privileged: true,
optimize: {
proguard_flags_files: ["proguard.flags"],
},
required: [
"EuiccPolicy",
"EuiccPolicyOplus",
"org.lineageos.euicc.xml",
"hidden-api-whitelist-org.lineageos.euicc.xml",
],
}
runtime_resource_overlay {
name: "EuiccPolicyOplus",
prebuilt_etc {
name: "org.lineageos.euicc.xml",
relative_install_path: "permissions",
filename: "org.lineageos.euicc.xml",
src: "org.lineageos.euicc.xml",
product_specific: true,
}
prebuilt_etc {
name: "hidden-api-whitelist-org.lineageos.euicc.xml",
relative_install_path: "sysconfig",
filename: "hidden-api-whitelist-org.lineageos.euicc.xml",
src: "hidden-api-whitelist-org.lineageos.euicc.xml",
product_specific: true,
}

View File

@@ -1,10 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
Copyright (C) 2023-2024 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.lineageos.euicc.overlay.oplus">
<overlay android:targetPackage="org.lineageos.euicc"
android:isStatic="true" />
package="org.lineageos.euicc">
<queries>
<package android:name="com.google.android.gms" />
<package android:name="com.google.android.gsf" />
<package android:name="com.google.android.euicc" />
<package android:name="com.google.android.ims" />
</queries>
<uses-permission android:name="android.permission.CHANGE_COMPONENT_ENABLED_STATE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS" />
<application
android:persistent="true"
android:usesNonSdkApi="true">
<receiver
android:exported="true"
android:name=".BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<receiver
android:directBootAware="true"
android:exported="true"
android:name=".EuiccReceiver"
android:permission="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS">
<intent-filter>
<action android:name="com.google.android.euicc.action.PARTNER_CUSTOMIZATION"/>
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<hidden-api-whitelisted-app package="org.lineageos.euicc" />
</config>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="org.lineageos.euicc">
<permission name="android.permission.CHANGE_COMPONENT_ENABLED_STATE"/>
<permission name="android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS"/>
</privapp-permissions>
</permissions>

3
Euicc/proguard.flags Normal file
View File

@@ -0,0 +1,3 @@
-keep class org.lineageos.euicc.* {
*;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,63 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2023-2025 The LineageOS Project
Copyright (C) 2023 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="sim_illustration_lottie_mappings_json" translatable="false">
{
\"sim_illustration_lottie_mappings\": [
{
\"devices\": [
\"OP591BL1\",
\"OP5929L1\",
\"OP594DL1\",
\"OP595DL1\",
\"OP5CF9L1\",
\"OP5D0DL1\",
\"OP5D2BL1\",
\"OP5D35L1\",
\"OP5D3BL1\",
\"OP5D55L1\"
],
\"illustration_lottie\": \"sim_illustration_lottie_bottom\"
}
]
}
</string>
<string name="sim_slot_mappings_json" translatable="false">
{
\"sim-slot-mappings\": [
{
\"devices\": [
\"OP594DL1\",
\"OP595DL1\",
\"OP5D35L1\",
\"OP5D3BL1\",
\"OP5D55L1\"
],
\"esim-slot-ids\": [
1
],
\"psim-slot-ids\": [
0
]
},
{
\"devices\": [
\"OP591BL1\",
\"OP5929L1\",
\"OP5CF9L1\",
\"OP5D0DL1\",
\"OP5D2BL1\"
],
\"esim-slot-ids\": [],
\"psim-slot-ids\": [
0,
1
]
}
]
}
</string>
<string name="sim_illustration_lottie_mappings_json">{\"sim_illustration_lottie_mappings\":[{\"devices\":[\"OP591BL1\",\"OP5929L1\",\"OP594DL1\",\"OP595DL1\",\"OP5D0DL1\",\"OP5D55L1\"],\"illustration_lottie\":\"sim_illustration_lottie_bottom\"}]}</string>
<string name="sim_slot_mappings_json">{\"sim-slot-mappings\":[{\"devices\":[\"OP594DL1\",\"OP595DL1\",\"OP5D55L1\"],\"esim-slot-ids\":[1],\"psim-slot-ids\":[0]},{\"devices\":[\"OP591BL1\",\"OP5929L1\",\"OP5D0DL1\"],\"esim-slot-ids\":[],\"psim-slot-ids\":[0,1]}]}</string>
</resources>

View File

@@ -0,0 +1,22 @@
/*
* Copyright (C) 2021 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
package org.lineageos.euicc
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
class BootCompletedReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Log.d(TAG, "Received boot completed intent")
EuiccDisabler.enableOrDisableEuicc(context)
}
companion object {
private const val TAG = "OplusEuiccBootReceiver"
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2021-2024 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
package org.lineageos.euicc
import android.content.Context
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.content.pm.PackageManager.ApplicationInfoFlags
import android.util.Log
object EuiccDisabler {
private const val TAG = "OplusEuiccDisabler"
private val EUICC_DEPENDENCIES = listOf(
"com.google.android.gms",
"com.google.android.gsf",
)
private val EUICC_PACKAGES = listOf(
"com.google.android.euicc",
"com.google.android.ims",
)
private fun isInstalled(pm: PackageManager, pkgName: String) = runCatching {
val info = pm.getApplicationInfo(pkgName, ApplicationInfoFlags.of(0))
info.flags and ApplicationInfo.FLAG_INSTALLED != 0
}.getOrDefault(false)
private fun isInstalledAndEnabled(pm: PackageManager, pkgName: String) = runCatching {
val info = pm.getApplicationInfo(pkgName, ApplicationInfoFlags.of(0))
Log.d(TAG, "package $pkgName installed, enabled = ${info.enabled}")
info.enabled
}.getOrDefault(false)
fun enableOrDisableEuicc(context: Context) {
val pm = context.packageManager
val disable = EUICC_DEPENDENCIES.any { !isInstalledAndEnabled(pm, it) }
val flag = if (disable) {
PackageManager.COMPONENT_ENABLED_STATE_DISABLED
} else {
PackageManager.COMPONENT_ENABLED_STATE_ENABLED
}
for (pkg in EUICC_PACKAGES) {
if (isInstalled(pm, pkg)) {
pm.setApplicationEnabledSetting(pkg, flag, 0)
}
}
}
}

View File

@@ -0,0 +1,21 @@
/*
* Copyright (C) 2023 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
package org.lineageos.euicc
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
class EuiccReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Log.d(TAG, "Received PARTNER_CUSTOMIZATION intent")
}
companion object {
private const val TAG = "OplusEuiccReceiver"
}
}

View File

@@ -22,131 +22,113 @@ import vendor.oplus.hardware.biometrics.fingerprintpay.IFingerprintPay
class IfaaService : Service() {
private var _fpPayService: IFingerprintPay? = null
private val fpPayServiceDeathRecipient =
IBinder.DeathRecipient {
Log.i(LOG_TAG, "aidl FingerprintPay hal died, reset hal proxy!")
_fpPayService = null
}
private val fpPayServiceDeathRecipient = IBinder.DeathRecipient {
Log.i(LOG_TAG, "aidl FingerprintPay hal died, reset hal proxy!")
_fpPayService = null
}
private val fingerprintManager by lazy { getSystemService(FingerprintManager::class.java)!! }
private val keyguardManager by lazy { getSystemService(KeyguardManager::class.java)!! }
private val windowManager by lazy { getSystemService(WindowManager::class.java)!! }
override fun onBind(intent: Intent) =
object : IfaaManagerService.Stub() {
private val _supportBIOTypes by lazy {
when (SystemProperties.get(FP_TYPE_PROP, "")) {
"back",
"side",
"front" -> AUTH_TYPE_FINGERPRINT
"ultrasonic",
"optical" -> AUTH_TYPE_OPTICAL_FINGERPRINT
else -> AUTH_TYPE_NOT_SUPPORT
}
override fun onBind(intent: Intent) = object : IfaaManagerService.Stub() {
private val _supportBIOTypes by lazy {
when (SystemProperties.get(FP_TYPE_PROP, "")) {
"back", "side", "front" -> AUTH_TYPE_FINGERPRINT
"ultrasonic", "optical" -> AUTH_TYPE_OPTICAL_FINGERPRINT
else -> AUTH_TYPE_NOT_SUPPORT
}
override fun getSupportBIOTypes() = _supportBIOTypes
override fun startBIOManager(authType: Int) =
when (authType) {
AUTH_TYPE_FINGERPRINT -> {
applicationContext.startActivity(
Intent(Settings.ACTION_SECURITY_SETTINGS).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
)
COMMAND_OK
}
else -> COMMAND_FAIL
}
private val _deviceModel by lazy {
SystemProperties.get(IFAA_MODEL_PROP, "OPLUS-Default")
}
override fun getDeviceModel() = _deviceModel
override fun processCmd(param: ByteArray) =
try {
getFpPayService()?.ifaa_invoke_command(param)
} catch (e: Exception) {
Log.e(LOG_TAG, "processCmdImpl: ifaa_invoke_command aidl failed", e)
null
}
override fun getVersion() = 4
override fun getExtInfo(authType: Int, keyExtInfo: String) =
when (keyExtInfo) {
KEY_GET_SENSOR_LOCATION -> initExtString()
else -> ""
}
override fun setExtInfo(authType: Int, keyExtInfo: String, valExtInfo: String) {
// Do nothing
}
override fun getEnabled(bioType: Int): Int {
if (!keyguardManager.isKeyguardSecure) {
Log.e(LOG_TAG, "No secure keyguard set.")
return BIOMETRIC_NOUSE_NOSET_KEYGUARD
}
return when (bioType) {
AUTH_TYPE_FINGERPRINT ->
when {
!fingerprintManager.isHardwareDetected -> {
Log.e(LOG_TAG, "Fingerprint hardware not available!")
BIOMETRIC_NOUSE_SYSTEMLOCKED
}
fingerprintManager.enrolledFingerprints.isNullOrEmpty() -> {
Log.e(LOG_TAG, "Fingerprint not enrolled!")
BIOMETRIC_NOUSE_NOT_ENROLLED
}
else -> BIOMETRIC_USE_READY
}
else -> 0
}
}
override fun getIDList(bioType: Int): IntArray? =
when (bioType) {
AUTH_TYPE_FINGERPRINT -> {
val enrolledFingerprintIds =
fingerprintManager.enrolledFingerprints
?.map { it.biometricId }
?.toIntArray()
Log.w(LOG_TAG, "getIDList: ${enrolledFingerprintIds}!")
enrolledFingerprintIds
}
else -> null
}
}
private fun getFpPayService() =
_fpPayService
?: run {
val binder = ServiceManager.getService("${IFingerprintPay.DESCRIPTOR}/default")
IFingerprintPay.Stub.asInterface(binder)?.also {
binder.linkToDeath(fpPayServiceDeathRecipient, 0)
_fpPayService = it
}
override fun getSupportBIOTypes() = _supportBIOTypes
override fun startBIOManager(authType: Int) = when (authType) {
AUTH_TYPE_FINGERPRINT -> {
applicationContext.startActivity(
Intent(Settings.ACTION_SECURITY_SETTINGS).apply {
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
}
)
COMMAND_OK
}
else -> COMMAND_FAIL
}
private val _deviceModel by lazy { SystemProperties.get(IFAA_MODEL_PROP, "OPLUS-Default") }
override fun getDeviceModel() = _deviceModel
override fun processCmd(param: ByteArray) = try {
getFpPayService()?.ifaa_invoke_command(param)
} catch (e: Exception) {
Log.e(LOG_TAG, "processCmdImpl: ifaa_invoke_command aidl failed", e)
null
}
override fun getVersion() = 4
override fun getExtInfo(authType: Int, keyExtInfo: String) = when (keyExtInfo) {
KEY_GET_SENSOR_LOCATION -> initExtString()
else -> ""
}
override fun setExtInfo(authType: Int, keyExtInfo: String, valExtInfo: String) {
// Do nothing
}
override fun getEnabled(bioType: Int): Int {
if (!keyguardManager.isKeyguardSecure) {
Log.e(LOG_TAG, "No secure keyguard set.")
return BIOMETRIC_NOUSE_NOSET_KEYGUARD
}
return when (bioType) {
AUTH_TYPE_FINGERPRINT -> when {
!fingerprintManager.isHardwareDetected -> {
Log.e(LOG_TAG, "Fingerprint hardware not available!")
BIOMETRIC_NOUSE_SYSTEMLOCKED
}
fingerprintManager.enrolledFingerprints.isNullOrEmpty() -> {
Log.e(LOG_TAG, "Fingerprint not enrolled!")
BIOMETRIC_NOUSE_NOT_ENROLLED
}
else -> BIOMETRIC_USE_READY
}
else -> 0
}
}
override fun getIDList(bioType: Int): IntArray? = when (bioType) {
AUTH_TYPE_FINGERPRINT -> {
val enrolledFingerprintIds = fingerprintManager.enrolledFingerprints?.map {
it.biometricId
}?.toIntArray()
Log.w(LOG_TAG, "getIDList: ${enrolledFingerprintIds}!")
enrolledFingerprintIds
}
else -> null
}
}
private fun getFpPayService() = _fpPayService ?: run {
val binder = ServiceManager.getService("${IFingerprintPay.DESCRIPTOR}/default")
IFingerprintPay.Stub.asInterface(binder)?.also {
binder.linkToDeath(fpPayServiceDeathRecipient, 0)
_fpPayService = it
}
}
private val defaultDisplayDimension by lazy {
val dim1 =
displayNoVerify
?.supportedModes
?.maxByOrNull { it.physicalHeight }
?.run { Point(physicalWidth, physicalHeight) }
val dim2 = windowManager.maximumWindowMetrics.bounds.run { Point(width(), height()) }
val dim1 = displayNoVerify?.supportedModes?.maxByOrNull { it.physicalHeight }
?.run { Point(physicalWidth, physicalHeight) }
val dim2 = windowManager.maximumWindowMetrics.bounds
.run { Point(width(), height()) }
dim1?.let { Point(maxOf(dim1.x, dim2.x), maxOf(dim1.y, dim2.y)) } ?: dim2
}
@@ -158,37 +140,33 @@ class IfaaService : Service() {
val iconLocationBottom = SystemProperties.getInt(FP_ICON_LOCATION_PROP, 278)
Point(
(defaultDisplayDimension.x - iconDiameter) / 2,
defaultDisplayDimension.y - iconLocationBottom - iconDiameter / 2,
defaultDisplayDimension.y - iconLocationBottom - iconDiameter / 2
)
}
private fun initExtString() = run {
val displayDimension =
windowManager.maximumWindowMetrics.bounds.run { Point(width(), height()) }
val displayDimension = windowManager.maximumWindowMetrics.bounds.run {
Point(width(), height())
}
val scale = { pos: Point ->
Point(
pos.x * displayDimension.x / defaultDisplayDimension.x,
pos.y * displayDimension.y / defaultDisplayDimension.y,
pos.y * displayDimension.y / defaultDisplayDimension.y
)
}
val scaledLocation = scale(iconLocation)
val scaledDiameter = scale(Point(iconDiameter, iconDiameter))
JSONObject()
.apply {
put("type", 0)
put(
"fullView",
JSONObject().apply {
put("startX", scaledLocation.x)
put("startY", scaledLocation.y)
put("width", scaledDiameter.x)
put("height", scaledDiameter.y)
put("navConflict", true)
},
)
}
.toString()
JSONObject().apply {
put("type", 0)
put("fullView", JSONObject().apply {
put("startX", scaledLocation.x)
put("startY", scaledLocation.y)
put("width", scaledDiameter.x)
put("height", scaledDiameter.y)
put("navConflict", true)
})
}.toString()
}
companion object {

View File

@@ -12,9 +12,7 @@ android_app {
],
optimize: {
optimize: true,
proguard_flags_files: ["proguard.flags"],
shrink_resources: true,
},
}

View File

@@ -1,19 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="alert_slider_selection_dialog_title">Atzione</string>
<string name="alert_slider_top_position">Positzione superiore</string>
<string name="alert_slider_middle_position">Positzione tzentrale</string>
<string name="alert_slider_bottom_position">Positzione inferiore</string>
<string name="alert_slider_mode_silent">A sa muda</string>
<string name="alert_slider_mode_normal">Normale</string>
<string name="alert_slider_mode_vibration">Vibratzione</string>
<string name="alert_slider_mode_dnd_priority_only">Prioridade isceti</string>
<string name="alert_slider_mode_dnd_total_silence">Silèntziu totale</string>
<string name="alert_slider_mode_dnd_alarms_only">Isvèllias isceti</string>
<string name="alert_slider_mute_media_title">Pone is cuntenutos multimediales a sa muda</string>
<string name="alert_slider_mute_media_summary">Pone is cuntenutos multimediales a sa muda cando passas a silèntziu</string>
</resources>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="alert_slider_top_position">முதற் நிலை</string>
<string name="alert_slider_middle_position">நடு நிலை</string>
<string name="alert_slider_bottom_position">கீழ் நிலை</string>
<string name="alert_slider_mode_none">இல்லை</string>
<string name="alert_slider_mode_silent">ஒலியின்மை</string>
</resources>

View File

@@ -1,16 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2021-2025 The LineageOS Project
Copyright (C) 2021 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory
android:title="@string/alert_slider_category_title">
<SwitchPreferenceCompat
<SwitchPreference
android:key="config_mute_media"
android:title="@string/alert_slider_mute_media_title"
android:summary="@string/alert_slider_mute_media_summary"
@@ -19,29 +16,29 @@
<ListPreference
android:key="config_top_position"
android:dialogTitle="@string/alert_slider_selection_dialog_title"
android:title="@string/alert_slider_top_position"
android:summary="%s"
android:entries="@array/alert_slider_action_entries"
android:entryValues="@array/alert_slider_action_entry_values"
android:defaultValue="0"
android:title="@string/alert_slider_top_position"
app:useSimpleSummaryProvider="true" />
android:defaultValue="0" />
<ListPreference
android:key="config_middle_position"
android:dialogTitle="@string/alert_slider_selection_dialog_title"
android:title="@string/alert_slider_middle_position"
android:summary="%s"
android:entries="@array/alert_slider_action_entries"
android:entryValues="@array/alert_slider_action_entry_values"
android:defaultValue="1"
android:title="@string/alert_slider_middle_position"
app:useSimpleSummaryProvider="true" />
android:defaultValue="1" />
<ListPreference
android:key="config_bottom_position"
android:dialogTitle="@string/alert_slider_selection_dialog_title"
android:title="@string/alert_slider_bottom_position"
android:summary="%s"
android:entries="@array/alert_slider_action_entries"
android:entryValues="@array/alert_slider_action_entry_values"
android:defaultValue="2"
android:title="@string/alert_slider_bottom_position"
app:useSimpleSummaryProvider="true" />
android:defaultValue="2" />
</PreferenceCategory>
</PreferenceScreen>

View File

@@ -1,27 +1,20 @@
/*
* SPDX-FileCopyrightText: 2021-2025 The LineageOS Project
* Copyright (C) 2021-2024 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
package org.lineageos.settings.device
import android.os.Bundle
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity
class ButtonSettingsActivity : CollapsingToolbarBaseActivity() {
public override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
supportFragmentManager
.beginTransaction()
.replace(
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
ButtonSettingsFragment(),
TAG,
)
.commit()
}
companion object {
private const val TAG = "ButtonSettingsActivity"
fragmentManager.beginTransaction().replace(
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
ButtonSettingsFragment()
).commit()
}
}

View File

@@ -1,15 +1,31 @@
/*
* SPDX-FileCopyrightText: 2021-2025 The LineageOS Project
* Copyright (C) 2021 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
package org.lineageos.settings.device
import android.os.Bundle
import androidx.preference.PreferenceFragmentCompat
import android.view.MenuItem
import androidx.preference.PreferenceFragment
class ButtonSettingsFragment : PreferenceFragmentCompat() {
class ButtonSettingsFragment : PreferenceFragment() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.button_panel, rootKey)
addPreferencesFromResource(R.xml.button_panel)
activity.actionBar!!.setDisplayHomeAsUpEnabled(true)
}
override fun addPreferencesFromResource(preferencesResId: Int) {
super.addPreferencesFromResource(preferencesResId)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {
R.id.home -> {
activity.finish()
return true
}
}
return super.onOptionsItemSelected(item)
}
}

View File

@@ -8,6 +8,7 @@ package org.lineageos.settings.device
import android.database.Cursor
import android.database.MatrixCursor
import android.provider.SearchIndexableResource
import android.provider.SearchIndexablesProvider
import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_CLASS_NAME
import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_ICON_RESID
import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_ACTION
@@ -18,14 +19,15 @@ import android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID
import android.provider.SearchIndexablesContract.INDEXABLES_RAW_COLUMNS
import android.provider.SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS
import android.provider.SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS
import android.provider.SearchIndexablesProvider
class ConfigPanelSearchIndexablesProvider : SearchIndexablesProvider() {
override fun onCreate(): Boolean = true
override fun queryXmlResources(projection: Array<String?>?): Cursor {
val cursor = MatrixCursor(INDEXABLES_XML_RES_COLUMNS)
INDEXABLE_RES.forEach { cursor.addRow(generateResourceRef(it)) }
INDEXABLE_RES.forEach {
cursor.addRow(generateResourceRef(it))
}
return cursor
}
@@ -52,14 +54,10 @@ class ConfigPanelSearchIndexablesProvider : SearchIndexablesProvider() {
companion object {
private const val TAG = "ConfigPanelSearchIndexablesProvider"
private val INDEXABLE_RES =
arrayOf<SearchIndexableResource>(
SearchIndexableResource(
1,
R.xml.button_panel,
ButtonSettingsActivity::class.java.name,
0,
)
private val INDEXABLE_RES = arrayOf<SearchIndexableResource>(
SearchIndexableResource(
1, R.xml.button_panel, ButtonSettingsActivity::class.java.name, 0
)
)
}
}

View File

@@ -18,6 +18,7 @@ import android.os.Vibrator
import android.provider.Settings
import android.view.KeyEvent
import com.android.internal.os.DeviceKeyHandler
import java.io.File
import java.util.concurrent.Executors
@@ -26,35 +27,35 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
private val notificationManager = context.getSystemService(NotificationManager::class.java)!!
private val vibrator = context.getSystemService(Vibrator::class.java)!!
private val packageContext =
context.createPackageContext(KeyHandler::class.java.getPackage()!!.name, 0)
private val packageContext = context.createPackageContext(
KeyHandler::class.java.getPackage()!!.name, 0
)
private val sharedPreferences
get() =
packageContext.getSharedPreferences(
packageContext.packageName + "_preferences",
Context.MODE_PRIVATE or Context.MODE_MULTI_PROCESS,
)
get() = packageContext.getSharedPreferences(
packageContext.packageName + "_preferences",
Context.MODE_PRIVATE or Context.MODE_MULTI_PROCESS
)
private val executorService = Executors.newSingleThreadExecutor()
private var wasMuted = false
private val broadcastReceiver =
object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
AudioManager.STREAM_MUTE_CHANGED_ACTION -> {
val stream = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1)
val state =
intent.getBooleanExtra(AudioManager.EXTRA_STREAM_VOLUME_MUTED, false)
if (stream == AudioSystem.STREAM_MUSIC && !state) {
wasMuted = false
}
private val broadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
AudioManager.STREAM_MUTE_CHANGED_ACTION -> {
val stream = intent.getIntExtra(AudioManager.EXTRA_VOLUME_STREAM_TYPE, -1)
val state = intent.getBooleanExtra(
AudioManager.EXTRA_STREAM_VOLUME_MUTED, false
)
if (stream == AudioSystem.STREAM_MUSIC && !state) {
wasMuted = false
}
Intent.ACTION_BOOT_COMPLETED -> populateKeyState(false)
}
Intent.ACTION_BOOT_COMPLETED -> populateKeyState(false)
}
}
}
init {
context.registerReceiver(
@@ -62,7 +63,7 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
IntentFilter().apply {
addAction(AudioManager.STREAM_MUTE_CHANGED_ACTION)
addAction(Intent.ACTION_BOOT_COMPLETED)
},
}
)
}
@@ -92,25 +93,26 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
private fun vibrateIfNeeded(mode: Int) {
when (mode) {
AudioManager.RINGER_MODE_VIBRATE ->
vibrator.vibrate(MODE_VIBRATION_EFFECT, HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES)
AudioManager.RINGER_MODE_NORMAL ->
vibrator.vibrate(MODE_NORMAL_EFFECT, HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES)
AudioManager.RINGER_MODE_VIBRATE -> vibrator.vibrate(
MODE_VIBRATION_EFFECT,
HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES
)
AudioManager.RINGER_MODE_NORMAL -> vibrator.vibrate(
MODE_NORMAL_EFFECT,
HARDWARE_FEEDBACK_VIBRATION_ATTRIBUTES
)
}
}
private fun handleMode(position: Int, vibrate: Boolean) {
val muteMedia = sharedPreferences.getBoolean(MUTE_MEDIA_WITH_SILENT, false)
val mode =
when (position) {
POSITION_TOP -> sharedPreferences.getString(ALERT_SLIDER_TOP_KEY, "0")!!.toInt()
POSITION_MIDDLE ->
sharedPreferences.getString(ALERT_SLIDER_MIDDLE_KEY, "1")!!.toInt()
POSITION_BOTTOM ->
sharedPreferences.getString(ALERT_SLIDER_BOTTOM_KEY, "2")!!.toInt()
else -> return
}
val mode = when (position) {
POSITION_TOP -> sharedPreferences.getString(ALERT_SLIDER_TOP_KEY, "0")!!.toInt()
POSITION_MIDDLE -> sharedPreferences.getString(ALERT_SLIDER_MIDDLE_KEY, "1")!!.toInt()
POSITION_BOTTOM -> sharedPreferences.getString(ALERT_SLIDER_BOTTOM_KEY, "2")!!.toInt()
else -> return
}
executorService.submit {
when (mode) {
@@ -122,17 +124,14 @@ class KeyHandler(context: Context) : DeviceKeyHandler {
wasMuted = true
}
}
AudioManager.RINGER_MODE_VIBRATE,
AudioManager.RINGER_MODE_NORMAL -> {
AudioManager.RINGER_MODE_VIBRATE, AudioManager.RINGER_MODE_NORMAL -> {
setZenMode(Settings.Global.ZEN_MODE_OFF)
audioManager.ringerModeInternal = mode
if (muteMedia && wasMuted) {
audioManager.adjustVolume(AudioManager.ADJUST_UNMUTE, 0)
}
}
ZEN_PRIORITY_ONLY,
ZEN_TOTAL_SILENCE,
ZEN_ALARMS_ONLY -> {
ZEN_PRIORITY_ONLY, ZEN_TOTAL_SILENCE, ZEN_ALARMS_ONLY -> {
audioManager.ringerModeInternal = AudioManager.RINGER_MODE_NORMAL
setZenMode(mode - ZEN_OFFSET)
if (muteMedia && wasMuted) {

View File

@@ -10,7 +10,6 @@ android_app {
certificate: "platform",
platform_apis: true,
privileged: true,
system_ext_specific: true,
optimize: {

View File

@@ -6,13 +6,11 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.lineageos.pen">
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<application
android:label="@string/app_name"

View File

@@ -5,6 +5,7 @@
-->
<exceptions>
<exception package="org.lineageos.pen">
<permission name="android.permission.ACCESS_FINE_LOCATION" fixed="false" />
<permission name="android.permission.BLUETOOTH_CONNECT" fixed="false" />
<permission name="android.permission.BLUETOOTH_SCAN" fixed="false" />
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false" />

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Qələm taxılıb</string>
<string name="tap_to_connect">Bağlanmaq üçün toxunun</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Дигитална писалка е сдвоена</string>
<string name="tap_to_connect">Натисни за сдвояване</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Bolígraf adjunt</string>
<string name="tap_to_connect">Toqueu per connectar</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Pero připojeno</string>
<string name="tap_to_connect">Klepnutím připojit</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Η γραφίδα προσαρτήθηκε</string>
<string name="tap_to_connect">Πατήστε για σύνδεση</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Pen attached</string>
<string name="tap_to_connect">Tap to connect</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Pen attached</string>
<string name="tap_to_connect">Tap to connect</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Pen attached</string>
<string name="tap_to_connect">Tap to connect</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Pen attached</string>
<string name="tap_to_connect">Tap to connect</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Bolígrafo adjunto</string>
<string name="tap_to_connect">Toca para conectar</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">قلم متصل شد</string>
<string name="tap_to_connect">برای اتصال ضربه بزنید</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Stylo attaché</string>
<string name="tap_to_connect">Appuyer pour connecter</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Peann ceangailte</string>
<string name="tap_to_connect">Tapáil chun ceangal</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Toll mellékelve</string>
<string name="tap_to_connect">A csatlakoztatáshoz érintse meg</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Penna attaccata</string>
<string name="tap_to_connect">Tocca per connettere</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">עט מצורף</string>
<string name="tap_to_connect">נגיעה להתחברות</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">ペンを装着しました</string>
<string name="tap_to_connect">タップして接続</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">კალამი მიუერთდა</string>
<string name="tap_to_connect">შეეხეთ მიერთებისთვის</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Dołączone pióro</string>
<string name="tap_to_connect">Dotknij, aby połączyć</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Caneta anexada</string>
<string name="tap_to_connect">Toque para conectar</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Caneta anexada</string>
<string name="tap_to_connect">Toque para conectar</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Stilou atașat</string>
<string name="tap_to_connect">Atingeți pentru a conecta</string>
</resources>

View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="tap_to_connect">Нажмите, чтобы подключить</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Pinna alligongiada</string>
<string name="tap_to_connect">Toca pro connètere</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Pisalo priključeno</string>
<string name="tap_to_connect">Tapnite za povezavo</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">எழுத்தாணி இணைக்கப்பட்டது</string>
<string name="tap_to_connect">இணைக்கத் தட்டுக</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">قەلەم ئۇلاندى</string>
<string name="tap_to_connect">چېكىلسە باغلىنىدۇ</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">Đã gắn bút</string>
<string name="tap_to_connect">Chạm để kết nối</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="pen_attached">笔已连接</string>
<string name="tap_to_connect">轻触以连接</string>
</resources>

View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Max supported refresh rate when using pen. -->
<string name="config_penSupportedRefreshRate" translatable="false"></string>
</resources>

View File

@@ -15,73 +15,38 @@ import android.bluetooth.le.ScanCallback
import android.bluetooth.le.ScanFilter
import android.bluetooth.le.ScanResult
import android.bluetooth.le.ScanSettings
import android.content.Context
import android.content.Intent
import android.database.ContentObserver
import android.hardware.input.InputManager
import android.os.Handler
import android.os.IBinder
import android.os.UEventObserver
import android.provider.Settings
import android.provider.Settings.System.PEAK_REFRESH_RATE
import android.util.Log
class PenService : Service() {
private val bluetoothManager by lazy { getSystemService(BluetoothManager::class.java) }
private val inputManager by lazy { getSystemService(InputManager::class.java) }
private val notificationManager by lazy { getSystemService(NotificationManager::class.java) }
private val penSupportedRefreshRate by lazy {
getString(R.string.config_penSupportedRefreshRate)
}
private val observer = object : UEventObserver() {
private val lock = Any()
private val handler by lazy { Handler(mainLooper) }
override fun onUEvent(event: UEvent) {
synchronized(lock) {
val pencilStatus = event.get("pencil_status") ?: return
val pencilAddr = event.get("pencil_addr")?.chunked(2)?.joinToString(":") {
it.uppercase()
} ?: return
private val observer =
object : UEventObserver() {
private val lock = Any()
override fun onUEvent(event: UEvent) {
synchronized(lock) {
val pencilStatus = event.get("pencil_status") ?: return
val pencilAddr =
event.get("pencil_addr")?.chunked(2)?.joinToString(":") { it.uppercase() }
?: return
when (pencilStatus) {
"0" -> notificationManager.cancel(NOTIFICATION_ID)
"1" -> postNotification(pencilAddr)
}
when (pencilStatus) {
"0" -> notificationManager.cancel(NOTIFICATION_ID)
"1" -> postNotification(pencilAddr)
}
}
}
private val inputObserver =
object : InputManager.InputDeviceListener {
override fun onInputDeviceAdded(deviceId: Int) {
overridePeakRefreshRateIfNeeded()
}
override fun onInputDeviceRemoved(deviceId: Int) {
overridePeakRefreshRateIfNeeded()
}
override fun onInputDeviceChanged(deviceId: Int) {
// Do nothing
}
}
private val peakRefreshRateSettingsObserver by lazy {
object : ContentObserver(handler) {
override fun onChange(selfChange: Boolean) {
super.onChange(selfChange)
overridePeakRefreshRateIfNeeded()
}
}
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
intent?.getStringExtra(EXTRA_PENCIL_ADDR)?.let { bondBtDevice(it) }
intent?.getStringExtra(EXTRA_PENCIL_ADDR)?.let {
bondBtDevice(it)
}
return START_STICKY
}
@@ -91,28 +56,12 @@ class PenService : Service() {
override fun onCreate() {
super.onCreate()
if (!penSupportedRefreshRate.isEmpty()) {
contentResolver.registerContentObserver(
Settings.System.getUriFor(PEAK_REFRESH_RATE),
false,
peakRefreshRateSettingsObserver,
)
peakRefreshRateSettingsObserver.onChange(true)
inputManager.registerInputDeviceListener(inputObserver, handler)
}
observer.startObserving("DEVPATH=/devices/virtual/oplus_wireless/pencil")
}
override fun onDestroy() {
super.onDestroy()
if (!penSupportedRefreshRate.isEmpty()) {
contentResolver.unregisterContentObserver(peakRefreshRateSettingsObserver)
inputManager.unregisterInputDeviceListener(inputObserver)
}
observer.stopObserving()
}
@@ -120,16 +69,8 @@ class PenService : Service() {
val adapter = bluetoothManager.adapter
@Suppress("DEPRECATION") adapter.enable()
val scanner = run {
repeat(50) {
adapter.bluetoothLeScanner?.let {
return@run it
}
Thread.sleep(100)
}
return@run null
}
scanner?.startScan(
val scanner = adapter.bluetoothLeScanner
scanner.startScan(
listOf(ScanFilter.Builder().setDeviceAddress(pencilAddr).build()),
ScanSettings.Builder()
.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY)
@@ -152,36 +93,10 @@ class PenService : Service() {
super.onScanFailed(errorCode)
scanner.stopScan(this)
}
},
}
)
}
private fun overridePeakRefreshRateIfNeeded() {
val isPenConnected =
inputManager.inputDeviceIds.firstOrNull {
val device = inputManager.getInputDevice(it) ?: return@firstOrNull false
if (device.vendorId != 0x22D9 && device.vendorId != 0x330A) {
// Not an OPPO/Maxeye vendor ID
return@firstOrNull false
}
if (
device.bluetoothAddress?.startsWith("C0:87:06") == false &&
device.bluetoothAddress?.startsWith("F8:6F:DE") == false
) {
// Not a Maxeye/Goodix MAC prefix
return@firstOrNull false
}
return@firstOrNull true
} != null
val peakRefreshRate = Settings.System.getString(contentResolver, PEAK_REFRESH_RATE)
if (isPenConnected && peakRefreshRate == "Infinity") {
Settings.System.putString(contentResolver, PEAK_REFRESH_RATE, penSupportedRefreshRate)
} else if (!isPenConnected && peakRefreshRate == penSupportedRefreshRate) {
Settings.System.putString(contentResolver, PEAK_REFRESH_RATE, "Infinity")
}
}
private fun postNotification(pencilAddr: String) {
val adapter = bluetoothManager.adapter
@@ -195,29 +110,27 @@ class PenService : Service() {
NotificationChannel(
NOTIFICATION_CHANNEL_ID,
NOTIFICATION_CHANNEL_ID,
NotificationManager.IMPORTANCE_HIGH,
NotificationManager.IMPORTANCE_HIGH
)
)
}
val contentIntent =
PendingIntent.getService(
this,
0,
Intent(this, PenService::class.java).apply {
putExtra(EXTRA_PENCIL_ADDR, pencilAddr)
},
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT,
)
val contentIntent = PendingIntent.getService(
this,
0,
Intent(this, PenService::class.java).apply {
putExtra(EXTRA_PENCIL_ADDR, pencilAddr)
},
PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT
)
val notification =
Notification.Builder(this, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_stylus)
.setContentTitle(getString(R.string.pen_attached))
.setContentText(getString(R.string.tap_to_connect))
.setContentIntent(contentIntent)
.setAutoCancel(true)
.build()
val notification = Notification.Builder(this, NOTIFICATION_CHANNEL_ID)
.setSmallIcon(R.drawable.ic_stylus)
.setContentTitle(getString(R.string.pen_attached))
.setContentText(getString(R.string.tap_to_connect))
.setContentIntent(contentIntent)
.setAutoCancel(true)
.build()
notificationManager.notify(NOTIFICATION_ID, notification)
}

View File

@@ -16,3 +16,4 @@
| OPLUS_LINEAGE_TOUCH_HAL | USE_OPLUSTOUCH | Use and interface with stock OplusTouch | false |
| OPLUS_LINEAGE_VIBRATOR_HAL | INCLUDE_DIR | Device specific include dir path | |
| OPLUS_LINEAGE_VIBRATOR_HAL | USE_EFFECT_STREAM | Enable effect stream feature | false |
| QTI_GPT_UTILS | USE_BSG_FRAMEWORK | Enable BSG framework feature | true |

View File

@@ -19,8 +19,7 @@ AntiFlicker::AntiFlicker() : mOplusDisplayFd(open("/dev/oplus_display", O_RDWR))
ndk::ScopedAStatus AntiFlicker::getEnabled(bool* _aidl_return) {
unsigned int value;
if (ioctl(mOplusDisplayFd, PANEL_IOCTL_GET_PWM_PULSE, &value) != 0 &&
ioctl(mOplusDisplayFd, PANEL_IOCTL_GET_PWM_TURBO, &value) != 0 &&
if (ioctl(mOplusDisplayFd, PANEL_IOCTL_GET_PWM_TURBO, &value) != 0 &&
ioctl(mOplusDisplayFd, PANEL_IOCTL_GET_DIMLAYER_BL_EN, &value) != 0) {
LOG(ERROR) << "Failed to read current AntiFlicker state";
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
@@ -35,8 +34,7 @@ ndk::ScopedAStatus AntiFlicker::setEnabled(bool enabled) {
return status;
}
unsigned int value = enabled;
if (isEnabled != enabled && ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_PWM_PULSE, &value) != 0 &&
ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_PWM_TURBO, &value) != 0 &&
if (isEnabled != enabled && ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_PWM_TURBO, &value) != 0 &&
ioctl(mOplusDisplayFd, PANEL_IOCTL_SET_DIMLAYER_BL_EN, &value) != 0) {
LOG(ERROR) << "Failed to set AntiFlicker state";
return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);

View File

@@ -49,38 +49,39 @@ namespace android {
namespace hardware {
namespace vibrator {
#define STRONG_MAGNITUDE 0x7fff
#define MEDIUM_MAGNITUDE 0x5fff
#define LIGHT_MAGNITUDE 0x3fff
#define INVALID_VALUE -1
#define CUSTOM_DATA_LEN 3
#define NAME_BUF_SIZE 32
#define STRONG_MAGNITUDE 0x7fff
#define MEDIUM_MAGNITUDE 0x5fff
#define LIGHT_MAGNITUDE 0x3fff
#define INVALID_VALUE -1
#define CUSTOM_DATA_LEN 3
#define NAME_BUF_SIZE 32
#define MSM_CPU_LAHAINA 415
#define APQ_CPU_LAHAINA 439
#define MSM_CPU_SHIMA 450
#define MSM_CPU_SM8325 501
#define APQ_CPU_SM8325P 502
#define MSM_CPU_TARO 457
#define MSM_CPU_TARO_LTE 552
#define MSM_CPU_YUPIK 475
#define MSM_CPU_CAPE 530
#define APQ_CPU_CAPE 531
#define MSM_CPU_KALAMA 519
#define MSM_CPU_PINEAPPLE 557
#define MSM_CPU_SUN 618
#define MSM_CPU_LAHAINA 415
#define APQ_CPU_LAHAINA 439
#define MSM_CPU_SHIMA 450
#define MSM_CPU_SM8325 501
#define APQ_CPU_SM8325P 502
#define MSM_CPU_TARO 457
#define MSM_CPU_TARO_LTE 552
#define MSM_CPU_YUPIK 475
#define MSM_CPU_CAPE 530
#define APQ_CPU_CAPE 531
#define MSM_CPU_KALAMA 519
#define MSM_CPU_PINEAPPLE 557
#define MSM_CPU_SUN 618
#define test_bit(bit, array) ((array)[(bit) / 8] & (1 << ((bit) % 8)))
#define test_bit(bit, array) ((array)[(bit)/8] & (1<<((bit)%8)))
#define LED_DEVICE "/sys/class/leds/vibrator"
InputFFDevice::InputFFDevice() {
DIR* dp;
FILE* fp = NULL;
struct dirent* dir;
InputFFDevice::InputFFDevice()
{
DIR *dp;
FILE *fp = NULL;
struct dirent *dir;
uint8_t ffBitmask[FF_CNT / 8];
char devicename[PATH_MAX];
const char* INPUT_DIR = "/dev/input/";
const char *INPUT_DIR = "/dev/input/";
char name[NAME_BUF_SIZE];
int fd, ret;
int soc = property_get_int32("ro.vendor.qti.soc_id", -1);
@@ -100,9 +101,10 @@ InputFFDevice::InputFFDevice() {
}
memset(ffBitmask, 0, sizeof(ffBitmask));
while ((dir = readdir(dp)) != NULL) {
while ((dir = readdir(dp)) != NULL){
if (dir->d_name[0] == '.' &&
(dir->d_name[1] == '\0' || (dir->d_name[1] == '.' && dir->d_name[2] == '\0')))
(dir->d_name[1] == '\0' ||
(dir->d_name[1] == '.' && dir->d_name[2] == '\0')))
continue;
snprintf(devicename, PATH_MAX, "%s%s", INPUT_DIR, dir->d_name);
@@ -133,31 +135,34 @@ InputFFDevice::InputFFDevice() {
continue;
}
if (test_bit(FF_CONSTANT, ffBitmask) || test_bit(FF_PERIODIC, ffBitmask)) {
if (test_bit(FF_CONSTANT, ffBitmask) ||
test_bit(FF_PERIODIC, ffBitmask)) {
mVibraFd = fd;
if (test_bit(FF_CUSTOM, ffBitmask)) mSupportEffects = true;
if (test_bit(FF_GAIN, ffBitmask)) mSupportGain = true;
if (test_bit(FF_CUSTOM, ffBitmask))
mSupportEffects = true;
if (test_bit(FF_GAIN, ffBitmask))
mSupportGain = true;
if (soc <= 0 && (fp = fopen("/sys/devices/soc0/soc_id", "r")) != NULL) {
fscanf(fp, "%u", &soc);
fclose(fp);
}
switch (soc) {
case MSM_CPU_LAHAINA:
case APQ_CPU_LAHAINA:
case MSM_CPU_SHIMA:
case MSM_CPU_SM8325:
case APQ_CPU_SM8325P:
case MSM_CPU_TARO:
case MSM_CPU_YUPIK:
case MSM_CPU_KALAMA:
case MSM_CPU_PINEAPPLE:
case MSM_CPU_SUN:
mSupportExternalControl = true;
break;
default:
mSupportExternalControl = false;
break;
case MSM_CPU_LAHAINA:
case APQ_CPU_LAHAINA:
case MSM_CPU_SHIMA:
case MSM_CPU_SM8325:
case APQ_CPU_SM8325P:
case MSM_CPU_TARO:
case MSM_CPU_YUPIK:
case MSM_CPU_KALAMA:
case MSM_CPU_PINEAPPLE:
case MSM_CPU_SUN:
mSupportExternalControl = true;
break;
default:
mSupportExternalControl = false;
break;
}
break;
}
@@ -186,19 +191,20 @@ InputFFDevice::InputFFDevice() {
* kernel driver, and the rest two parameters are used for returning
* back the real playing length from kernel driver.
*/
int InputFFDevice::play(int effectId, uint32_t timeoutMs, long* playLengthMs) {
int InputFFDevice::play(int effectId, uint32_t timeoutMs, long *playLengthMs) {
struct ff_effect effect;
struct input_event play;
int16_t data[CUSTOM_DATA_LEN] = {0, 0, 0};
int ret;
#ifdef USE_EFFECT_STREAM
const struct effect_stream* stream;
const struct effect_stream *stream;
#endif
/* For QMAA compliance, return OK even if vibrator device doesn't exist */
if (mVibraFd == INVALID_VALUE) {
if (playLengthMs != NULL) *playLengthMs = 0;
return 0;
if (playLengthMs != NULL)
*playLengthMs = 0;
return 0;
}
if (timeoutMs != 0) {
@@ -222,7 +228,7 @@ int InputFFDevice::play(int effectId, uint32_t timeoutMs, long* playLengthMs) {
#ifdef USE_EFFECT_STREAM
stream = get_effect_stream(effectId);
if (stream != NULL) {
effect.u.periodic.custom_data = (int16_t*)stream;
effect.u.periodic.custom_data = (int16_t *)stream;
effect.u.periodic.custom_len = sizeof(*stream);
}
#endif
@@ -259,7 +265,8 @@ int InputFFDevice::play(int effectId, uint32_t timeoutMs, long* playLengthMs) {
if (ret == -1) {
ALOGE("write failed, errno = %d\n", -errno);
ret = TEMP_FAILURE_RETRY(ioctl(mVibraFd, EVIOCRMFF, mCurrAppId));
if (ret == -1) ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno);
if (ret == -1)
ALOGE("ioctl EVIOCRMFF failed, errno = %d", -errno);
goto errout;
}
} else if (mCurrAppId != INVALID_VALUE) {
@@ -290,7 +297,8 @@ int InputFFDevice::setAmplitude(uint8_t amplitude) {
struct input_event ie;
/* For QMAA compliance, return OK even if vibrator device doesn't exist */
if (mVibraFd == INVALID_VALUE) return 0;
if (mVibraFd == INVALID_VALUE)
return 0;
tmp = amplitude * (STRONG_MAGNITUDE - LIGHT_MAGNITUDE) / 255;
tmp += LIGHT_MAGNITUDE;
@@ -308,19 +316,19 @@ int InputFFDevice::setAmplitude(uint8_t amplitude) {
return 0;
}
int InputFFDevice::playEffect(int effectId, EffectStrength es, long* playLengthMs) {
int InputFFDevice::playEffect(int effectId, EffectStrength es, long *playLengthMs) {
switch (es) {
case EffectStrength::LIGHT:
mCurrMagnitude = LIGHT_MAGNITUDE;
break;
case EffectStrength::MEDIUM:
mCurrMagnitude = MEDIUM_MAGNITUDE;
break;
case EffectStrength::STRONG:
mCurrMagnitude = STRONG_MAGNITUDE;
break;
default:
return -1;
case EffectStrength::LIGHT:
mCurrMagnitude = LIGHT_MAGNITUDE;
break;
case EffectStrength::MEDIUM:
mCurrMagnitude = MEDIUM_MAGNITUDE;
break;
case EffectStrength::STRONG:
mCurrMagnitude = STRONG_MAGNITUDE;
break;
default:
return -1;
}
return play(effectId, INVALID_VALUE, playLengthMs);
@@ -342,7 +350,7 @@ LedVibratorDevice::LedVibratorDevice() {
mDetected = true;
}
int LedVibratorDevice::write_value(const char* file, const char* value) {
int LedVibratorDevice::write_value(const char *file, const char *value) {
int fd;
int ret;
@@ -371,7 +379,7 @@ int LedVibratorDevice::write_value(const char* file, const char* value) {
return ret;
}
int LedVibratorDevice::write_value(const char* file, int value) {
int LedVibratorDevice::write_value(const char *file, int value) {
return write_value(file, std::to_string(value).c_str());
}
@@ -402,7 +410,8 @@ int LedVibratorDevice::onWaveform(int waveformIndex) {
return ret;
}
int LedVibratorDevice::off() {
int LedVibratorDevice::off()
{
char file[PATH_MAX];
int ret;
@@ -420,9 +429,12 @@ ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) {
return ndk::ScopedAStatus::ok();
}
if (ff.mSupportGain) *_aidl_return |= IVibrator::CAP_AMPLITUDE_CONTROL;
if (ff.mSupportEffects) *_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK;
if (ff.mSupportExternalControl) *_aidl_return |= IVibrator::CAP_EXTERNAL_CONTROL;
if (ff.mSupportGain)
*_aidl_return |= IVibrator::CAP_AMPLITUDE_CONTROL;
if (ff.mSupportEffects)
*_aidl_return |= IVibrator::CAP_PERFORM_CALLBACK;
if (ff.mSupportExternalControl)
*_aidl_return |= IVibrator::CAP_EXTERNAL_CONTROL;
ALOGD("QTI Vibrator reporting capabilities: %d", *_aidl_return);
return ndk::ScopedAStatus::ok();
@@ -436,7 +448,8 @@ ndk::ScopedAStatus Vibrator::off() {
ret = ledVib.off();
else
ret = ff.off();
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
if (ret != 0)
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
return ndk::ScopedAStatus::ok();
}
@@ -451,7 +464,8 @@ ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs,
else
ret = ff.on(timeoutMs);
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
if (ret != 0)
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
if (callback != nullptr) {
std::thread([=] {
@@ -467,9 +481,7 @@ ndk::ScopedAStatus Vibrator::on(int32_t timeoutMs,
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es,
const std::shared_ptr<IVibratorCallback>& callback,
int32_t* _aidl_return) {
ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es, const std::shared_ptr<IVibratorCallback>& callback, int32_t* _aidl_return) {
long playLengthMs;
int ret;
@@ -477,28 +489,28 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es,
if (ledVib.mDetected) {
switch (effect) {
case Effect::CLICK:
ledVib.write_value(LED_DEVICE "/vmax", "2500");
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
break;
case Effect::DOUBLE_CLICK:
ledVib.write_value(LED_DEVICE "/vmax", "2500");
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
break;
case Effect::TICK:
ledVib.write_value(LED_DEVICE "/vmax", "1400");
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
break;
case Effect::HEAVY_CLICK:
ledVib.write_value(LED_DEVICE "/vmax", "2500");
ledVib.write_value(LED_DEVICE "/waveform_index", "4");
break;
case Effect::TEXTURE_TICK:
ledVib.write_value(LED_DEVICE "/vmax", "60");
ledVib.write_value(LED_DEVICE "/waveform_index", "2");
break;
default:
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
case Effect::CLICK:
ledVib.write_value(LED_DEVICE "/vmax", "2500");
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
break;
case Effect::DOUBLE_CLICK:
ledVib.write_value(LED_DEVICE "/vmax", "2500");
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
break;
case Effect::TICK:
ledVib.write_value(LED_DEVICE "/vmax", "1400");
ledVib.write_value(LED_DEVICE "/waveform_index", "1");
break;
case Effect::HEAVY_CLICK:
ledVib.write_value(LED_DEVICE "/vmax", "2500");
ledVib.write_value(LED_DEVICE "/waveform_index", "4");
break;
case Effect::TEXTURE_TICK:
ledVib.write_value(LED_DEVICE "/vmax", "60");
ledVib.write_value(LED_DEVICE "/waveform_index", "2");
break;
default:
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
if (effect == Effect::DOUBLE_CLICK) {
@@ -512,15 +524,16 @@ ndk::ScopedAStatus Vibrator::perform(Effect effect, EffectStrength es,
// Return magic value for play length so that we won't end up calling on() / off()
playLengthMs = 150;
} else {
if (effect < Effect::CLICK || effect > Effect::HEAVY_CLICK)
if (effect < Effect::CLICK || effect > Effect::HEAVY_CLICK)
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
if (es != EffectStrength::LIGHT && es != EffectStrength::MEDIUM &&
es != EffectStrength::STRONG)
es != EffectStrength::STRONG)
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
ret = ff.playEffect((static_cast<int>(effect)), es, &playLengthMs);
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
if (ret != 0)
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
}
if (callback != nullptr) {
@@ -541,8 +554,8 @@ ndk::ScopedAStatus Vibrator::getSupportedEffects(std::vector<Effect>* _aidl_retu
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::HEAVY_CLICK,
Effect::TEXTURE_TICK};
} else {
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK,
Effect::THUD, Effect::POP, Effect::HEAVY_CLICK};
*_aidl_return = {Effect::CLICK, Effect::DOUBLE_CLICK, Effect::TICK, Effect::THUD,
Effect::POP, Effect::HEAVY_CLICK};
}
return ndk::ScopedAStatus::ok();
}
@@ -564,7 +577,8 @@ ndk::ScopedAStatus Vibrator::setAmplitude(float amplitude) {
tmp = (uint8_t)(amplitude * 0xff);
ret = ff.setAmplitude(tmp);
if (ret != 0) return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
if (ret != 0)
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_SERVICE_SPECIFIC));
return ndk::ScopedAStatus::ok();
}
@@ -581,7 +595,7 @@ ndk::ScopedAStatus Vibrator::setExternalControl(bool enabled) {
return ndk::ScopedAStatus::ok();
}
ndk::ScopedAStatus Vibrator::getCompositionDelayMax(int32_t* maxDelayMs __unused) {
ndk::ScopedAStatus Vibrator::getCompositionDelayMax(int32_t* maxDelayMs __unused) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
@@ -589,8 +603,7 @@ ndk::ScopedAStatus Vibrator::getCompositionSizeMax(int32_t* maxSize __unused) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
ndk::ScopedAStatus Vibrator::getSupportedPrimitives(
std::vector<CompositePrimitive>* supported __unused) {
ndk::ScopedAStatus Vibrator::getSupportedPrimitives(std::vector<CompositePrimitive>* supported __unused) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
@@ -604,8 +617,7 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(
std::vector<Effect>* _aidl_return __unused) {
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return __unused) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
@@ -622,3 +634,4 @@ ndk::ScopedAStatus Vibrator::alwaysOnDisable(int32_t id __unused) {
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -131,172 +131,202 @@ static const int8_t effect_1[] = {
};
static const int8_t effect_2[] = {
1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6,
7, 8, 9, 10, 12, 13, 14, 16, 19, 22, 25, 28, 32, 36, 42,
48, 54, 61, 69, 78, 85, 92, 97, 102, 106, 110, 113, 115, 117, 119,
121, 121, 123, 123, 123, 124, 124, 124, 123, 123, 123, 122, 121, 121, 120,
119, 118, 117, 115, 114, 113, 112, 111, 109, 108, 106, 105, 103, 101, 99,
97, 95, 93, 91, 89, 86, 83, 80, 77, 73, 69, 64, 60, 54, 48,
41, 34, 25, 15, 4, -7, -22, -37, -51, -64, -74, -83, -91, -99, -104,
-109, -112, -115, -119, -120, -122, -122, -123, -122, -122, -122, -120, -120, -118, -116,
-114, -112, -110, -107, -105, -103, -99, -97, -95, -91, -89, -86, -83, -80, -77,
-74, -71, -68, -64, -61, -58, -55, -52, -49, -46, -43, -40, -36, -33, -29,
-26, -22, -18, -14, -10, -5, 0, 6, 12, 19, 27, 35, 42, 47, 52,
57, 60, 63, 65, 66, 67, 68, 68, 67, 67, 66, 64, 62, 61, 58,
56, 53, 51, 49, 45, 43, 39, 35, 33, 29, 26, 22, 19, 15, 12,
8, 5, 1, -2, -5, -9, -12, -14, -17, -20, -22, -25, -27, -28, -30,
-32, -32, -34, -34, -34, -34, -33, -31, -29, -27, -24, -21, -16, -11, -4,
2, 8, 14, 19, 23, 27, 31, 35, 38, 42, 45, 48, 51, 54, 56,
58, 62, 65, 67, 69, 72, 75, 78, 80, 83, 86, 88, 91, 94, 97,
99, 102, 104, 107, 109, 111, 114, 116, 118, 120, 121, 123, 124, 125, 126,
127, 127, 127, 127, 127, 126, 124, 123, 120, 117, 113, 109, 103, 96, 89,
80, 70, 58, 45, 32, 21, 11, 2, -6, -12, -18, -24, -29, -33, -37,
-41, -43, -47, -49, -51, -54, -56, -58, -59, -61, -62, -64, -65, -66, -67,
-68, -69, -70, -71, -72, -73, -74, -75, -76, -77, -77, -78, -78, -79, -79,
-80, -80, -80, -80, -80, -80, -80, -80, -79, -79, -78, -77, -75, -74, -72,
-70, -67, -64, -61, -57, -53, -47, -42, -37, -32, -28, -25, -22, -19, -16,
-15, -12, -11, -10, -8, -7, -6, -6, -5, -4, -4, -3, -3, -3, -3,
-2, -2, -2, -2, -2, -2, -2, -1, 0};
1, 1, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4,
4, 5, 6, 7, 8, 9, 10, 12, 13, 14, 16, 19,
22, 25, 28, 32, 36, 42, 48, 54, 61, 69, 78, 85,
92, 97, 102, 106, 110, 113, 115, 117, 119, 121, 121, 123,
123, 123, 124, 124, 124, 123, 123, 123, 122, 121, 121, 120,
119, 118, 117, 115, 114, 113, 112, 111, 109, 108, 106, 105,
103, 101, 99, 97, 95, 93, 91, 89, 86, 83, 80, 77,
73, 69, 64, 60, 54, 48, 41, 34, 25, 15, 4, -7,
-22, -37, -51, -64, -74, -83, -91, -99, -104, -109, -112, -115,
-119, -120, -122, -122, -123, -122, -122, -122, -120, -120, -118, -116,
-114, -112, -110, -107, -105, -103, -99, -97, -95, -91, -89, -86,
-83, -80, -77, -74, -71, -68, -64, -61, -58, -55, -52, -49,
-46, -43, -40, -36, -33, -29, -26, -22, -18, -14, -10, -5,
0, 6, 12, 19, 27, 35, 42, 47, 52, 57, 60, 63,
65, 66, 67, 68, 68, 67, 67, 66, 64, 62, 61, 58,
56, 53, 51, 49, 45, 43, 39, 35, 33, 29, 26, 22,
19, 15, 12, 8, 5, 1, -2, -5, -9, -12, -14, -17,
-20, -22, -25, -27, -28, -30, -32, -32, -34, -34, -34, -34,
-33, -31, -29, -27, -24, -21, -16, -11, -4, 2, 8, 14,
19, 23, 27, 31, 35, 38, 42, 45, 48, 51, 54, 56,
58, 62, 65, 67, 69, 72, 75, 78, 80, 83, 86, 88,
91, 94, 97, 99, 102, 104, 107, 109, 111, 114, 116, 118,
120, 121, 123, 124, 125, 126, 127, 127, 127, 127, 127, 126,
124, 123, 120, 117, 113, 109, 103, 96, 89, 80, 70, 58,
45, 32, 21, 11, 2, -6, -12, -18, -24, -29, -33, -37,
-41, -43, -47, -49, -51, -54, -56, -58, -59, -61, -62, -64,
-65, -66, -67, -68, -69, -70, -71, -72, -73, -74, -75, -76,
-77, -77, -78, -78, -79, -79, -80, -80, -80, -80, -80, -80,
-80, -80, -79, -79, -78, -77, -75, -74, -72, -70, -67, -64,
-61, -57, -53, -47, -42, -37, -32, -28, -25, -22, -19, -16,
-15, -12, -11, -10, -8, -7, -6, -6, -5, -4, -4, -3,
-3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -1, 0
};
static const int8_t effect_3[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 2,
3, 4, 6, 7, 9, 11, 14, 16, 19, 22, 26, 29, 33, 37, 41,
45, 49, 54, 58, 62, 66, 70, 74, 78, 81, 85, 88, 91, 94, 97,
99, 101, 103, 105, 106, 108, 108, 109, 110, 110, 110, 109, 109, 108, 107,
105, 104, 102, 100, 98, 96, 93, 90, 87, 84, 81, 78, 74, 70, 67,
63, 59, 54, 50, 46, 41, 37, 32, 28, 23, 18, 13, 9, 4, -1,
-6, -11, -15, -20, -25, -29, -34, -39, -43, -47, -52, -56, -60, -64, -68,
-71, -75, -78, -82, -85, -88, -90, -93, -95, -97, -99, -101, -103, -104, -106,
-107, -107, -108, -108, -108, -108, -108, -107, -107, -106, -105, -103, -102, -100, -98,
-96, -94, -91, -88, -86, -83, -79, -76, -72, -69, -65, -61, -57, -53, -49,
-44, -40, -35, -31, -26, -21, -17, -12, -7, -2, 3, 7, 12, 17, 22,
27, 31, 36, 40, 45, 49, 53, 57, 61, 65, 69, 73, 76, 80, 83,
86, 89, 91, 94, 96, 98, 100, 102, 104, 105, 106, 107, 108, 108, 108,
108, 108, 108, 107, 106, 105, 104, 103, 101, 99, 97, 95, 93, 90, 87,
84, 81, 75, 72, 68, 65, 61, 58, 54, 51, 47, 44, 41, 38, 35,
32, 30, 27, 24, 22, 19, 16, 14, 11, 8, 6, 3, 1, -2, -4,
-6, -8, -10, -11, -13, -14, -15, -16, -17, -18, -19, -20, -20, -21, -21,
-21, -21, -22, -22, -22, -22, -22, -22, -22, -22, -22, -21, -21, -21, -21,
-21, -20, -20, -20, -20, -19, -19, -18, -18, -18, -17, -17, -16, -16, -15,
-14, -14, -13, -12, -12, -11, -10, -9, -9, -8, -7, -6, -5, -4, -3,
-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10,
11, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 19,
20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20,
20, 20, 19, 19, 19, 18, 18, 17, 16, 16, 15, 15, 14, 13, 12,
12, 11, 10, 9, 8, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1,
-2, -3, -4, -4, -5, -6, -7, -8, -9, -10, -11, -11, -12, -13, -14,
-14, -15, -16, -16, -17, -17, -18, -18, -19, -19, -20, -20, -20, -20, -21,
-21, -21, -21, -21, -21, -21, -21, -21, -21, -20, -20, -20, -20, -19, -19,
-18, -18, -17, -17, -16, -16, -15, -14, -14, -13, -12, -11, -11, -10, -9,
-8, -7, -6, -5, -4, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5,
6, 7, 8, 8, 9, 10, 11, 12, 12, 13, 14, 15, 15, 16, 16,
17, 18, 18, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 17, 17,
16, 15, 15, 14, 13, 13, 12, 11, 10, 9, 9, 8, 7, 6, 5,
4, 3, 2, 1, 0, -1, -1, -2, -3, -4, -5, -6, -7, -8, -9,
-9, -10, -11, -12, -13, -13, -14, -15, -15, -16, -17, -17, -18, -18, -19,
-19, -19, -20, -20, -20, -21, -21, -21, -21, -21, -21, -21, -21, -21, -21,
-20, -20, -20, -20, -19, -19, -18, -18, -18, -17, -16, -16, -15, -15, -14,
-13, -12, -12, -11, -10, -9, -8, -7, -7, -6, -5, -4, -3, -2, -1,
0, 1, 2, 3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12,
13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 20,
20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 20,
19, 19, 18, 18, 17, 17, 16, 16, 15, 14, 14, 13, 12, 11, 10,
10, 9, 8, 7, 6, 5, 4, 3, 3, 2, 1, 0, -1, -2, -3,
-4, -5, -6, -7, -8, -8, -10, -10, -11, -12, -13, -14, -14, -15, -16,
-16, -17, -17, -17, -17, -17, -17, -16, -14, -12, -10, -7, -4, 0, 4,
8, 13, 19, 24, 30, 36, 42, 48, 53, 59, 64, 69, 74, 78, 82,
85, 87, 89, 91, 92, 92, 91, 89, 87, 83, 79, 73, 67, 60, 52,
44, 36, 27, 18, 10, 1, -7, -14, -22, -29, -36, -43, -50, -56, -62,
-69, -75, -81, -86, -92, -97, -102, -107, -111, -115, -118, -121, -123, -124, -126,
-127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
-127, -127, -127, -126, -124, -122, -120, -117, -114, -110, -106, -101, -96, -90, -84,
-79, -73, -67, -60, -54, -48, -42, -36, -30, -24, -18, -13, -7, -1, 4,
9, 14, 19, 24, 28, 33, 37, 41, 44, 48, 51, 54, 57, 60, 62,
64, 66, 68, 69, 70, 71, 72, 73, 73, 73, 73, 73, 73, 72, 71,
71, 70, 68, 67, 66, 64, 63, 61, 59, 57, 55, 53, 51, 49, 46,
44, 42, 39, 37, 35, 32, 30, 28, 25, 23, 21, 18, 16, 14, 12,
10, 8, 6, 4, 2, 1, -1, -3, -4, -5, -7, -8, -9, -10, -11,
-12, -13, -14, -15, -15, -16, -16, -16, -17, -17, -17, -17, -17, -17, -17,
-17, -17, -17, -17, -16, -16, -15, -15, -15, -14, -14, -13, -13, -12, -11,
-11, -10, -10, -9, -8, -8, -7, -7, -6, -5, -5, -4, -4, -3, -3,
-2, -2, -1, -1, 0};
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
1, 2, 2, 3, 4, 6, 7, 9, 11, 14, 16, 19,
22, 26, 29, 33, 37, 41, 45, 49, 54, 58, 62, 66,
70, 74, 78, 81, 85, 88, 91, 94, 97, 99, 101, 103,
105, 106, 108, 108, 109, 110, 110, 110, 109, 109, 108, 107,
105, 104, 102, 100, 98, 96, 93, 90, 87, 84, 81, 78,
74, 70, 67, 63, 59, 54, 50, 46, 41, 37, 32, 28,
23, 18, 13, 9, 4, -1, -6, -11, -15, -20, -25, -29,
-34, -39, -43, -47, -52, -56, -60, -64, -68, -71, -75, -78,
-82, -85, -88, -90, -93, -95, -97, -99, -101, -103, -104, -106,
-107, -107, -108, -108, -108, -108, -108, -107, -107, -106, -105, -103,
-102, -100, -98, -96, -94, -91, -88, -86, -83, -79, -76, -72,
-69, -65, -61, -57, -53, -49, -44, -40, -35, -31, -26, -21,
-17, -12, -7, -2, 3, 7, 12, 17, 22, 27, 31, 36,
40, 45, 49, 53, 57, 61, 65, 69, 73, 76, 80, 83,
86, 89, 91, 94, 96, 98, 100, 102, 104, 105, 106, 107,
108, 108, 108, 108, 108, 108, 107, 106, 105, 104, 103, 101,
99, 97, 95, 93, 90, 87, 84, 81, 75, 72, 68, 65,
61, 58, 54, 51, 47, 44, 41, 38, 35, 32, 30, 27,
24, 22, 19, 16, 14, 11, 8, 6, 3, 1, -2, -4,
-6, -8, -10, -11, -13, -14, -15, -16, -17, -18, -19, -20,
-20, -21, -21, -21, -21, -22, -22, -22, -22, -22, -22, -22,
-22, -22, -21, -21, -21, -21, -21, -20, -20, -20, -20, -19,
-19, -18, -18, -18, -17, -17, -16, -16, -15, -14, -14, -13,
-12, -12, -11, -10, -9, -9, -8, -7, -6, -5, -4, -3,
-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8,
8, 9, 10, 11, 12, 13, 13, 14, 15, 15, 16, 17,
17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 21,
21, 21, 21, 21, 21, 21, 21, 21, 20, 20, 20, 19,
19, 19, 18, 18, 17, 16, 16, 15, 15, 14, 13, 12,
12, 11, 10, 9, 8, 8, 7, 6, 5, 4, 3, 2,
1, 0, -1, -2, -3, -4, -4, -5, -6, -7, -8, -9,
-10, -11, -11, -12, -13, -14, -14, -15, -16, -16, -17, -17,
-18, -18, -19, -19, -20, -20, -20, -20, -21, -21, -21, -21,
-21, -21, -21, -21, -21, -21, -20, -20, -20, -20, -19, -19,
-18, -18, -17, -17, -16, -16, -15, -14, -14, -13, -12, -11,
-11, -10, -9, -8, -7, -6, -5, -4, -4, -3, -2, -1,
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 10,
11, 12, 12, 13, 14, 15, 15, 16, 16, 17, 18, 18,
19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 21,
21, 21, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18,
18, 17, 17, 16, 15, 15, 14, 13, 13, 12, 11, 10,
9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1,
-1, -2, -3, -4, -5, -6, -7, -8, -9, -9, -10, -11,
-12, -13, -13, -14, -15, -15, -16, -17, -17, -18, -18, -19,
-19, -19, -20, -20, -20, -21, -21, -21, -21, -21, -21, -21,
-21, -21, -21, -20, -20, -20, -20, -19, -19, -18, -18, -18,
-17, -16, -16, -15, -15, -14, -13, -12, -12, -11, -10, -9,
-8, -7, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2,
3, 4, 4, 5, 6, 7, 8, 9, 10, 11, 11, 12,
13, 14, 14, 15, 16, 16, 17, 17, 18, 18, 19, 19,
20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21,
21, 21, 20, 20, 20, 20, 19, 19, 18, 18, 17, 17,
16, 16, 15, 14, 14, 13, 12, 11, 10, 10, 9, 8,
7, 6, 5, 4, 3, 3, 2, 1, 0, -1, -2, -3,
-4, -5, -6, -7, -8, -8, -10, -10, -11, -12, -13, -14,
-14, -15, -16, -16, -17, -17, -17, -17, -17, -17, -16, -14,
-12, -10, -7, -4, 0, 4, 8, 13, 19, 24, 30, 36,
42, 48, 53, 59, 64, 69, 74, 78, 82, 85, 87, 89,
91, 92, 92, 91, 89, 87, 83, 79, 73, 67, 60, 52,
44, 36, 27, 18, 10, 1, -7, -14, -22, -29, -36, -43,
-50, -56, -62, -69, -75, -81, -86, -92, -97, -102, -107, -111,
-115, -118, -121, -123, -124, -126, -127, -127, -127, -127, -127, -127,
-127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127, -127,
-126, -124, -122, -120, -117, -114, -110, -106, -101, -96, -90, -84,
-79, -73, -67, -60, -54, -48, -42, -36, -30, -24, -18, -13,
-7, -1, 4, 9, 14, 19, 24, 28, 33, 37, 41, 44,
48, 51, 54, 57, 60, 62, 64, 66, 68, 69, 70, 71,
72, 73, 73, 73, 73, 73, 73, 72, 71, 71, 70, 68,
67, 66, 64, 63, 61, 59, 57, 55, 53, 51, 49, 46,
44, 42, 39, 37, 35, 32, 30, 28, 25, 23, 21, 18,
16, 14, 12, 10, 8, 6, 4, 2, 1, -1, -3, -4,
-5, -7, -8, -9, -10, -11, -12, -13, -14, -15, -15, -16,
-16, -16, -17, -17, -17, -17, -17, -17, -17, -17, -17, -17,
-17, -16, -16, -15, -15, -15, -14, -14, -13, -13, -12, -11,
-11, -10, -10, -9, -8, -8, -7, -7, -6, -5, -5, -4,
-4, -3, -3, -2, -2, -1, -1, 0
};
static const int8_t effect_4[] = {
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 3,
3, 4, 4, 5, 6, 7, 8, 9, 10, 12, 13, 15, 17, 19, 22,
25, 28, 32, 37, 42, 48, 55, 62, 70, 79, 86, 92, 97, 102, 107,
110, 113, 115, 117, 119, 121, 121, 123, 123, 123, 124, 124, 124, 123, 123,
123, 121, 121, 121, 119, 119, 118, 117, 115, 114, 113, 112, 110, 109, 107,
106, 105, 102, 101, 99, 97, 95, 93, 91, 89, 86, 83, 80, 77, 73,
69, 64, 60, 54, 48, 41, 33, 24, 14, 3, -9, -23, -38, -52, -65,
-75, -84, -92, -99, -104, -109, -113, -115, -119, -120, -122, -122, -123, -122, -122,
-121, -120, -119, -118, -116, -114, -112, -110, -107, -105, -102, -99, -97, -94, -91,
-88, -85, -82, -79, -76, -74, -70, -68, -64, -61, -58, -55, -52, -49, -46,
-43, -39, -36, -33, -29, -26, -22, -18, -14, -10, -5, 0, 7, 13, 20,
28, 35, 42, 48, 53, 58, 60, 63, 65, 66, 67, 68, 68, 67, 67,
66, 64, 62, 61, 58, 56, 53, 51, 48, 45, 42, 38, 35, 33, 28,
26, 22, 19, 15, 12, 8, 5, 1, -2, -5, -9, -12, -14, -17, -20,
-22, -25, -28, -29, -30, -32, -32, -34, -34, -34, -33, -33, -31, -29, -27,
-24, -20, -16, -10, -3, 3, 9, 14, 19, 24, 27, 32, 35, 38, 42,
45, 48, 51, 54, 57, 59, 62, 65, 68, 70, 73, 76, 78, 80, 84,
86, 88, 91, 94, 97, 99, 102, 104, 107, 109, 111, 114, 116, 118, 120,
121, 123, 124, 125, 126, 127, 127, 127, 127, 127, 125, 124, 123, 120, 117,
113, 108, 102, 96, 88, 79, 69, 57, 44, 31, 20, 10, 2, -6, -13,
-19, -24, -29, -33, -37, -41, -44, -47, -49, -52, -54, -56, -58, -59, -61,
-62, -64, -66, -66, -67, -68, -69, -70, -71, -72, -73, -74, -75, -76, -77,
-77, -78, -78, -79, -79, -80, -80, -80, -80, -80, -80, -80, -80, -79, -79,
-78, -77, -75, -74, -72, -70, -67, -64, -61, -56, -52, -46, -41, -36, -31,
-27, -24, -21, -18, -16, -14, -12, -11, -9, -8, -7, -6, -6, -5, -4,
-4, -3, -3, -3, -3, -2, -2, -2, -2, -2, -2, -2, -1, 0, 0,
0, 0, 0, 0, 0};
0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2,
2, 2, 3, 3, 4, 4, 5, 6, 7, 8, 9, 10,
12, 13, 15, 17, 19, 22, 25, 28, 32, 37, 42, 48,
55, 62, 70, 79, 86, 92, 97, 102, 107, 110, 113, 115,
117, 119, 121, 121, 123, 123, 123, 124, 124, 124, 123, 123,
123, 121, 121, 121, 119, 119, 118, 117, 115, 114, 113, 112,
110, 109, 107, 106, 105, 102, 101, 99, 97, 95, 93, 91,
89, 86, 83, 80, 77, 73, 69, 64, 60, 54, 48, 41,
33, 24, 14, 3, -9, -23, -38, -52, -65, -75, -84, -92,
-99, -104, -109, -113, -115, -119, -120, -122, -122, -123, -122, -122,
-121, -120, -119, -118, -116, -114, -112, -110, -107, -105, -102, -99,
-97, -94, -91, -88, -85, -82, -79, -76, -74, -70, -68, -64,
-61, -58, -55, -52, -49, -46, -43, -39, -36, -33, -29, -26,
-22, -18, -14, -10, -5, 0, 7, 13, 20, 28, 35, 42,
48, 53, 58, 60, 63, 65, 66, 67, 68, 68, 67, 67,
66, 64, 62, 61, 58, 56, 53, 51, 48, 45, 42, 38,
35, 33, 28, 26, 22, 19, 15, 12, 8, 5, 1, -2,
-5, -9, -12, -14, -17, -20, -22, -25, -28, -29, -30, -32,
-32, -34, -34, -34, -33, -33, -31, -29, -27, -24, -20, -16,
-10, -3, 3, 9, 14, 19, 24, 27, 32, 35, 38, 42,
45, 48, 51, 54, 57, 59, 62, 65, 68, 70, 73, 76,
78, 80, 84, 86, 88, 91, 94, 97, 99, 102, 104, 107,
109, 111, 114, 116, 118, 120, 121, 123, 124, 125, 126, 127,
127, 127, 127, 127, 125, 124, 123, 120, 117, 113, 108, 102,
96, 88, 79, 69, 57, 44, 31, 20, 10, 2, -6, -13,
-19, -24, -29, -33, -37, -41, -44, -47, -49, -52, -54, -56,
-58, -59, -61, -62, -64, -66, -66, -67, -68, -69, -70, -71,
-72, -73, -74, -75, -76, -77, -77, -78, -78, -79, -79, -80,
-80, -80, -80, -80, -80, -80, -80, -79, -79, -78, -77, -75,
-74, -72, -70, -67, -64, -61, -56, -52, -46, -41, -36, -31,
-27, -24, -21, -18, -16, -14, -12, -11, -9, -8, -7, -6,
-6, -5, -4, -4, -3, -3, -3, -3, -2, -2, -2, -2,
-2, -2, -2, -1, 0, 0, 0, 0, 0, 0, 0
};
static const struct effect_stream effects[] = {
{
/* CLICK */
.effect_id = 0,
.data = effect_2,
.length = ARRAY_SIZE(effect_2),
.play_rate_hz = 24000,
},
{
/* CLICK */
.effect_id = 0,
.data = effect_2,
.length = ARRAY_SIZE(effect_2),
.play_rate_hz = 24000,
},
{
/* DOUBLE_CLICK */
.effect_id = 1,
.data = effect_1,
.length = ARRAY_SIZE(effect_1),
.play_rate_hz = 24000,
},
{
/* DOUBLE_CLICK */
.effect_id = 1,
.data = effect_1,
.length = ARRAY_SIZE(effect_1),
.play_rate_hz = 24000,
},
{
/* TICK */
.effect_id = 2,
.data = effect_2,
.length = ARRAY_SIZE(effect_2),
.play_rate_hz = 24000,
},
{
/* TICK */
.effect_id = 2,
.data = effect_2,
.length = ARRAY_SIZE(effect_2),
.play_rate_hz = 24000,
},
{
/* THUD */
.effect_id = 3,
.data = effect_3,
.length = ARRAY_SIZE(effect_3),
.play_rate_hz = 24000,
},
{
/* THUD */
.effect_id = 3,
.data = effect_3,
.length = ARRAY_SIZE(effect_3),
.play_rate_hz = 24000,
},
{
/* POP */
.effect_id = 4,
.data = effect_4,
.length = ARRAY_SIZE(effect_4),
.play_rate_hz = 24000,
},
{
/* POP */
.effect_id = 4,
.data = effect_4,
.length = ARRAY_SIZE(effect_4),
.play_rate_hz = 24000,
},
{
/* HEAVY_CLICK */
.effect_id = 5,
.data = effect_3,
.length = ARRAY_SIZE(effect_3),
.play_rate_hz = 24000,
},
{
/* HEAVY_CLICK */
.effect_id = 5,
.data = effect_3,
.length = ARRAY_SIZE(effect_3),
.play_rate_hz = 24000,
},
};

View File

@@ -32,12 +32,12 @@
#include <sys/types.h>
struct effect_stream {
uint32_t effect_id;
uint32_t length;
uint32_t play_rate_hz;
const int8_t* data;
uint32_t effect_id;
uint32_t length;
uint32_t play_rate_hz;
const int8_t *data;
};
const struct effect_stream* get_effect_stream(uint32_t effect_id);
const struct effect_stream *get_effect_stream(uint32_t effect_id);
#endif

View File

@@ -37,9 +37,9 @@ namespace hardware {
namespace vibrator {
class InputFFDevice {
public:
public:
InputFFDevice();
int playEffect(int effectId, EffectStrength es, long* playLengthMs);
int playEffect(int effectId, EffectStrength es, long *playLengthMs);
int on(int32_t timeoutMs);
int off();
int setAmplitude(uint8_t amplitude);
@@ -47,37 +47,36 @@ class InputFFDevice {
bool mSupportEffects;
bool mSupportExternalControl;
bool mInExternalControl;
private:
int play(int effectId, uint32_t timeoutMs, long* playLengthMs);
private:
int play(int effectId, uint32_t timeoutMs, long *playLengthMs);
int mVibraFd;
int16_t mCurrAppId;
int16_t mCurrMagnitude;
};
class LedVibratorDevice {
public:
public:
LedVibratorDevice();
int on(int32_t timeoutMs);
int onWaveform(int waveformIndex);
int off();
bool mDetected;
int write_value(const char* file, const char* value);
int write_value(const char* file, int value);
int write_value(const char *file, const char *value);
int write_value(const char *file, int value);
};
class Vibrator : public BnVibrator {
public:
public:
class InputFFDevice ff;
class LedVibratorDevice ledVib;
ndk::ScopedAStatus getCapabilities(int32_t* _aidl_return) override;
ndk::ScopedAStatus off() override;
ndk::ScopedAStatus on(int32_t timeoutMs,
const std::shared_ptr<IVibratorCallback>& callback) override;
const std::shared_ptr<IVibratorCallback>& callback) override;
ndk::ScopedAStatus perform(Effect effect, EffectStrength strength,
const std::shared_ptr<IVibratorCallback>& callback,
int32_t* _aidl_return) override;
const std::shared_ptr<IVibratorCallback>& callback,
int32_t* _aidl_return) override;
ndk::ScopedAStatus getSupportedEffects(std::vector<Effect>* _aidl_return) override;
ndk::ScopedAStatus setAmplitude(float amplitude) override;
ndk::ScopedAStatus setExternalControl(bool enabled) override;

View File

@@ -143,7 +143,7 @@ ndk::ScopedAStatus Vibrator::getCompositionSizeMax(int32_t* maxSize __unused) {
}
ndk::ScopedAStatus Vibrator::getSupportedPrimitives(
std::vector<CompositePrimitive>* supported __unused) {
std::vector<CompositePrimitive>* supported __unused) {
return ndk::ScopedAStatus::ok();
}
@@ -157,8 +157,7 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect>& composi
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(
std::vector<Effect>* _aidl_return __unused) {
ndk::ScopedAStatus Vibrator::getSupportedAlwaysOnEffects(std::vector<Effect>* _aidl_return __unused) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}
@@ -204,8 +203,7 @@ ndk::ScopedAStatus Vibrator::getSupportedBraking(std::vector<Braking>* supported
}
ndk::ScopedAStatus Vibrator::composePwle(const std::vector<PrimitivePwle>& composite __unused,
const std::shared_ptr<IVibratorCallback>& callback
__unused) {
const std::shared_ptr<IVibratorCallback>& callback __unused) {
return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
}

View File

@@ -5,7 +5,7 @@
*/
#define LOG_TAG "audio_amplifier"
// #define LOG_NDEBUG 0
//#define LOG_NDEBUG 0
#include <cutils/str_parms.h>
#include <dlfcn.h>

View File

@@ -15,8 +15,6 @@ android_app {
],
optimize: {
optimize: true,
proguard_flags_files: ["proguard.flags"],
shrink_resources: true,
},
}

View File

@@ -17,7 +17,6 @@
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
android:title="@string/ambient_display_title">
@@ -30,7 +29,7 @@
android:key="doze_enable"
android:title="@string/ambient_display_enable_title" />
<SwitchPreferenceCompat
<SwitchPreference
android:key="always_on_display"
android:disableDependentsState="true"
android:title="@string/ambient_display_always_on_title"
@@ -45,10 +44,10 @@
android:key="gesture_pick_up_type"
android:defaultValue="0"
android:icon="@drawable/ic_pickup"
android:entries="@array/pick_up_gesture_entries"
android:entryValues="@array/pick_up_gesture_values"
android:title="@string/pick_up_gesture_title"
app:useSimpleSummaryProvider="true" />
android:summary="%s"
android:entries="@array/pick_up_gesture_entries"
android:entryValues="@array/pick_up_gesture_values" />
</PreferenceCategory>
@@ -56,7 +55,7 @@
android:key="proximity_sensor"
android:title="@string/proximity_sensor_title">
<SwitchPreferenceCompat
<SwitchPreference
android:key="gesture_pocket"
android:defaultValue="false"
android:icon="@drawable/ic_pocket"

View File

@@ -17,30 +17,27 @@ class DozeService : Service() {
private lateinit var pickupSensor: PickupSensor
private lateinit var pocketSensor: PocketSensor
private val screenStateReceiver =
object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
Intent.ACTION_SCREEN_ON -> onDisplayOn()
Intent.ACTION_SCREEN_OFF -> onDisplayOff()
}
private val screenStateReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.action) {
Intent.ACTION_SCREEN_ON -> onDisplayOn()
Intent.ACTION_SCREEN_OFF -> onDisplayOff()
}
}
}
override fun onCreate() {
Log.d(TAG, "Creating service")
pickupSensor =
PickupSensor(
this,
resources.getString(R.string.pickup_sensor_type),
resources.getFloat(R.dimen.pickup_sensor_value),
)
pocketSensor =
PocketSensor(
this,
resources.getString(R.string.pocket_sensor_type),
resources.getFloat(R.dimen.pocket_sensor_value),
)
pickupSensor = PickupSensor(
this,
resources.getString(R.string.pickup_sensor_type),
resources.getFloat(R.dimen.pickup_sensor_value),
)
pocketSensor = PocketSensor(
this,
resources.getString(R.string.pocket_sensor_type),
resources.getFloat(R.dimen.pocket_sensor_value)
)
val screenStateFilter = IntentFilter()
screenStateFilter.addAction(Intent.ACTION_SCREEN_ON)

View File

@@ -16,9 +16,8 @@ class DozeSettingsActivity : CollapsingToolbarBaseActivity() {
.replace(
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
DozeSettingsFragment(),
TAG,
)
.commit()
TAG
).commit()
}
companion object {

View File

@@ -1,27 +1,28 @@
/*
* SPDX-FileCopyrightText: 2021-2025 The LineageOS Project
* Copyright (C) 2021-2024 The LineageOS Project
* SPDX-License-Identifier: Apache-2.0
*/
package org.lineageos.settings.doze
import android.app.Activity
import android.app.AlertDialog
import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.PreferenceCategory
import androidx.preference.PreferenceFragmentCompat
import androidx.preference.SwitchPreferenceCompat
import android.widget.CompoundButton
import androidx.preference.*
import com.android.settingslib.widget.MainSwitchPreference
class DozeSettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener {
private lateinit var alwaysOnDisplayPreference: SwitchPreferenceCompat
class DozeSettingsFragment : PreferenceFragmentCompat(), Preference.OnPreferenceChangeListener,
CompoundButton.OnCheckedChangeListener {
private lateinit var alwaysOnDisplayPreference: SwitchPreference
private lateinit var switchBar: MainSwitchPreference
private var pickUpPreference: ListPreference? = null
private var pocketPreference: SwitchPreferenceCompat? = null
private var pocketPreference: SwitchPreference? = null
private val handler = Handler(Looper.getMainLooper())
@@ -40,8 +41,8 @@ class DozeSettingsFragment : PreferenceFragmentCompat(), Preference.OnPreference
}
val dozeEnabled = Utils.isDozeEnabled(requireContext())
val switchBar = findPreference<MainSwitchPreference>(Utils.DOZE_ENABLE)!!
switchBar.onPreferenceChangeListener = this
switchBar = findPreference(Utils.DOZE_ENABLE)!!
switchBar.addOnSwitchChangeListener(this)
switchBar.isChecked = dozeEnabled
alwaysOnDisplayPreference = findPreference(Utils.ALWAYS_ON_DISPLAY)!!
@@ -79,28 +80,27 @@ class DozeSettingsFragment : PreferenceFragmentCompat(), Preference.OnPreference
}
override fun onPreferenceChange(preference: Preference, newValue: Any?): Boolean {
when (preference.key) {
Utils.ALWAYS_ON_DISPLAY -> {
val isChecked = newValue as Boolean
Utils.enableAlwaysOn(requireContext(), isChecked)
}
Utils.DOZE_ENABLE -> {
val isChecked = newValue as Boolean
Utils.enableDoze(requireContext(), isChecked)
Utils.checkDozeService(requireContext())
if (!isChecked) {
Utils.enableAlwaysOn(requireContext(), false)
alwaysOnDisplayPreference.isChecked = false
}
alwaysOnDisplayPreference.isEnabled = isChecked
pickUpPreference?.isEnabled = isChecked
pocketPreference?.isEnabled = isChecked
}
if (preference.key == Utils.ALWAYS_ON_DISPLAY) {
Utils.enableAlwaysOn(requireContext(), newValue as Boolean)
}
handler.post { Utils.checkDozeService(requireContext()) }
return true
}
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
Utils.enableDoze(requireContext(), isChecked)
Utils.checkDozeService(requireContext())
switchBar.isChecked = isChecked
if (!isChecked) {
Utils.enableAlwaysOn(requireContext(), false)
alwaysOnDisplayPreference.isChecked = false
}
alwaysOnDisplayPreference.isEnabled = isChecked
pickUpPreference?.isEnabled = isChecked
pocketPreference?.isEnabled = isChecked
}
}

View File

@@ -14,12 +14,11 @@ import android.os.PowerManager
import android.os.SystemClock
import android.util.Log
import android.view.Display
import java.util.concurrent.Executors
class PickupSensor(
private val context: Context,
sensorType: String,
private val sensorValue: Float,
private val context: Context, sensorType: String, private val sensorValue: Float
) : SensorEventListener {
private val powerManager = context.getSystemService(PowerManager::class.java)!!
private val wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG)
@@ -44,7 +43,7 @@ class PickupSensor(
SystemClock.uptimeMillis(),
PowerManager.WAKE_REASON_GESTURE,
TAG,
Display.DEFAULT_DISPLAY,
Display.DEFAULT_DISPLAY
)
} else {
Utils.launchDozePulse(context)
@@ -62,12 +61,15 @@ class PickupSensor(
sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_NORMAL)
}
}
}
fun disable() {
if (sensor != null) {
Log.d(TAG, "Disabling")
executorService.submit { sensorManager.unregisterListener(this, sensor) }
executorService.submit {
sensorManager.unregisterListener(this, sensor)
}
}
}

View File

@@ -12,12 +12,11 @@ import android.hardware.SensorEventListener
import android.hardware.SensorManager
import android.os.SystemClock
import android.util.Log
import java.util.concurrent.Executors
class PocketSensor(
private val context: Context,
sensorType: String,
private val sensorValue: Float,
private val context: Context, sensorType: String, private val sensorValue: Float
) : SensorEventListener {
private val sensorManager = context.getSystemService(SensorManager::class.java)!!
private val sensor = Utils.getSensor(sensorManager, sensorType)
@@ -52,7 +51,9 @@ class PocketSensor(
fun disable() {
if (sensor != null) {
Log.d(TAG, "Disabling")
executorService.submit { sensorManager.unregisterListener(this, sensor) }
executorService.submit {
sensorManager.unregisterListener(this, sensor)
}
}
}

View File

@@ -64,19 +64,13 @@ object Utils {
fun enableAlwaysOn(context: Context, enable: Boolean): Boolean {
return Settings.Secure.putIntForUser(
context.contentResolver,
DOZE_ALWAYS_ON,
if (enable) 1 else 0,
UserHandle.USER_CURRENT,
context.contentResolver, DOZE_ALWAYS_ON, if (enable) 1 else 0, UserHandle.USER_CURRENT
)
}
fun isAlwaysOnEnabled(context: Context): Boolean {
return Settings.Secure.getIntForUser(
context.contentResolver,
DOZE_ALWAYS_ON,
0,
UserHandle.USER_CURRENT,
context.contentResolver, DOZE_ALWAYS_ON, 0, UserHandle.USER_CURRENT
) != 0
}
@@ -85,7 +79,8 @@ object Utils {
}
private fun isGestureEnabled(context: Context, gesture: String?): Boolean {
return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(gesture, false)
return PreferenceManager.getDefaultSharedPreferences(context)
.getBoolean(gesture, false)
}
fun isPickUpEnabled(context: Context): Boolean {

View File

@@ -1,32 +0,0 @@
//
// SPDX-FileCopyrightText: 2025 The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
android_app {
name: "OplusEsimSwitcher",
defaults: ["SettingsLibDefaults"],
srcs: ["src/**/*.kt"],
resource_dirs: ["res"],
certificate: "platform",
platform_apis: true,
system_ext_specific: true,
privileged: true,
privapp_allowlist: "org.lineageos.settings.esimswitcher.xml",
static_libs: [
"androidx.core_core",
"androidx.preference_preference",
"org.lineageos.settings.resources",
"vendor.oplus.hardware.esim-V1-java",
],
optimize: {
optimize: true,
proguard_flags_files: ["proguard.flags"],
shrink_resources: true,
},
}

View File

@@ -1,50 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.lineageos.settings.esimswitcher">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.SECURE_ELEMENT_PRIVILEGED_OPERATION" />
<application
android:directBootAware="true"
android:label="@string/device_settings_app_name"
android:persistent="true"
android:theme="@style/Theme.SubSettingsBase">
<activity
android:exported="false"
android:label="@string/esim_settings_title"
android:name=".EsimSettingsActivity">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.wireless" />
<meta-data android:name="com.android.settings.icon"
android:resource="@drawable/ic_settings_esim" />
<meta-data android:name="com.android.settings.icon_tintable"
android:value="true" />
<meta-data android:name="com.android.settings.order"
android:value="-10" />
<meta-data android:name="com.android.settings.profile"
android:value="primary_profile_only" />
</activity>
<receiver
android:exported="true"
android:name=".BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
</intent-filter>
</receiver>
</application>
</manifest>

View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="org.lineageos.settings.esimswitcher">
<permission name="android.permission.SECURE_ELEMENT_PRIVILEGED_OPERATION"/>
</privapp-permissions>
</permissions>

View File

@@ -1,3 +0,0 @@
-keep class org.lineageos.settings.esimswitcher.* {
*;
}

View File

@@ -1,10 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M480,680L640,520L584,464L520,526L520,360L440,360L440,526L376,464L320,520L480,680ZM240,880Q207,880 183.5,856.5Q160,833 160,800L160,320L400,80L720,80Q753,80 776.5,103.5Q800,127 800,160L800,800Q800,833 776.5,856.5Q753,880 720,880L240,880ZM240,800L720,800Q720,800 720,800Q720,800 720,800L720,160Q720,160 720,160Q720,160 720,160L434,160L240,354L240,800Q240,800 240,800Q240,800 240,800ZM240,800Q240,800 240,800Q240,800 240,800L240,800L434,800L720,800Q720,800 720,800Q720,800 720,800L720,800Q720,800 720,800Q720,800 720,800L240,800Z"/>
</vector>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM ayarları</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Virtual SIM kart istifadə etmək üçün operator profilini endirib aktivləşdirin</string>
<string name="esim_toggle_dialog">eSIM-i fəallaşdırsanız, SIM 2 sıradan çıxarılacaq. Yenə də fəallaşdırılsın?</string>
<string name="esim_toggle_dialog_cancel">İmtina</string>
<string name="esim_toggle_dialog_ok">Fəallaşdır</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM настройки</string>
<string name="esim_toggle_title">Дигитален SIM (eSIM)</string>
<string name="esim_toggle_summary">Изтеглете и активирайте файл на оператор, за да използвате виртуална SIM карта</string>
<string name="esim_toggle_dialog">SIM 2 ще бъде спряна, ако включите eSIM. Включване въпреки това?</string>
<string name="esim_toggle_dialog_cancel">Отказ</string>
<string name="esim_toggle_dialog_ok">Включване</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Configuració eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Baixa i activa un perfil d\'operador per utilitzar una targeta SIM virtual</string>
<string name="esim_toggle_dialog">La SIM 2 es desactivarà si activeu l\'eSIM. Voleu habilitar-la igualment?</string>
<string name="esim_toggle_dialog_cancel">Cancel·la</string>
<string name="esim_toggle_dialog_ok">Habilita</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM settings</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Download and activate an operator profile to use a virtual SIM card</string>
<string name="esim_toggle_dialog">SIM 2 will be disabled if you enable eSIM. Enable it anyway?</string>
<string name="esim_toggle_dialog_cancel">Cancel</string>
<string name="esim_toggle_dialog_ok">Enable</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM settings</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Download and activate an operator profile to use a virtual SIM card</string>
<string name="esim_toggle_dialog">SIM 2 will be disabled if you enable eSIM. Enable it anyway?</string>
<string name="esim_toggle_dialog_cancel">Cancel</string>
<string name="esim_toggle_dialog_ok">Enable</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM settings</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Download and activate an operator profile to use a virtual SIM card</string>
<string name="esim_toggle_dialog">SIM 2 will be disabled if you enable eSIM. Enable it anyway?</string>
<string name="esim_toggle_dialog_cancel">Cancel</string>
<string name="esim_toggle_dialog_ok">Enable</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM settings</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Download and activate an operator profile to use a virtual SIM card</string>
<string name="esim_toggle_dialog">SIM 2 will be disabled if you enable eSIM. Enable it anyway?</string>
<string name="esim_toggle_dialog_cancel">Cancel</string>
<string name="esim_toggle_dialog_ok">Enable</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Configuración de eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Descarga y activa un perfil de operador para usar una tarjeta SIM virtual.</string>
<string name="esim_toggle_dialog">La SIM 2 se desactivará si activas la eSIM. ¿Quieres activarla de todas formas?</string>
<string name="esim_toggle_dialog_cancel">Cancelar</string>
<string name="esim_toggle_dialog_ok">Activar</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">تنظیمات سیم‌کارت مجازی</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">برای استفاده از سیم‌کارت مجازی، پیکربندی یک اپراتور را بارگیری و فعال کنید</string>
<string name="esim_toggle_dialog">اگر سیم مجازی را فعال کنید سیم‌کارت دوم شما غیرفعال خواهد شد. آیا ادامه می‌دهید؟</string>
<string name="esim_toggle_dialog_cancel">لغو</string>
<string name="esim_toggle_dialog_ok">فعال‌سازی</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Paramètres eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Télécharger et activer un profil d\'opérateur pour utiliser une carte SIM virtuelle</string>
<string name="esim_toggle_dialog">La carte SIM 2 sera désactivée si vous activez l\'eSIM. L\'activer quand même ?</string>
<string name="esim_toggle_dialog_cancel">Annuler</string>
<string name="esim_toggle_dialog_ok">Activer</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Socruithe eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Íoslódáil agus gníomhaigh próifíl oibreora chun cárta SIM fíorúil a úsáid</string>
<string name="esim_toggle_dialog">Díchumasófar SIM 2 má chumasóidh tú eSIM. Ar mhaith leat é a chumasú ar aon nós?</string>
<string name="esim_toggle_dialog_cancel">Cealaigh</string>
<string name="esim_toggle_dialog_ok">Cumasaigh</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM-beállítások</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">A virtuális SIM használatához töltse le és aktiválja a kapott profilt</string>
<string name="esim_toggle_dialog">A 2.SIM letiltásra kerül, ha engedélyezi az eSIM-et. Engedélyezi?</string>
<string name="esim_toggle_dialog_cancel">Mégsem</string>
<string name="esim_toggle_dialog_ok">Engedélyezés</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Impostazioni eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Scarica e attiva un profilo operatore per utilizzare una SIM virtuale</string>
<string name="esim_toggle_dialog">La SIM 2 sarà disabilitata se abiliti la eSIM. Abilitarla comunque?</string>
<string name="esim_toggle_dialog_cancel">Annulla</string>
<string name="esim_toggle_dialog_ok">Abilita</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">הגדרות eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">יש להוריד ולהפעיל את פרופיל ההפעלה כדי להשתמש בסים וירטואלי</string>
<string name="esim_toggle_dialog">סים 2 יושבת אם יופעל eSIM. להפעיל בכל זאת?</string>
<string name="esim_toggle_dialog_cancel">ביטול</string>
<string name="esim_toggle_dialog_ok">הפעלה</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM 設定</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">仮想 SIM カードを使用するには、オペレータプロファイルをダウンロードして有効化してください</string>
<string name="esim_toggle_dialog">eSIM を有効にすると SIM2 は無効になります。それでも有効にしますか?</string>
<string name="esim_toggle_dialog_cancel">キャンセル</string>
<string name="esim_toggle_dialog_ok">有効化</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">eSIM-პარამეტრები</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">ჩამოტვირთეთ და აამოქმედეთ მომწოდებლის პროფილი, რომ გამოიყენოთ წარმოსახვითი SIM-ბარათი</string>
<string name="esim_toggle_dialog">SIM 2 გაითიშება, თუ ჩაირთვება eSIM. მაინც გსურთ განაგრძოთ?</string>
<string name="esim_toggle_dialog_cancel">გაუქმება</string>
<string name="esim_toggle_dialog_ok">ჩართვა</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Ustawienia eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Pobierz i aktywuj profil operatora, aby używać wirtualnej karty SIM</string>
<string name="esim_toggle_dialog">Karta SIM 2 zostanie wyłączona, jeśli włączysz kartę eSIM. Włączyć ją mimo to?</string>
<string name="esim_toggle_dialog_cancel">Anuluj</string>
<string name="esim_toggle_dialog_ok">Włącz</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Configurações do eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Baixe e ative um perfil de operadora para usar um cartão SIM virtual</string>
<string name="esim_toggle_dialog">O SIM 2 será desativado se você ativar o eSIM. Ativar mesmo assim?</string>
<string name="esim_toggle_dialog_cancel">Cancelar</string>
<string name="esim_toggle_dialog_ok">Ativar</string>
</resources>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-FileCopyrightText: 2025 The LineageOS Project
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<string name="esim_settings_title">Definições do eSIM</string>
<string name="esim_toggle_title">eSIM</string>
<string name="esim_toggle_summary">Transferir e ativar um perfil de operador para usar um cartão SIM virtual</string>
<string name="esim_toggle_dialog">O SIM 2 será desativado se ativar o eSIM. Ativar mesmo assim?</string>
<string name="esim_toggle_dialog_cancel">Cancelar</string>
<string name="esim_toggle_dialog_ok">Ativar</string>
</resources>

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