Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 04f1ad9d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handle malformed PDFs gracefully in PrintSpooler" into main

parents 527fe9da e6cd19d9
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -37,5 +37,4 @@ oneway interface IPrintDocumentAdapter {
    void write(in PageRange[] pages, in ParcelFileDescriptor fd,
            IWriteResultCallback callback, int sequence);
    void finish();
    void kill(String reason);
}
+0 −20
Original line number Diff line number Diff line
@@ -945,17 +945,6 @@ public final class PrintManager {
            }
        }

        @Override
        public void kill(String reason) {
            synchronized (mLock) {
                // If destroyed the handler is null.
                if (!isDestroyedLocked()) {
                    mHandler.obtainMessage(MyHandler.MSG_ON_KILL,
                            reason).sendToTarget();
                }
            }
        }

        @Override
        public void onActivityPaused(Activity activity) {
            /* do nothing */
@@ -1118,15 +1107,6 @@ public final class PrintManager {
                        }
                    } break;

                    case MSG_ON_KILL: {
                        if (DEBUG) {
                            Log.i(LOG_TAG, "onKill()");
                        }

                        String reason = (String) message.obj;
                        throw new RuntimeException(reason);
                    }

                    default: {
                        throw new IllegalArgumentException("Unknown message: "
                                + message.what);
+0 −12
Original line number Diff line number Diff line
@@ -329,18 +329,6 @@ public final class RemotePrintDocument {
        disconnectFromRemoteDocument();
    }

    public void kill(String reason) {
        if (DEBUG) {
            Log.i(LOG_TAG, "[CALLED] kill()");
        }

        try {
            mPrintDocumentAdapter.kill(reason);
        } catch (RemoteException re) {
            Log.e(LOG_TAG, "Error calling kill()", re);
        }
    }

    public boolean isUpdating() {
        return mState == STATE_UPDATING || mState == STATE_CANCELING;
    }
+6 −2
Original line number Diff line number Diff line
@@ -514,8 +514,12 @@ public class PrintActivity extends Activity implements RemotePrintDocument.Updat
        ensureErrorUiShown(null, PrintErrorFragment.ACTION_RETRY);

        setState(STATE_UPDATE_FAILED);

        mPrintedDocument.kill(message);
        if (DEBUG) {
            Log.i(LOG_TAG, "PrintJob state[" +  PrintJobInfo.STATE_FAILED + "] reason: " + message);
        }
        PrintSpoolerService spooler = mSpoolerProvider.getSpooler();
        spooler.setPrintJobState(mPrintJob.getId(), PrintJobInfo.STATE_FAILED, message);
        mPrintedDocument.finish();
    }

    @Override