From 1390a9023b79f3fc4196f17ac034d043d1638044 Mon Sep 17 00:00:00 2001 From: Amit Pundir Date: Mon, 31 May 2021 16:16:21 +0530 Subject: suspend_blocker: Use Cuttlefish's workaround to avoid suspending the device Reuse Cuttlefish's suspend blocker service to avoid suspending the device while running CTS tests. Bug: 191876756 Signed-off-by: Amit Pundir Change-Id: I547f1f635fc0779a58906a147b6cd821c531f4bb --- device-common.mk | 4 ++++ init.common.rc | 6 ++++++ sepolicy/file_contexts | 1 + sepolicy/suspend_blocker.te | 6 ++++++ 4 files changed, 17 insertions(+) create mode 100644 sepolicy/suspend_blocker.te diff --git a/device-common.mk b/device-common.mk index 4beaf6e..18281e9 100644 --- a/device-common.mk +++ b/device-common.mk @@ -164,6 +164,10 @@ PRODUCT_PACKAGES += \ android.hardware.health@2.1-impl-cuttlefish \ android.hardware.health@2.1-service +# TODO: disable this service once we implement system suspend +PRODUCT_PACKAGES += \ + suspend_blocker + # mkbootimg host tool to build boot.img separately PRODUCT_HOST_PACKAGES := \ mkbootimg diff --git a/init.common.rc b/init.common.rc index 247a161..483b42f 100644 --- a/init.common.rc +++ b/init.common.rc @@ -61,3 +61,9 @@ service wpa_supplicant /vendor/bin/hw/wpa_supplicant \ class main disabled oneshot + +# TODO: disable this service once we implement system suspend +service suspend_blocker /vendor/bin/suspend_blocker + class early_hal # Start together with system_suspend HAL + group system + user root diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index e36d1b2..41b9b28 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -36,6 +36,7 @@ /vendor/bin/qrtr-ns u:object_r:qrtr_exec:s0 /vendor/bin/rmtfs u:object_r:rmtfs_exec:s0 /vendor/bin/tqftpserv u:object_r:tqftpserv_exec:s0 +/vendor/bin/suspend_blocker u:object_r:suspend_blocker_exec:s0 /vendor/lib(64)?/dri/.* u:object_r:same_process_hal_file:s0 /vendor/lib(64)?/hw/gralloc\.gbm\.so u:object_r:same_process_hal_file:s0 diff --git a/sepolicy/suspend_blocker.te b/sepolicy/suspend_blocker.te new file mode 100644 index 0000000..fa6e02a --- /dev/null +++ b/sepolicy/suspend_blocker.te @@ -0,0 +1,6 @@ +type suspend_blocker, domain; +type suspend_blocker_exec, exec_type, vendor_file_type, file_type; + +init_daemon_domain(suspend_blocker); + +wakelock_use(suspend_blocker); -- cgit v1.2.3 From 2c0466ac93089c16279c465b812c0f9d46be7afa Mon Sep 17 00:00:00 2001 From: Amit Pundir Date: Mon, 31 May 2021 16:18:27 +0530 Subject: sepolicy: Rename rtc to wakeup label and add other missing sysfs_wakeup labels This will fix system_suspend wakeup{1-7} denials. Bug: 191876756 Signed-off-by: Amit Pundir Change-Id: Ia340274277f7e5f4a5f5fa84cbddeb78b91693be --- sepolicy/file_contexts | 9 ++++++++- sepolicy/genfs_contexts | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/sepolicy/file_contexts b/sepolicy/file_contexts index 41b9b28..6f3906d 100644 --- a/sepolicy/file_contexts +++ b/sepolicy/file_contexts @@ -17,7 +17,14 @@ /sys/devices/platform/soc@0/4080000.remoteproc u:object_r:sysfs_remoteproc:s0 /sys/devices/platform/soc@0/ae00000.mdss u:object_r:sysfs_gpu:s0 -/sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000/rtc u:object_r:sysfs_rtc:s0 + +/sys/devices/platform/soc@0/1c00000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/wakeup/wakeup1 u:object_r:sysfs_wakeup:s0 +/sys/devices/platform/soc@0/a6f8800.usb/wakeup/wakeup2 u:object_r:sysfs_wakeup:s0 +/sys/devices/platform/soc@0/a8f8800.usb/wakeup/wakeup3 u:object_r:sysfs_wakeup:s0 +/sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:pon@800/c440000.spmi:pmic@0:pon@800:pwrkey/wakeup/wakeup4 u:object_r:sysfs_wakeup:s0 +/sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:pon@800/c440000.spmi:pmic@0:pon@800:resin/wakeup/wakeup5 u:object_r:sysfs_wakeup:s0 +/sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000/wakeup/wakeup6 u:object_r:sysfs_wakeup:s0 +/sys/devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000/rtc/rtc0/alarmtimer.2.auto/wakeup/wakeup7 u:object_r:sysfs_wakeup:s0 /sys/class/remoteproc u:object_r:sysfs_remoteproc:s0 /sys/devices/platform/remoteproc-adsp/remoteproc u:object_r:sysfs_remoteproc:s0 diff --git a/sepolicy/genfs_contexts b/sepolicy/genfs_contexts index ee8b953..a0999b0 100644 --- a/sepolicy/genfs_contexts +++ b/sepolicy/genfs_contexts @@ -3,4 +3,10 @@ genfscon sysfs /devices/platform/remoteproc-adsp/remoteproc u:object_r:sys genfscon sysfs /devices/platform/remoteproc-cdsp/remoteproc u:object_r:sysfs_remoteproc:s0 genfscon sysfs /devices/platform/soc@0/4080000.remoteproc u:object_r:sysfs_remoteproc:s0 genfscon sysfs /devices/platform/soc@0/ae00000.mdss u:object_r:sysfs_gpu:s0 -genfscon sysfs /devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000 u:object_r:sysfs_rtc:s0 +genfscon sysfs /devices/platform/soc@0/1c00000.pci/pci0000:00/0000:00:00.0/0000:01:00.0/wakeup/wakeup1 u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc@0/a6f8800.usb/wakeup/wakeup2 u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc@0/a8f8800.usb/wakeup/wakeup3 u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:pon@800/c440000.spmi:pmic@0:pon@800:pwrkey/wakeup/wakeup4 u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:pon@800/c440000.spmi:pmic@0:pon@800:resin/wakeup/wakeup5 u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000/wakeup/wakeup6 u:object_r:sysfs_wakeup:s0 +genfscon sysfs /devices/platform/soc@0/c440000.spmi/spmi-0/0-00/c440000.spmi:pmic@0:rtc@6000/rtc/rtc0/alarmtimer.2.auto/wakeup/wakeup7 u:object_r:sysfs_wakeup:s0 -- cgit v1.2.3