From 2c7efc70d710040bf21b81abe18f663d823eb966 Mon Sep 17 00:00:00 2001 From: Michael Sun Date: Tue, 24 Nov 2020 06:50:51 +0000 Subject: [PATCH] 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 --- services/core/jni/com_android_server_am_BatteryStatsService.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/jni/com_android_server_am_BatteryStatsService.cpp b/services/core/jni/com_android_server_am_BatteryStatsService.cpp index 0e68f5b89a914..00342866aa301 100644 --- a/services/core/jni/com_android_server_am_BatteryStatsService.cpp +++ b/services/core/jni/com_android_server_am_BatteryStatsService.cpp @@ -124,7 +124,7 @@ public: { std::unique_lock reasonsLock(mReasonsMutex, std::defer_lock); if (reasonsLock.try_lock() && mWakeupReasons.empty()) { - mWakeupReasons = std::move(wakeupReasons); + mWakeupReasons = wakeupReasons; reasonsCaptured = true; } }