am 63ce2019
: Merge "Fail only scheduled print jobs, i.e. handed to a service, if the service is disabled." into klp-dev
* commit '63ce201963339d937cf66fed7870356291dc57ad': Fail only scheduled print jobs, i.e. handed to a service, if the service is disabled.
This commit is contained in:
@ -47,6 +47,14 @@ public final class PrintJobInfo implements Parcelable {
|
|||||||
*/
|
*/
|
||||||
public static final int STATE_ANY_ACTIVE = -3;
|
public static final int STATE_ANY_ACTIVE = -3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constant for matching any scheduled, i.e. delivered to a print
|
||||||
|
* service, print job state.
|
||||||
|
*
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public static final int STATE_ANY_SCHEDULED = -4;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print job state: The print job is being created but not yet
|
* Print job state: The print job is being created but not yet
|
||||||
* ready to be printed.
|
* ready to be printed.
|
||||||
|
@ -268,7 +268,9 @@ public final class PrintSpoolerService extends Service {
|
|||||||
|| (state == PrintJobInfo.STATE_ANY_VISIBLE_TO_CLIENTS
|
|| (state == PrintJobInfo.STATE_ANY_VISIBLE_TO_CLIENTS
|
||||||
&& isStateVisibleToUser(printJob.getState()))
|
&& isStateVisibleToUser(printJob.getState()))
|
||||||
|| (state == PrintJobInfo.STATE_ANY_ACTIVE
|
|| (state == PrintJobInfo.STATE_ANY_ACTIVE
|
||||||
&& isActiveState(printJob.getState()));
|
&& isActiveState(printJob.getState()))
|
||||||
|
|| (state == PrintJobInfo.STATE_ANY_SCHEDULED
|
||||||
|
&& isScheduledState(printJob.getState()));
|
||||||
if (sameComponent && sameAppId && sameState) {
|
if (sameComponent && sameAppId && sameState) {
|
||||||
if (foundPrintJobs == null) {
|
if (foundPrintJobs == null) {
|
||||||
foundPrintJobs = new ArrayList<PrintJobInfo>();
|
foundPrintJobs = new ArrayList<PrintJobInfo>();
|
||||||
@ -554,6 +556,12 @@ public final class PrintSpoolerService extends Service {
|
|||||||
|| printJobState == PrintJobInfo.STATE_QUEUED);
|
|| printJobState == PrintJobInfo.STATE_QUEUED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isScheduledState(int printJobState) {
|
||||||
|
return printJobState == PrintJobInfo.STATE_QUEUED
|
||||||
|
|| printJobState == PrintJobInfo.STATE_STARTED
|
||||||
|
|| printJobState == PrintJobInfo.STATE_BLOCKED;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean isActiveState(int printJobState) {
|
private boolean isActiveState(int printJobState) {
|
||||||
return printJobState == PrintJobInfo.STATE_CREATED
|
return printJobState == PrintJobInfo.STATE_CREATED
|
||||||
|| printJobState == PrintJobInfo.STATE_QUEUED
|
|| printJobState == PrintJobInfo.STATE_QUEUED
|
||||||
|
@ -798,17 +798,17 @@ final class UserState implements PrintSpoolerCallbacks, PrintServiceCallbacks {
|
|||||||
BackgroundThread.getHandler().post(new Runnable() {
|
BackgroundThread.getHandler().post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
failActivePrintJobsForServiceInternal(serviceName);
|
failScheduledPrintJobsForServiceInternal(serviceName);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
failActivePrintJobsForServiceInternal(serviceName);
|
failScheduledPrintJobsForServiceInternal(serviceName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void failActivePrintJobsForServiceInternal(ComponentName serviceName) {
|
private void failScheduledPrintJobsForServiceInternal(ComponentName serviceName) {
|
||||||
List<PrintJobInfo> printJobs = mSpooler.getPrintJobInfos(serviceName,
|
List<PrintJobInfo> printJobs = mSpooler.getPrintJobInfos(serviceName,
|
||||||
PrintJobInfo.STATE_ANY_ACTIVE, PrintManager.APP_ID_ANY);
|
PrintJobInfo.STATE_ANY_SCHEDULED, PrintManager.APP_ID_ANY);
|
||||||
if (printJobs == null) {
|
if (printJobs == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user