Fix FLAG_EXEMPT_FROM_APP_STANDBY check
It was checking with the time constraint, but the sync manager uses FLAG_EXEMPT_FROM_APP_STANDBY for back-off syncs too, so it was actually valid. Instead let's just make sure periodic syncs don't have it. Bug: 73119752 Test: atest CtsJobSchedulerTestCases Change-Id: Ib87680fcef0707440a186848db076c4524a632af
This commit is contained in:
@@ -365,9 +365,7 @@ public class JobInfo implements Parcelable {
|
||||
|
||||
/** @hide */
|
||||
public boolean isExemptedFromAppStandby() {
|
||||
return ((flags & FLAG_EXEMPT_FROM_APP_STANDBY) != 0)
|
||||
&& !hasEarlyConstraint()
|
||||
&& !hasLateConstraint();
|
||||
return ((flags & FLAG_EXEMPT_FROM_APP_STANDBY) != 0) && !isPeriodic();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2346,9 +2346,9 @@ public final class JobSchedulerService extends com.android.server.SystemService
|
||||
if (callingUid != Process.SYSTEM_UID) {
|
||||
throw new SecurityException("Job has invalid flags");
|
||||
}
|
||||
if (job.hasLateConstraint() || job.hasEarlyConstraint()) {
|
||||
Slog.wtf(TAG, "Jobs with time-constraints mustn't have"
|
||||
+" FLAG_EXEMPT_FROM_APP_STANDBY. Job=" + job);
|
||||
if (job.isPeriodic()) {
|
||||
Slog.wtf(TAG, "Periodic jobs mustn't have"
|
||||
+ " FLAG_EXEMPT_FROM_APP_STANDBY. Job=" + job);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user