Comment 3 for bug 1323286

Revision history for this message
Seth Forshee (sforshee) wrote :

Okay, it looks like Android does it this way:

 1) Open /sys/power/state and write "on". If this doesn't return an error, use early suspend.
 2) Else open /sys/power/autosleep. If this is successful, use autosleep.
 3) Else attempt to use the legacy PM interfaces (I won't go into detail).
 4) Else fail

So I guess powerd should do similar to be compatible. It's still nonsensical to have an autosleep file which doesn't work, but I guess the reality is that this works okay with Android.

References:

https://android.googlesource.com/platform/system/core/+/android-4.4.2_r2/libsuspend/autosuspend.c
https://android.googlesource.com/platform/system/core/+/android-4.4.2_r2/libsuspend/autosuspend_earlysuspend.c
https://android.googlesource.com/platform/system/core/+/android-4.4.2_r2/libsuspend/autosuspend_autosleep.c
https://android.googlesource.com/platform/system/core/+/android-4.4.2_r2/libsuspend/autosuspend_wakeup_count.c