vold: use RAII wake locks
Prevents wake lock leaks, e.g. b/133175847
Bug: 133175847
Test: boot blueline
Change-Id: I62fd1c6c3abbfd35aebe11343abd717a7cf4eef7
diff --git a/Benchmark.cpp b/Benchmark.cpp
index b0a3b85..9548956 100644
--- a/Benchmark.cpp
+++ b/Benchmark.cpp
@@ -181,7 +181,7 @@
void Benchmark(const std::string& path,
const android::sp<android::os::IVoldTaskListener>& listener) {
std::lock_guard<std::mutex> lock(kBenchmarkLock);
- acquire_wake_lock(PARTIAL_WAKE_LOCK, kWakeLock);
+ android::power::WakeLock wl{kWakeLock};
PerformanceBoost boost;
android::os::PersistableBundle extras;
@@ -190,8 +190,6 @@
if (listener) {
listener->onFinished(res, extras);
}
-
- release_wake_lock(kWakeLock);
}
} // namespace vold