diff options
-rw-r--r-- | daemon/power_manager.cc | 3 | ||||
-rw-r--r-- | daemon/power_manager_unittest.cc | 6 | ||||
-rw-r--r-- | example/power_example.cc | 5 | ||||
-rw-r--r-- | include/nativepower/power_manager_client.h | 7 | ||||
-rw-r--r-- | include/nativepower/power_manager_stub.h | 4 |
5 files changed, 12 insertions, 13 deletions
diff --git a/daemon/power_manager.cc b/daemon/power_manager.cc index 0498965..2f961b7 100644 --- a/daemon/power_manager.cc +++ b/daemon/power_manager.cc @@ -117,8 +117,7 @@ status_t PowerManager::goToSleep(int64_t event_time_ms, int reason, int flags) { return UNKNOWN_ERROR; } - last_resume_uptime_ = - base::TimeDelta::FromMilliseconds(base::SysInfo::Uptime()); + last_resume_uptime_ = base::SysInfo::Uptime(); LOG(INFO) << "Resumed from suspend at " << last_resume_uptime_.InMilliseconds(); return OK; diff --git a/daemon/power_manager_unittest.cc b/daemon/power_manager_unittest.cc index a81f935..c221ace 100644 --- a/daemon/power_manager_unittest.cc +++ b/daemon/power_manager_unittest.cc @@ -120,7 +120,7 @@ TEST_F(PowerManagerTest, AcquireAndReleaseWakeLock) { TEST_F(PowerManagerTest, GoToSleep) { EXPECT_EQ("", ReadPowerState()); - const int kStartTime = base::SysInfo::Uptime(); + const int64_t kStartTime = base::SysInfo::Uptime().InMilliseconds(); EXPECT_EQ(OK, interface_->goToSleep(kStartTime, 0 /* reason */, 0 /* flags */)); EXPECT_EQ(PowerManager::kPowerStateSuspend, ReadPowerState()); @@ -133,7 +133,9 @@ TEST_F(PowerManagerTest, GoToSleep) { // A second attempt with a timestamp occurring after the last // resume should be honored. ClearPowerState(); - EXPECT_EQ(OK, interface_->goToSleep(base::SysInfo::Uptime(), 0, 0)); + EXPECT_EQ( + OK, + interface_->goToSleep(base::SysInfo::Uptime().InMilliseconds(), 0, 0)); EXPECT_EQ(PowerManager::kPowerStateSuspend, ReadPowerState()); } diff --git a/example/power_example.cc b/example/power_example.cc index efe27a5..494c052 100644 --- a/example/power_example.cc +++ b/example/power_example.cc @@ -57,9 +57,8 @@ int main(int argc, char *argv[]) { CHECK(client.ShutDown(android::ShutdownReason::DEFAULT)); } else if (FLAGS_action == "suspend") { LOG(INFO) << "Requesting suspend"; - CHECK(client.Suspend( - base::TimeDelta::FromMilliseconds(base::SysInfo::Uptime()), - android::SuspendReason::APPLICATION, 0 /* flags */)); + CHECK(client.Suspend(base::SysInfo::Uptime(), + android::SuspendReason::APPLICATION, 0 /* flags */)); } else if (FLAGS_action == "wake_lock") { LOG(INFO) << "Creating wake lock"; std::unique_ptr<android::WakeLock> lock( diff --git a/include/nativepower/power_manager_client.h b/include/nativepower/power_manager_client.h index 2b683da..e8528b4 100644 --- a/include/nativepower/power_manager_client.h +++ b/include/nativepower/power_manager_client.h @@ -79,10 +79,9 @@ class PowerManagerClient { // Suspends the system immediately, returning true on success. // // |event_uptime| contains the time since the system was booted (e.g. - // base::TimeDelta::FromMilliseconds(base::SysInfo::Uptime())) of the event - // that triggered the suspend request. It is used to avoid acting on stale - // suspend requests that are sent before the currently-active suspend request - // completes. + // base::SysInfo::Uptime()) of the event that triggered the suspend request. + // It is used to avoid acting on stale suspend requests that are sent before + // the currently-active suspend request completes. // |reason| is currently only used by android.view.WindowManagerPolicy. // |flags| is a bitfield of SuspendFlag values. bool Suspend(base::TimeDelta event_uptime, SuspendReason reason, int flags); diff --git a/include/nativepower/power_manager_stub.h b/include/nativepower/power_manager_stub.h index 47ae1dd..572a403 100644 --- a/include/nativepower/power_manager_stub.h +++ b/include/nativepower/power_manager_stub.h @@ -94,9 +94,9 @@ class PowerManagerStub : public BnPowerManager { private: // Details about a request passed to goToSleep(). struct SuspendRequest { - SuspendRequest(int64 uptime_ms, int reason, int flags); + SuspendRequest(int64_t uptime_ms, int reason, int flags); - int64 event_time_ms; + int64_t event_time_ms; int reason; int flags; }; |