am d2b27cbd: am 6874bfe1: Merge "Created print jobs should not be persisted until they are queued." into klp-dev

* commit 'd2b27cbde92dc57b5b6fe9b7434a5189a73dd2b2':
  Created print jobs should not be persisted until they are queued.
This commit is contained in:
Svetoslav
2013-11-14 22:30:52 -08:00
committed by Android Git Automerger
2 changed files with 9 additions and 2 deletions

View File

@@ -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"

View File

@@ -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,9 +451,12 @@ public final class PrintSpoolerService extends Service {
Slog.i(LOG_TAG, "[REMOVE] " + printJob.getId().flattenToString());
}
removePrintJobFileLocked(printJob.getId());
persistState = true;
}
}
mPersistanceManager.writeStateLocked();
if (persistState) {
mPersistanceManager.writeStateLocked();
}
}
}
@@ -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());