Merge "Reintroduce per-app scheduled job limits" into nyc-dev
This commit is contained in:
@@ -92,7 +92,7 @@ public final class JobSchedulerService extends com.android.server.SystemService
|
|||||||
/** The maximum number of concurrent jobs we run at one time. */
|
/** The maximum number of concurrent jobs we run at one time. */
|
||||||
private static final int MAX_JOB_CONTEXTS_COUNT = 8;
|
private static final int MAX_JOB_CONTEXTS_COUNT = 8;
|
||||||
/** Enforce a per-app limit on scheduled jobs? */
|
/** Enforce a per-app limit on scheduled jobs? */
|
||||||
private static final boolean ENFORCE_MAX_JOBS = false;
|
private static final boolean ENFORCE_MAX_JOBS = true;
|
||||||
/** The maximum number of jobs that we allow an unprivileged app to schedule */
|
/** The maximum number of jobs that we allow an unprivileged app to schedule */
|
||||||
private static final int MAX_JOBS_PER_APP = 100;
|
private static final int MAX_JOBS_PER_APP = 100;
|
||||||
|
|
||||||
|
|||||||
@@ -543,7 +543,7 @@ public class JobStore {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String sourcePackageName = parser.getAttributeValue(null, "sourcePackageName");
|
String sourcePackageName = parser.getAttributeValue(null, "sourcePackageName");
|
||||||
|
|
||||||
final String sourceTag = parser.getAttributeValue(null, "sourceTag");
|
final String sourceTag = parser.getAttributeValue(null, "sourceTag");
|
||||||
|
|
||||||
@@ -660,6 +660,18 @@ public class JobStore {
|
|||||||
jobBuilder.setExtras(extras);
|
jobBuilder.setExtras(extras);
|
||||||
parser.nextTag(); // Consume </extras>
|
parser.nextTag(); // Consume </extras>
|
||||||
|
|
||||||
|
// Migrate sync jobs forward from earlier, incomplete representation
|
||||||
|
if ("android".equals(sourcePackageName)
|
||||||
|
&& extras != null
|
||||||
|
&& extras.getBoolean("SyncManagerJob", false)) {
|
||||||
|
sourcePackageName = extras.getString("owningPackage", sourcePackageName);
|
||||||
|
if (DEBUG) {
|
||||||
|
Slog.i(TAG, "Fixing up sync job source package name from 'android' to '"
|
||||||
|
+ sourcePackageName + "'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// And now we're done
|
||||||
JobStatus js = new JobStatus(
|
JobStatus js = new JobStatus(
|
||||||
jobBuilder.build(), uid, sourcePackageName, sourceUserId, sourceTag,
|
jobBuilder.build(), uid, sourcePackageName, sourceUserId, sourceTag,
|
||||||
elapsedRuntimes.first, elapsedRuntimes.second);
|
elapsedRuntimes.first, elapsedRuntimes.second);
|
||||||
|
|||||||
Reference in New Issue
Block a user