summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2021-05-31 16:16:21 +0530
committerAmit Pundir <amit.pundir@linaro.org>2021-06-01 13:39:17 +0530
commitd3525fb544b4af4a40b4238a04c9d41c7223f0f1 (patch)
tree40224ee9520348a4d96ae9c26add12da10c698f3
parent513c5980413ee96c6e18d827ea01301428ce2365 (diff)
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. Signed-off-by: Amit Pundir <amit.pundir@linaro.org> Change-Id: I547f1f635fc0779a58906a147b6cd821c531f4bb
-rw-r--r--device-common.mk4
-rw-r--r--init.common.rc6
-rw-r--r--sepolicy/file_contexts1
-rw-r--r--sepolicy/suspend_blocker.te6
4 files changed, 17 insertions, 0 deletions
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);