shill: Keep registered suspend delay after termination action completes
shill previously registered a suspend delay with power manager only when
there was a termination action to perform before suspend. Upon the
completion of the termination action, shill unregistered the suspend
delay before reporting the suspend readiness to power manager. However,
without the suspend delay, the corresponding SuspendDone callback
wouldn't be invoked after the completion of the suspend attempt. If a
cellular device was disabled by the termination action, it wouldn't be
re-enabled by the SuspendDone callback.
This CL addresses the issue by keeping the registered suspend delay
after the termination action completes and only unregisters the suspend
delay when the power manager is destructed.
BUG=chromium:371585
TEST=Tested the following:
1. Build and run unit tests.
2. Test on a daisy_spring device with an ALT3100 modem:
a. Connect the modem to a cellular network. Make sure the cellular
service is set to auto-connect.
b. Run `powerd_dbus_suspend` under a root shell to suspend the device.
c. Press a key to wake up the device.
d. Verify that shill re-enables the modem and reconnects it to the
network.
e. Restart powerd and verify that shill reregisters the suspend
delay.
f. Repeat (a) to (d).
Change-Id: I6651523f77bbfd918f40a6cc7a3702a4f3e6d2ee
Reviewed-on: https://chromium-review.googlesource.com/199810
Reviewed-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
4 files changed