shill: Use SuspendDone signal instead of PowerStateChanged.
PowerStateChanged will be removed from powerd soon; clients
should use SuspendImminent and SuspendDone instead.
Also simplify the interface exposed by PowerManager for
adding and removing suspend delays.
BUG=chromium:359619
TEST=updated tests
Change-Id: I7f96774570170591c2e5944245c368e165aaf972
Reviewed-on: https://chromium-review.googlesource.com/195690
Reviewed-by: Daniel Erat <derat@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
diff --git a/manager.h b/manager.h
index 2f969b1..4e5ba64 100644
--- a/manager.h
+++ b/manager.h
@@ -291,8 +291,6 @@
bool GetArpGateway() const { return props_.arp_gateway; }
const std::string &GetHostName() const { return props_.host_name; }
- int suspend_delay_id_for_testing() const { return suspend_delay_id_; }
-
virtual void UpdateEnabledTechnologies();
virtual void UpdateUninitializedTechnologies();
@@ -525,9 +523,14 @@
// Error::kSuccess. Otherwise, it is called with Error::kOperationTimeout.
void RunTerminationActions(const base::Callback<void(const Error &)> &done);
- void OnPowerStateChanged(PowerManagerProxyDelegate::SuspendState power_state);
+ // Called when the system is about to be suspended. Each call will be
+ // followed by a call to OnSuspendDone().
void OnSuspendImminent(int suspend_id);
+ // Called when the system has completed a suspend attempt (possibly without
+ // actually suspending, in the event of the user canceling the attempt).
+ void OnSuspendDone(int suspend_id);
+
void OnSuspendActionsComplete(int suspend_id, const Error &error);
void VerifyToEncryptLink(std::string public_key, std::string data,
ResultStringCallback cb, const Error &error,
@@ -613,10 +616,6 @@
// Is a suspend delay currently registered with the power manager?
bool suspend_delay_registered_;
- // If |suspend_delay_registered_| is true, contains the unique ID
- // corresponding to the suspend delay.
- int suspend_delay_id_;
-
// Maps tags to callbacks for monitoring default service changes.
std::map<int, ServiceCallback> default_service_callbacks_;
int default_service_callback_tag_;