BatteryStats: explicitly copy the wakeup reasons

As the wakeup reasons received from binder callback are in const
reference, std::move the parameter will result in a copy operation in
order to fulfill the const restriction. Update to reflect this
explicitly.

Test: adb shell dumpsys batterystats --history
Bug: 173165219
Change-Id: I6ab995cc11600b37123651bacc2015a3bf1a4bf6
This commit is contained in:
Michael Sun
2020-11-24 06:50:51 +00:00
parent e9226f999f
commit 2c7efc70d7

View File

@@ -124,7 +124,7 @@ public:
{
std::unique_lock<std::mutex> reasonsLock(mReasonsMutex, std::defer_lock);
if (reasonsLock.try_lock() && mWakeupReasons.empty()) {
mWakeupReasons = std::move(wakeupReasons);
mWakeupReasons = wakeupReasons;
reasonsCaptured = true;
}
}