Hi all,

I've reached another step in improving the suspend/wakelock behavior of
Replicant on the GTA04. The mainline implementation of wakelocks, which
is used in our kernel was already working in theory, but the Android
userspace was not able to acquire any locks, due to insufficient
permissions and process capabilities.

The solution was to change the permissions of the needed files in sysfs
(/sys/power/wake_[un]lock) [1] and to disable the process capabilities
check in the kernel [2]. The later is actually a workarround and the
process capabilities (i.e. CAP_BLOCK_SUSPEND) should be set correctly,
which I think is done in Android's libcore [3]. Our version of libcore
doesn't set CAP_BLOCK_SUSPEND, though. And as I don't want to fork
libcore, I disabled the capabilities check in the kernel. As soon as we
have a userspace, which sets correct capabilities, we can remove this
workaround.

With this commits in place, the device now stays powered on if a
wakelock is held (e.g. if music is playing in the background). You can
see the current (kernel-) wakelocks with this command:
  cat /sys/power/wake_lock

Usually "PowerManagerService" is listed in there, which is the service
handling all the userspace/partial wakelocks. Those partial wakelocks
can be explored further with this command:
  dumpsys power

Regards,
  Lukas

[1]
http://git.goldelico.com/?p=gta04-replicant-device.git;a=commit;h=db1e834950f79c36230d9ede712b7d8eedc06ab8
[2]
http://git.goldelico.com/?p=gta04-kernel.git;a=commit;h=fa166e47ad34a583f730b34f38d7d25eb5f2864c
[3]
https://github.com/SuperNexus/android_libcore/commit/64f3de64a5adb86a605a7f055349798fcae6b1f4

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Replicant mailing list
[email protected]
http://lists.osuosl.org/mailman/listinfo/replicant

Reply via email to