Merge "Fix a crash in print spooler." into lmp-dev
This commit is contained in:
@@ -221,8 +221,6 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
setState(STATE_CONFIGURING);
|
||||
|
||||
Bundle extras = getIntent().getExtras();
|
||||
|
||||
mPrintJob = extras.getParcelable(PrintManager.EXTRA_PRINT_JOB);
|
||||
@@ -313,13 +311,17 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
PrintSpoolerService spooler = mSpoolerProvider.getSpooler();
|
||||
|
||||
if (mState == STATE_INITIALIZING) {
|
||||
if (isFinishing()) {
|
||||
spooler.setPrintJobState(mPrintJob.getId(), PrintJobInfo.STATE_CANCELED, null);
|
||||
}
|
||||
super.onPause();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isFinishing()) {
|
||||
PrintSpoolerService spooler = mSpoolerProvider.getSpooler();
|
||||
spooler.updatePrintJobUserConfigurableOptionsNoPersistence(mPrintJob);
|
||||
|
||||
switch (mState) {
|
||||
@@ -345,6 +347,10 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
|
||||
mPrinterRegistry.setTrackedPrinter(null);
|
||||
mPrintPreviewController.destroy();
|
||||
mSpoolerProvider.destroy();
|
||||
|
||||
if (mPrintedDocument.isUpdating()) {
|
||||
mPrintedDocument.cancel();
|
||||
}
|
||||
mPrintedDocument.finish();
|
||||
mPrintedDocument.destroy();
|
||||
}
|
||||
@@ -366,7 +372,8 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (mState == STATE_INITIALIZING) {
|
||||
return super.onKeyUp(keyCode, event);
|
||||
finish();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keyCode == KeyEvent.KEYCODE_BACK
|
||||
|
||||
Reference in New Issue
Block a user