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

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

Merge "Created print jobs should not be persisted until they are queued." into klp-dev

parents 5823352c 885810de
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@
            android:layout_marginBottom="32dip"
            android:layout_gravity="center"
            style="?android:attr/buttonBarButtonStyle"
            android:singleLine="true"
            android:ellipsize="end"
            android:text="@string/print_error_default_message"
            android:textColor="@color/important_text"
+9 −1
Original line number Diff line number Diff line
@@ -441,6 +441,7 @@ public final class PrintSpoolerService extends Service {

    private void removeObsoletePrintJobs() {
        synchronized (mLock) {
            boolean persistState = false;
            final int printJobCount = mPrintJobs.size();
            for (int i = printJobCount - 1; i >= 0; i--) {
                PrintJobInfo printJob = mPrintJobs.get(i);
@@ -450,11 +451,14 @@ public final class PrintSpoolerService extends Service {
                        Slog.i(LOG_TAG, "[REMOVE] " + printJob.getId().flattenToString());
                    }
                    removePrintJobFileLocked(printJob.getId());
                    persistState = true;
                }
            }
            if (persistState) {
                mPersistanceManager.writeStateLocked();
            }
        }
    }

    private void removePrintJobFileLocked(PrintJobId printJobId) {
        File file = generateFileForPrintJob(printJobId);
@@ -799,6 +803,10 @@ public final class PrintSpoolerService extends Service {
                for (int j = 0; j < printJobCount; j++) {
                    PrintJobInfo printJob = printJobs.get(j);

                    if (!shouldPersistPrintJob(printJob)) {
                        continue;
                    }

                    serializer.startTag(null, TAG_JOB);

                    serializer.attribute(null, ATTR_ID, printJob.getId().flattenToString());