From 82cff68a3ad08c908a29174a523fecc3ad9be248 Mon Sep 17 00:00:00 2001 From: yangbingqian Date: Mon, 12 Jun 2017 22:45:50 +0800 Subject: [PATCH] remove the lock-use for prunePrintService in case blocking main thread 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 Change-Id: I709b491d611dbcbf21a5fd493b879ed290dd0247 Signed-off-by: yangbingqian --- services/print/java/com/android/server/print/UserState.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/services/print/java/com/android/server/print/UserState.java b/services/print/java/com/android/server/print/UserState.java index a91cdb38a15ad..d98d2c6b52bcb 100644 --- a/services/print/java/com/android/server/print/UserState.java +++ b/services/print/java/com/android/server/print/UserState.java @@ -154,10 +154,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(); } }