OSDN Git Service

remove the lock-use for prunePrintService in case blocking main thread
authoryangbingqian <yangbingqian@xiaomi.com>
Mon, 12 Jun 2017 14:45:50 +0000 (22:45 +0800)
committerPhilip P. Moltmann <moltmann@google.com>
Mon, 19 Jun 2017 22:59:00 +0000 (22:59 +0000)
As in the change: I4f4cdaba65132dc2ef054877cbb097b499a723f6
the lock object is removed when calling RemotePrintSpooler
and so as it in the method prunePrintService(). But in the
constructor of UserState, the mLock is still held when calling
prunePrintService(), it may also block the main thread

It is better to take it out of the synchronized block

Test: null
Fixes: 37481484

Change-Id: I21fe5380d5c6302f70e04eee7dac0050886ed4f0
Merged-In: I709b491d611dbcbf21a5fd493b879ed290dd0247
Signed-off-by: yangbingqian <yangbingqian@xiaomi.com>
services/print/java/com/android/server/print/UserState.java

index 75df892..5770c50 100644 (file)
@@ -159,10 +159,12 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks,
             readInstalledPrintServicesLocked();
             upgradePersistentStateIfNeeded();
             readDisabledPrintServicesLocked();
+        }
 
-            // Some print services might have gotten installed before the User State came up
-            prunePrintServices();
+        // Some print services might have gotten installed before the User State came up
+        prunePrintServices();
 
+        synchronized (mLock) {
             onConfigurationChangedLocked();
         }
     }