From c9a9d279efbaa55f2ba51576bfd9ad587c5fef17 Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Mon, 8 Apr 2019 13:29:07 -0700 Subject: [PATCH] charger: Allow to rw /sys/power/[state,wakeup_count] charger needs to suspend the device when the power goes away when it doesn't have root. These two files are marked with group system, user system, mode 0600 in 'on boot', but it is not executed in charger. Hence, move these actions to 'on init'. Test: no failure in libsuspend in charger Bug: 129138950 Change-Id: I787b935b4ff6177601329aeedccdac361b119ca3 --- rootdir/init.rc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rootdir/init.rc b/rootdir/init.rc index 75035d09c..b274cf30e 100644 --- a/rootdir/init.rc +++ b/rootdir/init.rc @@ -280,6 +280,11 @@ on init write /dev/cpu_variant:${ro.bionic.2nd_arch} ${ro.bionic.2nd_cpu_variant} chmod 0444 /dev/cpu_variant:${ro.bionic.2nd_arch} + # Allow system processes to read / write power state. + chown system system /sys/power/state + chown system system /sys/power/wakeup_count + chmod 0660 /sys/power/state + # Start logd before any other services run to ensure we capture all of their logs. start logd @@ -671,11 +676,8 @@ on boot chown radio system /sys/android_power/acquire_partial_wake_lock chown radio system /sys/android_power/release_wake_lock chown system system /sys/power/autosleep - chown system system /sys/power/state - chown system system /sys/power/wakeup_count chown radio wakelock /sys/power/wake_lock chown radio wakelock /sys/power/wake_unlock - chmod 0660 /sys/power/state chmod 0660 /sys/power/wake_lock chmod 0660 /sys/power/wake_unlock