Merge "libpower: pass static-duration strong pointer as const reference."
diff --git a/power.cpp b/power.cpp
index 2e6d806..c4f2036 100644
--- a/power.cpp
+++ b/power.cpp
@@ -35,14 +35,14 @@
static std::mutex gLock;
static std::unordered_map<std::string, sp<IWakeLock>> gWakeLockMap;
-static sp<ISystemSuspend> getSystemSuspendServiceOnce() {
+static const sp<ISystemSuspend>& getSystemSuspendServiceOnce() {
static sp<ISystemSuspend> suspendService = ISystemSuspend::getService();
return suspendService;
}
int acquire_wake_lock(int, const char* id) {
ATRACE_CALL();
- sp<ISystemSuspend> suspendService = getSystemSuspendServiceOnce();
+ const auto& suspendService = getSystemSuspendServiceOnce();
if (!suspendService) {
return -1;
}