OSDN Git Service

Check if user is unlocked when handler is executed
authorPhilip P. Moltmann <moltmann@google.com>
Fri, 29 Apr 2016 19:49:22 +0000 (12:49 -0700)
committerPhilip P. Moltmann <moltmann@google.com>
Mon, 2 May 2016 16:44:08 +0000 (09:44 -0700)
When the user gets unlocked we schedule a handler-runnable to do cleanup work.
This runnable might be executed after the user is already locked again.

Fixes: 28512952
Change-Id: I6c05cbc8adab699e451565d74d56ad0f9b965954

services/print/java/com/android/server/print/PrintManagerService.java

index f2c995b..1feb816 100644 (file)
@@ -836,6 +836,8 @@ public final class PrintManagerService extends SystemService {
             BackgroundThread.getHandler().post(new Runnable() {
                 @Override
                 public void run() {
+                    if (!mUserManager.isUserUnlockingOrUnlocked(userId)) return;
+
                     UserState userState;
                     synchronized (mLock) {
                         userState = getOrCreateUserStateLocked(userId, true);