shill: Simplify suspend delay handling.
shill::PowerManager currently supports multiple suspend delays at the cost of
added complexity. This CL simplifies this code by
- Supporting only one suspend delay registered at the |Start|.
- Hiding information about |suspend_id| from the rest of shill, because it is
safe to ignore |suspend_id| in our interaction with powerd: powerd ignores
messages sent to it with incorrect suspend_id's.
BUG=chromium:373348
TEST=(1) shill unittests.
(2) Manually tested a suspend-resume cycle for shill with and without a
cellular device.
(3) Ran power_SuspendStress.bare and power_SuspendStress.idle.
Change-Id: I2da6be38e6ad0de91d38101e4e28eb4e46b578c0
Reviewed-on: https://chromium-review.googlesource.com/213740
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Commit-Queue: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/manager.h b/manager.h
index 8898c16..c115ab2 100644
--- a/manager.h
+++ b/manager.h
@@ -427,6 +427,7 @@
FRIEND_TEST(CellularTest, LinkEventWontDestroyService);
FRIEND_TEST(ManagerTest, AvailableTechnologies);
FRIEND_TEST(ManagerTest, ConnectedTechnologies);
+ FRIEND_TEST(ManagerTest, ConnectionStatusCheck);
FRIEND_TEST(ManagerTest, ConnectToBestServices);
FRIEND_TEST(ManagerTest, DefaultTechnology);
FRIEND_TEST(ManagerTest, DeviceRegistrationAndStart);
@@ -437,25 +438,26 @@
FRIEND_TEST(ManagerTest, InitializeProfilesInformsProviders);
FRIEND_TEST(ManagerTest, InitializeProfilesHandlesDefaults);
FRIEND_TEST(ManagerTest, IsDefaultProfile);
+ FRIEND_TEST(ManagerTest, IsWifiIdle);
FRIEND_TEST(ManagerTest, LinkMonitorEnabled);
+ FRIEND_TEST(ManagerTest, MoveService);
FRIEND_TEST(ManagerTest, NotifyDefaultServiceChanged);
FRIEND_TEST(ManagerTest, PopProfileWithUnload);
+ FRIEND_TEST(ManagerTest, RegisterKnownService);
+ FRIEND_TEST(ManagerTest, RegisterUnknownService);
FRIEND_TEST(ManagerTest, RunTerminationActions);
+ FRIEND_TEST(ManagerTest, ServiceRegistration);
FRIEND_TEST(ManagerTest, SortServices);
FRIEND_TEST(ManagerTest, SortServicesWithConnection);
FRIEND_TEST(ManagerTest, StartupPortalList);
- FRIEND_TEST(ManagerTest, IsWifiIdle);
- FRIEND_TEST(ManagerTest, ConnectionStatusCheck);
static const char kErrorNoDevice[];
static const char kErrorTypeRequired[];
static const char kErrorUnsupportedServiceType[];
// Time to wait for termination actions to complete.
- static const int kTerminationActionsTimeoutMilliseconds;
-
- static const char kPowerManagerKey[];
static const int kConnectionStatusCheckIntervalMilliseconds;
+ static const int kTerminationActionsTimeoutMilliseconds;
void AutoConnect();
std::vector<std::string> AvailableTechnologies(Error *error);
@@ -548,13 +550,13 @@
// Called when the system is about to be suspended. Each call will be
// followed by a call to OnSuspendDone().
- void OnSuspendImminent(int suspend_id);
+ void OnSuspendImminent();
// 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 OnSuspendDone();
- void OnSuspendActionsComplete(int suspend_id, const Error &error);
+ void OnSuspendActionsComplete(const Error &error);
void VerifyToEncryptLink(std::string public_key, std::string data,
ResultStringCallback cb, const Error &error,
bool success);
@@ -563,8 +565,6 @@
// or connected).
bool IsWifiIdle();
- void InitializePowerManagement();
-
// For unit testing.
void set_metrics(Metrics *metrics) { metrics_ = metrics; }
void UpdateProviderMapping();