From e2b95e4c5689d55e078076d4cc030c1609429bfb Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Fri, 20 Nov 2015 11:53:12 -0800 Subject: [PATCH 1/2] Update printer availability when printSpooler is paused. This makes the window update syncronously when in multi-window mode. Change-Id: If802f32a011b24ec8cca9292eb12bbb399548a40 --- .../com/android/printspooler/ui/PrintActivity.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java index e7588359478a9..f38cffdf8200b 100644 --- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java +++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java @@ -336,8 +336,8 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat } @Override - public void onResume() { - super.onResume(); + public void onStart() { + super.onStart(); if (mState != STATE_INITIALIZING && mCurrentPrinter != null) { mPrinterRegistry.setTrackedPrinter(mCurrentPrinter.getId()); } @@ -379,10 +379,15 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat } } + super.onPause(); + } + + @Override + protected void onStop() { mPrinterAvailabilityDetector.cancel(); mPrinterRegistry.setTrackedPrinter(null); - super.onPause(); + super.onStop(); } @Override From e3ce0a4051fd212157a059d5c503ea7a2e127cf2 Mon Sep 17 00:00:00 2001 From: "Philip P. Moltmann" Date: Fri, 20 Nov 2015 13:38:10 -0800 Subject: [PATCH 2/2] Create PrintDiscoverySession for future print services If we currently don't have any print services we still want to register a print observer so that when in the future a new service comes along we can connect this service to the observer. Bug: 25666802 Change-Id: I0cc28e92e0000fc9b5372733390095f3a8b19bc9 --- services/print/java/com/android/server/print/UserState.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/print/java/com/android/server/print/UserState.java b/services/print/java/com/android/server/print/UserState.java index f37bb9eb67753..6a50a6eaff21c 100644 --- a/services/print/java/com/android/server/print/UserState.java +++ b/services/print/java/com/android/server/print/UserState.java @@ -343,9 +343,7 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks { public void createPrinterDiscoverySession(IPrinterDiscoveryObserver observer) { synchronized (mLock) { throwIfDestroyedLocked(); - if (mActiveServices.isEmpty()) { - return; - } + if (mPrinterDiscoverySession == null) { // If we do not have a session, tell all service to create one. mPrinterDiscoverySession = new PrinterDiscoverySessionMediator(mContext) {