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

Commit 6ce161d1 authored by Svetoslav's avatar Svetoslav Committed by Android (Google) Code Review
Browse files

Merge "Cancel current work in PrintDocumentAdatper if printing is cancelled." into klp-dev

parents 5747919f d270cb92
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -37,4 +37,5 @@ oneway interface IPrintDocumentAdapter {
    void write(in PageRange[] pages, in ParcelFileDescriptor fd,
            IWriteResultCallback callback, int sequence);
    void finish();
    void cancel();
}
+12 −0
Original line number Diff line number Diff line
@@ -615,6 +615,18 @@ public final class PrintManager {
            }
        }

        @Override
        public void cancel() {
            // Start not called or finish called or destroyed - nothing to do.
            if (!mStartReqeusted || mFinishRequested || mDestroyed) {
                return;
            }
            // Request cancellation of pending work if needed.
            synchronized (mLock) {
                cancelPreviousCancellableOperationLocked();
            }
        }

        @Override
        public void onActivityPaused(Activity activity) {
            /* do nothing */
+3 −0
Original line number Diff line number Diff line
@@ -357,6 +357,9 @@ public class PrintJobConfigActivity extends Activity {
        }

        public void cancel() {
            if (isWorking()) {
                mRemotePrintAdapter.cancel();
            }
            mControllerState = CONTROLLER_STATE_CANCELLED;
        }

+11 −0
Original line number Diff line number Diff line
@@ -137,4 +137,15 @@ final class RemotePrintDocumentAdapter {
            Log.e(LOG_TAG, "Error calling finish()", re);
        }
    }

    public void cancel() {
        if (DEBUG) {
            Log.i(LOG_TAG, "cancel()");
        }
        try {
            mRemoteInterface.cancel();
        } catch (RemoteException re) {
            Log.e(LOG_TAG, "Error calling cancel()", re);
        }
    }
}