summaryrefslogtreecommitdiff
path: root/rootdir
diff options
context:
space:
mode:
authorTom Marshall <tdm.code@gmail.com>2020-11-10 14:58:00 -0800
committerBruno Martins <bgcngm@gmail.com>2020-11-17 14:07:00 +0000
commitd53d8034e68e6553783985349cce1324eb51d897 (patch)
treef90a7c016d83863800e245bc772d18259b4f80e9 /rootdir
parent0e3e49cd5e24aeb6e784303e4f5404c3388fb3db (diff)
pro1: Fix keyboard layout setting
As per Treble rules, platform must not have access to /mnt/vendor. Just handle keyboard layout setting in a vendor init script. The script uses a property trigger for "sys.keyboard.layout" to update the saved keyboard layout in the persist partition and notify the kernel of the desired layout. The DeviceSettings app reads the layout from the kernel sysfs file and updates the property "sys.keyboard.layout" on change. Note the keyboard layout file moved only to avoid ending up with an undesired SElinux context (files under /mnt/vendor/persist/data are labeled by QCOM as persist_drm_file). The init script also handles migration. Additionally, make use of XML attribute to set the preference summary directly. As a bonus, it now shows in uppercase. Change-Id: Ie639f73ddb9a50e0b883601e8eb03a1895e54cdc
Diffstat (limited to 'rootdir')
-rw-r--r--rootdir/etc/init.keyboard.rc14
1 files changed, 14 insertions, 0 deletions
diff --git a/rootdir/etc/init.keyboard.rc b/rootdir/etc/init.keyboard.rc
new file mode 100644
index 0000000..cdfca25
--- /dev/null
+++ b/rootdir/etc/init.keyboard.rc
@@ -0,0 +1,14 @@
+on boot
+ mkdir /mnt/vendor/persist/keyboard
+
+ # Take care of layout file migration
+ copy /mnt/vendor/persist/data/keyboard/layout /mnt/vendor/persist/keyboard/layout
+ rm /mnt/vendor/persist/data/keyboard/layout
+ rmdir /mnt/vendor/persist/data/keyboard
+
+ # Restore user setting
+ copy /mnt/vendor/persist/keyboard/layout /sys/devices/soc/c17a000.i2c/i2c-6/6-0058/layout
+
+on property:sys.keyboard.layout=*
+ write /mnt/vendor/persist/keyboard/layout ${sys.keyboard.layout}
+ write /sys/devices/soc/c17a000.i2c/i2c-6/6-0058/layout ${sys.keyboard.layout}