Skip to content

Commit 7450614

Browse files
author
Prashant Malani
committed
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 <pmalani@google.com>
1 parent 6ebeefa commit 7450614

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

services/core/java/com/android/server/DockObserver.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,6 @@ private void handleDockStateChange() {
201201
// There are many components in the system watching for this so as to
202202
// adjust audio routing, screen orientation, etc.
203203
getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);
204-
205-
// Release the wake lock that was acquired when the message was posted.
206-
mWakeLock.release();
207204
}
208205
}
209206

@@ -213,6 +210,7 @@ public void handleMessage(Message msg) {
213210
switch (msg.what) {
214211
case MSG_DOCK_STATE_CHANGED:
215212
handleDockStateChange();
213+
mWakeLock.release();
216214
break;
217215
}
218216
}

0 commit comments

Comments
 (0)