From a749875aa01442ca2ba7ceb792e1cf8dfcf95b88 Mon Sep 17 00:00:00 2001 From: Steve Pfetsch Date: Sun, 6 Aug 2017 14:55:13 -0700 Subject: [PATCH] sepolicy: Allow adb shell access to ftm4 autotune sysfs node Bug: 63911898 Change-Id: Id39f48709253ce96ae7910f4e3157e2c2eda558a --- BoardConfig.mk | 3 +++ init-taimen.rc | 4 ++++ sepolicy/file.te | 1 + sepolicy/genfs_contexts | 3 +++ sepolicy/shell.te | 3 +++ 5 files changed, 14 insertions(+) create mode 100644 sepolicy/file.te create mode 100644 sepolicy/genfs_contexts create mode 100644 sepolicy/shell.te diff --git a/BoardConfig.mk b/BoardConfig.mk index b52fa40..74fdbef 100644 --- a/BoardConfig.mk +++ b/BoardConfig.mk @@ -24,6 +24,9 @@ include device/google/wahoo/BoardConfig.mk BOARD_BOOTIMAGE_PARTITION_SIZE := 41943040 BOARD_AVB_ENABLE := true +# sepolicy +BOARD_SEPOLICY_DIRS += device/google/taimen/sepolicy + ifeq (,$(filter-out taimen_clang, $(TARGET_PRODUCT))) # if TARGET_PRODUCT == taimen_clang BOARD_VENDOR_KERNEL_MODULES += \ diff --git a/init-taimen.rc b/init-taimen.rc index 13ae83e..75b4cdf 100644 --- a/init-taimen.rc +++ b/init-taimen.rc @@ -24,6 +24,10 @@ on property:sys.boot_completed=1 write /sys/block/dm-0/queue/read_ahead_kb 512 write /sys/block/dm-1/queue/read_ahead_kb 512 +on boot + # Allow ftm4 autotune from adb shell + chown system shell /sys/devices/virtual/input/ftm4_touch/autotune + on init && property:ro.boot.slot=* # will remove this once slot_suffix is deprecated setprop ro.boot.slot_suffix _${ro.boot.slot} diff --git a/sepolicy/file.te b/sepolicy/file.te new file mode 100644 index 0000000..e8a3105 --- /dev/null +++ b/sepolicy/file.te @@ -0,0 +1 @@ +type sysfs_touch_shell, sysfs_type, fs_type; diff --git a/sepolicy/genfs_contexts b/sepolicy/genfs_contexts new file mode 100644 index 0000000..a46e110 --- /dev/null +++ b/sepolicy/genfs_contexts @@ -0,0 +1,3 @@ +# ftm4 touch +genfscon sysfs /devices/virtual/input/ftm4_touch u:object_r:sysfs_touch:s0 +genfscon sysfs /devices/virtual/input/ftm4_touch/autotune u:object_r:sysfs_touch_shell:s0 diff --git a/sepolicy/shell.te b/sepolicy/shell.te new file mode 100644 index 0000000..9475f08 --- /dev/null +++ b/sepolicy/shell.te @@ -0,0 +1,3 @@ +# allow adb to access /sys/devices/virtual/input/ftm4_touch/autotune +allow shell sysfs_touch:dir search; +allow shell sysfs_touch_shell:file rw_file_perms;