From 7450614a496d0b6a5836703c1145e9bcd4f104e9 Mon Sep 17 00:00:00 2001 From: Prashant Malani Date: Wed, 6 Aug 2014 16:49:53 -0700 Subject: [PATCH] Move wakelock release to handleMessage There were certain code paths in handleDockStateChange() that were exiting without releasing the wakelock. So we move the release to the calling function to prevent stray held wakelocks. Bug: 16841895 Change-Id: I8ae4d2ab8f775c42a893d3bcdef34321c5f631a6 Signed-off-by: Prashant Malani --- services/core/java/com/android/server/DockObserver.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/DockObserver.java b/services/core/java/com/android/server/DockObserver.java index af38664080ec6..d05c280093fbf 100644 --- a/services/core/java/com/android/server/DockObserver.java +++ b/services/core/java/com/android/server/DockObserver.java @@ -201,9 +201,6 @@ final class DockObserver extends SystemService { // There are many components in the system watching for this so as to // adjust audio routing, screen orientation, etc. getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL); - - // Release the wake lock that was acquired when the message was posted. - mWakeLock.release(); } } @@ -213,6 +210,7 @@ final class DockObserver extends SystemService { switch (msg.what) { case MSG_DOCK_STATE_CHANGED: handleDockStateChange(); + mWakeLock.release(); break; } }