Loading services/print/java/com/android/server/print/RemotePrintSpooler.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,9 @@ import java.util.concurrent.TimeoutException; * spooler if needed, to make the timed remote calls, to handle * spooler if needed, to make the timed remote calls, to handle * remote exceptions, and to bind/unbind to the remote instance as * remote exceptions, and to bind/unbind to the remote instance as * needed. * needed. * * The calls might be blocking and need the main thread of to be unblocked to finish. Hence do not * call this while holding any monitors that might need to be acquired the main thread. */ */ final class RemotePrintSpooler { final class RemotePrintSpooler { Loading services/print/java/com/android/server/print/UserState.java +11 −7 Original line number Original line Diff line number Diff line Loading @@ -441,12 +441,12 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, } } public void createPrinterDiscoverySession(@NonNull IPrinterDiscoveryObserver observer) { public void createPrinterDiscoverySession(@NonNull IPrinterDiscoveryObserver observer) { mSpooler.clearCustomPrinterIconCache(); synchronized (mLock) { synchronized (mLock) { throwIfDestroyedLocked(); throwIfDestroyedLocked(); if (mPrinterDiscoverySession == null) { if (mPrinterDiscoverySession == null) { mSpooler.clearCustomPrinterIconCache(); // If we do not have a session, tell all service to create one. // If we do not have a session, tell all service to create one. mPrinterDiscoverySession = new PrinterDiscoverySessionMediator(mContext) { mPrinterDiscoverySession = new PrinterDiscoverySessionMediator(mContext) { @Override @Override Loading Loading @@ -738,6 +738,8 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, @Override @Override public void onCustomPrinterIconLoaded(PrinterId printerId, Icon icon) { public void onCustomPrinterIconLoaded(PrinterId printerId, Icon icon) { mSpooler.onCustomPrinterIconLoaded(printerId, icon); synchronized (mLock) { synchronized (mLock) { throwIfDestroyedLocked(); throwIfDestroyedLocked(); Loading @@ -745,7 +747,6 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, if (mPrinterDiscoverySession == null) { if (mPrinterDiscoverySession == null) { return; return; } } mSpooler.onCustomPrinterIconLoaded(printerId, icon); mPrinterDiscoverySession.onCustomPrinterIconLoadedLocked(printerId); mPrinterDiscoverySession.onCustomPrinterIconLoadedLocked(printerId); } } } } Loading Loading @@ -994,18 +995,21 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, * Prune persistent state if a print service was uninstalled * Prune persistent state if a print service was uninstalled */ */ public void prunePrintServices() { public void prunePrintServices() { ArrayList<ComponentName> installedComponents; synchronized (mLock) { synchronized (mLock) { ArrayList<ComponentName> installedComponents = getInstalledComponents(); installedComponents = getInstalledComponents(); // Remove unnecessary entries from persistent state "disabled services" // Remove unnecessary entries from persistent state "disabled services" boolean disabledServicesUninstalled = mDisabledServices.retainAll(installedComponents); boolean disabledServicesUninstalled = mDisabledServices.retainAll(installedComponents); if (disabledServicesUninstalled) { if (disabledServicesUninstalled) { writeDisabledPrintServicesLocked(mDisabledServices); writeDisabledPrintServicesLocked(mDisabledServices); } } } // Remove unnecessary entries from persistent state "approved services" // Remove unnecessary entries from persistent state "approved services" mSpooler.pruneApprovedPrintServices(installedComponents); mSpooler.pruneApprovedPrintServices(installedComponents); } } } private void onConfigurationChangedLocked() { private void onConfigurationChangedLocked() { Loading Loading
services/print/java/com/android/server/print/RemotePrintSpooler.java +3 −0 Original line number Original line Diff line number Diff line Loading @@ -57,6 +57,9 @@ import java.util.concurrent.TimeoutException; * spooler if needed, to make the timed remote calls, to handle * spooler if needed, to make the timed remote calls, to handle * remote exceptions, and to bind/unbind to the remote instance as * remote exceptions, and to bind/unbind to the remote instance as * needed. * needed. * * The calls might be blocking and need the main thread of to be unblocked to finish. Hence do not * call this while holding any monitors that might need to be acquired the main thread. */ */ final class RemotePrintSpooler { final class RemotePrintSpooler { Loading
services/print/java/com/android/server/print/UserState.java +11 −7 Original line number Original line Diff line number Diff line Loading @@ -441,12 +441,12 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, } } public void createPrinterDiscoverySession(@NonNull IPrinterDiscoveryObserver observer) { public void createPrinterDiscoverySession(@NonNull IPrinterDiscoveryObserver observer) { mSpooler.clearCustomPrinterIconCache(); synchronized (mLock) { synchronized (mLock) { throwIfDestroyedLocked(); throwIfDestroyedLocked(); if (mPrinterDiscoverySession == null) { if (mPrinterDiscoverySession == null) { mSpooler.clearCustomPrinterIconCache(); // If we do not have a session, tell all service to create one. // If we do not have a session, tell all service to create one. mPrinterDiscoverySession = new PrinterDiscoverySessionMediator(mContext) { mPrinterDiscoverySession = new PrinterDiscoverySessionMediator(mContext) { @Override @Override Loading Loading @@ -738,6 +738,8 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, @Override @Override public void onCustomPrinterIconLoaded(PrinterId printerId, Icon icon) { public void onCustomPrinterIconLoaded(PrinterId printerId, Icon icon) { mSpooler.onCustomPrinterIconLoaded(printerId, icon); synchronized (mLock) { synchronized (mLock) { throwIfDestroyedLocked(); throwIfDestroyedLocked(); Loading @@ -745,7 +747,6 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, if (mPrinterDiscoverySession == null) { if (mPrinterDiscoverySession == null) { return; return; } } mSpooler.onCustomPrinterIconLoaded(printerId, icon); mPrinterDiscoverySession.onCustomPrinterIconLoadedLocked(printerId); mPrinterDiscoverySession.onCustomPrinterIconLoadedLocked(printerId); } } } } Loading Loading @@ -994,18 +995,21 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks, * Prune persistent state if a print service was uninstalled * Prune persistent state if a print service was uninstalled */ */ public void prunePrintServices() { public void prunePrintServices() { ArrayList<ComponentName> installedComponents; synchronized (mLock) { synchronized (mLock) { ArrayList<ComponentName> installedComponents = getInstalledComponents(); installedComponents = getInstalledComponents(); // Remove unnecessary entries from persistent state "disabled services" // Remove unnecessary entries from persistent state "disabled services" boolean disabledServicesUninstalled = mDisabledServices.retainAll(installedComponents); boolean disabledServicesUninstalled = mDisabledServices.retainAll(installedComponents); if (disabledServicesUninstalled) { if (disabledServicesUninstalled) { writeDisabledPrintServicesLocked(mDisabledServices); writeDisabledPrintServicesLocked(mDisabledServices); } } } // Remove unnecessary entries from persistent state "approved services" // Remove unnecessary entries from persistent state "approved services" mSpooler.pruneApprovedPrintServices(installedComponents); mSpooler.pruneApprovedPrintServices(installedComponents); } } } private void onConfigurationChangedLocked() { private void onConfigurationChangedLocked() { Loading