vold: use RAII wake locks
Prevents wake lock leaks, e.g. b/133175847
Bug: 133175847
Test: boot blueline
Change-Id: I62fd1c6c3abbfd35aebe11343abd717a7cf4eef7
diff --git a/MoveStorage.cpp b/MoveStorage.cpp
index 79a47ae..9b806ec 100644
--- a/MoveStorage.cpp
+++ b/MoveStorage.cpp
@@ -258,15 +258,13 @@
void MoveStorage(const std::shared_ptr<VolumeBase>& from, const std::shared_ptr<VolumeBase>& to,
const android::sp<android::os::IVoldTaskListener>& listener) {
- acquire_wake_lock(PARTIAL_WAKE_LOCK, kWakeLock);
+ android::power::WakeLock wl{kWakeLock};
android::os::PersistableBundle extras;
status_t res = moveStorageInternal(from, to, listener);
if (listener) {
listener->onFinished(res, extras);
}
-
- release_wake_lock(kWakeLock);
}
} // namespace vold