OSDN Git Service

Implement exponential backoff analogous to libsuspend
authorTri Vo <trong@google.com>
Thu, 20 Sep 2018 23:07:23 +0000 (16:07 -0700)
committerTri Vo <trong@google.com>
Wed, 26 Sep 2018 23:16:16 +0000 (16:16 -0700)
commit5d524a1d619fe61db253bf6d37f2498661dc72c5
treecc07e2b39599b3147af0ba6110a8967e6f4540ff
parent365b75f1572ae951054564afbf1f028691ac19e5
Implement exponential backoff analogous to libsuspend

Suspends attempts are not free w.r.t. power consumption. This change prevents
rapid battery drain on devices with broken system suspend (e.g. due to faulty
driver)

Originally implemented in libususpend in commit
fb896944b6a78d951c8442b444af860a28117e5c

Bug: 78888165
Test: SystemSuspendV1_0UnitTest
Test: left device overnight, ~50% fewer failed attempts to suspend with this
change vs without.
Change-Id: Icff1135b9c316fa9de1558ecea42db9ed0d10d9a
suspend/1.0/default/SystemSuspend.cpp
suspend/1.0/default/SystemSuspend.h
suspend/1.0/default/SystemSuspendUnitTest.cpp
suspend/1.0/default/main.cpp