Merge "Allow system jobs to be exempted from app-standby"

This commit is contained in:
Makoto Onuki
2018-01-27 00:31:42 +00:00
committed by Android (Google) Code Review
2 changed files with 37 additions and 13 deletions

View File

@@ -255,6 +255,14 @@ public class JobInfo implements Parcelable {
*/
public static final int FLAG_IS_PREFETCH = 1 << 2;
/**
* This job needs to be exempted from the app standby throttling. Only the system (UID 1000)
* can set it. Jobs with a time constrant must not have it.
*
* @hide
*/
public static final int FLAG_EXEMPT_FROM_APP_STANDBY = 1 << 3;
/**
* @hide
*/
@@ -355,6 +363,13 @@ public class JobInfo implements Parcelable {
return flags;
}
/** @hide */
public boolean isExemptedFromAppStandby() {
return ((flags & FLAG_EXEMPT_FROM_APP_STANDBY) != 0)
&& !hasEarlyConstraint()
&& !hasLateConstraint();
}
/**
* Whether this job requires that the device be charging (or be a non-battery-powered
* device connected to permanent power, such as Android TV devices).