summaryrefslogtreecommitdiffstats
path: root/packages/PrintSpooler/src/com/android/printspooler/ui
diff options
context:
space:
mode:
Diffstat (limited to 'packages/PrintSpooler/src/com/android/printspooler/ui')
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java15
-rw-r--r--packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java7
2 files changed, 14 insertions, 8 deletions
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java b/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java
index 02d2715..22a7f86 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/FusedPrintersProvider.java
@@ -346,7 +346,6 @@ public final class FusedPrintersProvider extends Loader<List<PrinterInfo>> {
private List<PrinterInfo> mHistoricalPrinters = new ArrayList<>();
private boolean mReadHistoryCompleted;
- private boolean mReadHistoryInProgress;
private ReadTask mReadTask;
@@ -358,7 +357,7 @@ public final class FusedPrintersProvider extends Loader<List<PrinterInfo>> {
}
public boolean isReadHistoryInProgress() {
- return mReadHistoryInProgress;
+ return mReadTask != null;
}
public boolean isReadHistoryCompleted() {
@@ -366,9 +365,7 @@ public final class FusedPrintersProvider extends Loader<List<PrinterInfo>> {
}
public boolean stopReadPrinterHistory() {
- final boolean cancelled = mReadTask.cancel(true);
- mReadTask = null;
- return cancelled;
+ return mReadTask.cancel(true);
}
public void readPrinterHistory() {
@@ -376,7 +373,6 @@ public final class FusedPrintersProvider extends Loader<List<PrinterInfo>> {
Log.i(LOG_TAG, "read history started "
+ FusedPrintersProvider.this.hashCode());
}
- mReadHistoryInProgress = true;
mReadTask = new ReadTask();
mReadTask.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, (Void[]) null);
}
@@ -534,15 +530,20 @@ public final class FusedPrintersProvider extends Loader<List<PrinterInfo>> {
mFavoritePrinters.clear();
mFavoritePrinters.addAll(computeFavoritePrinters(mHistoricalPrinters));
- mReadHistoryInProgress = false;
mReadHistoryCompleted = true;
// Deliver the printers.
updatePrinters(mDiscoverySession.getPrinters(), mFavoritePrinters);
+ // We are done.
+ mReadTask = null;
+
// Loading the available printers if needed.
loadInternal();
+ }
+ @Override
+ protected void onCancelled(List<PrinterInfo> printerInfos) {
// We are done.
mReadTask = null;
}
diff --git a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
index b76a9cd..71d5340 100644
--- a/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
+++ b/packages/PrintSpooler/src/com/android/printspooler/ui/PrintActivity.java
@@ -291,6 +291,9 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
if (isFinishing() || (isFinalState(mState) && !mPrintedDocument.isUpdating())) {
return;
}
+ if (mPrintedDocument.isUpdating()) {
+ mPrintedDocument.cancel();
+ }
setState(STATE_PRINT_CANCELED);
doFinish();
}
@@ -558,7 +561,9 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
- mPrintPreviewController.onOrientationChanged();
+ if (mPrintPreviewController != null) {
+ mPrintPreviewController.onOrientationChanged();
+ }
}
@Override