Merge changes from topic 'AddPrinters'

* changes:
  Create PrintDiscoverySession for future print services
  Update printer availability when printSpooler is paused. This makes the window update syncronously when in multi-window mode.
This commit is contained in:
Philip P. Moltmann
2015-11-24 21:33:39 +00:00
committed by Android (Google) Code Review
2 changed files with 9 additions and 6 deletions

View File

@@ -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

View File

@@ -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) {