Loading Android.bp +7 −0 Original line number Diff line number Diff line Loading @@ -1299,6 +1299,13 @@ droidstubs { "framework-annotations-lib", "android.hardware.radio-V1.5-java", ], check_api: { current: { // TODO(b/147699819): remove telephony prefix when moved api_file: "telephony/api/system-current.txt", removed_api_file: "telephony/api/system-removed.txt", }, }, defaults: ["framework-module-stubs-defaults-systemapi"], filter_packages: ["android.telephony"], sdk_version: "system_current", Loading apex/Android.bp +18 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,12 @@ stubs_defaults { args: mainline_stubs_args, installable: false, sdk_version: "current", check_api: { current: { api_file: "api/current.txt", removed_api_file: "api/removed.txt", }, }, } stubs_defaults { Loading @@ -52,6 +58,12 @@ stubs_defaults { libs: ["framework-annotations-lib"], installable: false, sdk_version: "system_current", check_api: { current: { api_file: "api/system-current.txt", removed_api_file: "api/system-removed.txt", }, }, } // The defaults for module_libs comes in two parts - defaults for API checks Loading @@ -65,6 +77,12 @@ stubs_defaults { libs: ["framework-annotations-lib"], installable: false, sdk_version: "module_current", check_api: { current: { api_file: "api/module-lib-current.txt", removed_api_file: "api/module-lib-removed.txt", }, }, } stubs_defaults { Loading apex/jobscheduler/framework/java/android/app/job/JobInfo.java +4 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,10 @@ import java.util.Objects; * using the {@link JobInfo.Builder}. * The goal here is to provide the scheduler with high-level semantics about the work you want to * accomplish. * <p> Prior to Android version {@link Build.VERSION_CODES#Q}, you had to specify at least one * constraint on the JobInfo object that you are creating. Otherwise, the builder would throw an * exception when building. From Android version {@link Build.VERSION_CODES#Q} and onwards, it is * valid to schedule jobs with no constraints. */ public class JobInfo implements Parcelable { private static String TAG = "JobInfo"; Loading apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +17 −12 Original line number Diff line number Diff line Loading @@ -746,7 +746,13 @@ public class JobSchedulerService extends com.android.server.SystemService final Constants mConstants; final ConstantsObserver mConstantsObserver; static final Comparator<JobStatus> mEnqueueTimeComparator = (o1, o2) -> { private static final Comparator<JobStatus> sPendingJobComparator = (o1, o2) -> { // Jobs with an override state set (via adb) should be put first as tests/developers // expect the jobs to run immediately. if (o1.overrideState != o2.overrideState) { // Higher override state (OVERRIDE_FULL) should be before lower state (OVERRIDE_SOFT) return o2.overrideState - o1.overrideState; } if (o1.enqueueTime < o2.enqueueTime) { return -1; } Loading Loading @@ -1097,7 +1103,7 @@ public class JobSchedulerService extends com.android.server.SystemService // This is a new job, we can just immediately put it on the pending // list and try to run it. mJobPackageTracker.notePending(jobStatus); addOrderedItem(mPendingJobs, jobStatus, mEnqueueTimeComparator); addOrderedItem(mPendingJobs, jobStatus, sPendingJobComparator); maybeRunPendingJobsLocked(); } else { evaluateControllerStatesLocked(jobStatus); Loading Loading @@ -1858,7 +1864,7 @@ public class JobSchedulerService extends com.android.server.SystemService // state is such that all ready jobs should be run immediately. if (runNow != null && isReadyToBeExecutedLocked(runNow)) { mJobPackageTracker.notePending(runNow); addOrderedItem(mPendingJobs, runNow, mEnqueueTimeComparator); addOrderedItem(mPendingJobs, runNow, sPendingJobComparator); } else { queueReadyJobsForExecutionLocked(); } Loading Loading @@ -2030,7 +2036,7 @@ public class JobSchedulerService extends com.android.server.SystemService noteJobsPending(newReadyJobs); mPendingJobs.addAll(newReadyJobs); if (mPendingJobs.size() > 1) { mPendingJobs.sort(mEnqueueTimeComparator); mPendingJobs.sort(sPendingJobComparator); } newReadyJobs.clear(); Loading Loading @@ -2107,7 +2113,7 @@ public class JobSchedulerService extends com.android.server.SystemService noteJobsPending(runnableJobs); mPendingJobs.addAll(runnableJobs); if (mPendingJobs.size() > 1) { mPendingJobs.sort(mEnqueueTimeComparator); mPendingJobs.sort(sPendingJobComparator); } } else { if (DEBUG) { Loading Loading @@ -2813,11 +2819,9 @@ public class JobSchedulerService extends com.android.server.SystemService } // Shell command infrastructure: run the given job immediately int executeRunCommand(String pkgName, int userId, int jobId, boolean force) { if (DEBUG) { Slog.v(TAG, "executeRunCommand(): " + pkgName + "/" + userId + " " + jobId + " f=" + force); } int executeRunCommand(String pkgName, int userId, int jobId, boolean satisfied, boolean force) { Slog.d(TAG, "executeRunCommand(): " + pkgName + "/" + userId + " " + jobId + " s=" + satisfied + " f=" + force); try { final int uid = AppGlobals.getPackageManager().getPackageUid(pkgName, 0, Loading @@ -2832,7 +2836,8 @@ public class JobSchedulerService extends com.android.server.SystemService return JobSchedulerShellCommand.CMD_ERR_NO_JOB; } js.overrideState = (force) ? JobStatus.OVERRIDE_FULL : JobStatus.OVERRIDE_SOFT; js.overrideState = (force) ? JobStatus.OVERRIDE_FULL : (satisfied ? JobStatus.OVERRIDE_SORTING : JobStatus.OVERRIDE_SOFT); // Re-evaluate constraints after the override is set in case one of the overridden // constraints was preventing another constraint from thinking it needed to update. Loading @@ -2841,7 +2846,7 @@ public class JobSchedulerService extends com.android.server.SystemService } if (!js.isConstraintsSatisfied()) { js.overrideState = 0; js.overrideState = JobStatus.OVERRIDE_NONE; return JobSchedulerShellCommand.CMD_ERR_CONSTRAINTS; } Loading apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java +22 −4 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { checkPermission("force scheduled jobs"); boolean force = false; boolean satisfied = false; int userId = UserHandle.USER_SYSTEM; String opt; Loading @@ -146,6 +147,11 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { force = true; break; case "-s": case "--satisfied": satisfied = true; break; case "-u": case "--user": userId = Integer.parseInt(getNextArgRequired()); Loading @@ -157,12 +163,17 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { } } if (force && satisfied) { pw.println("Cannot specify both --force and --satisfied"); return -1; } final String pkgName = getNextArgRequired(); final int jobId = Integer.parseInt(getNextArgRequired()); final long ident = Binder.clearCallingIdentity(); try { int ret = mInternal.executeRunCommand(pkgName, userId, jobId, force); int ret = mInternal.executeRunCommand(pkgName, userId, jobId, satisfied, force); if (printError(ret, pkgName, userId, jobId)) { return ret; } Loading Loading @@ -424,11 +435,18 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { pw.println("Job scheduler (jobscheduler) commands:"); pw.println(" help"); pw.println(" Print this help text."); pw.println(" run [-f | --force] [-u | --user USER_ID] PACKAGE JOB_ID"); pw.println(" Trigger immediate execution of a specific scheduled job."); pw.println(" run [-f | --force] [-s | --satisfied] [-u | --user USER_ID] PACKAGE JOB_ID"); pw.println(" Trigger immediate execution of a specific scheduled job. For historical"); pw.println(" reasons, some constraints, such as battery, are ignored when this"); pw.println(" command is called. If you don't want any constraints to be ignored,"); pw.println(" include the -s flag."); pw.println(" Options:"); pw.println(" -f or --force: run the job even if technical constraints such as"); pw.println(" connectivity are not currently met"); pw.println(" connectivity are not currently met. This is incompatible with -f "); pw.println(" and so an error will be reported if both are given."); pw.println(" -s or --satisfied: run the job only if all constraints are met."); pw.println(" This is incompatible with -f and so an error will be reported"); pw.println(" if both are given."); pw.println(" -u or --user: specify which user's job is to be run; the default is"); pw.println(" the primary or system user"); pw.println(" timeout [-u | --user USER_ID] [PACKAGE] [JOB_ID]"); Loading Loading
Android.bp +7 −0 Original line number Diff line number Diff line Loading @@ -1299,6 +1299,13 @@ droidstubs { "framework-annotations-lib", "android.hardware.radio-V1.5-java", ], check_api: { current: { // TODO(b/147699819): remove telephony prefix when moved api_file: "telephony/api/system-current.txt", removed_api_file: "telephony/api/system-removed.txt", }, }, defaults: ["framework-module-stubs-defaults-systemapi"], filter_packages: ["android.telephony"], sdk_version: "system_current", Loading
apex/Android.bp +18 −0 Original line number Diff line number Diff line Loading @@ -44,6 +44,12 @@ stubs_defaults { args: mainline_stubs_args, installable: false, sdk_version: "current", check_api: { current: { api_file: "api/current.txt", removed_api_file: "api/removed.txt", }, }, } stubs_defaults { Loading @@ -52,6 +58,12 @@ stubs_defaults { libs: ["framework-annotations-lib"], installable: false, sdk_version: "system_current", check_api: { current: { api_file: "api/system-current.txt", removed_api_file: "api/system-removed.txt", }, }, } // The defaults for module_libs comes in two parts - defaults for API checks Loading @@ -65,6 +77,12 @@ stubs_defaults { libs: ["framework-annotations-lib"], installable: false, sdk_version: "module_current", check_api: { current: { api_file: "api/module-lib-current.txt", removed_api_file: "api/module-lib-removed.txt", }, }, } stubs_defaults { Loading
apex/jobscheduler/framework/java/android/app/job/JobInfo.java +4 −0 Original line number Diff line number Diff line Loading @@ -55,6 +55,10 @@ import java.util.Objects; * using the {@link JobInfo.Builder}. * The goal here is to provide the scheduler with high-level semantics about the work you want to * accomplish. * <p> Prior to Android version {@link Build.VERSION_CODES#Q}, you had to specify at least one * constraint on the JobInfo object that you are creating. Otherwise, the builder would throw an * exception when building. From Android version {@link Build.VERSION_CODES#Q} and onwards, it is * valid to schedule jobs with no constraints. */ public class JobInfo implements Parcelable { private static String TAG = "JobInfo"; Loading
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerService.java +17 −12 Original line number Diff line number Diff line Loading @@ -746,7 +746,13 @@ public class JobSchedulerService extends com.android.server.SystemService final Constants mConstants; final ConstantsObserver mConstantsObserver; static final Comparator<JobStatus> mEnqueueTimeComparator = (o1, o2) -> { private static final Comparator<JobStatus> sPendingJobComparator = (o1, o2) -> { // Jobs with an override state set (via adb) should be put first as tests/developers // expect the jobs to run immediately. if (o1.overrideState != o2.overrideState) { // Higher override state (OVERRIDE_FULL) should be before lower state (OVERRIDE_SOFT) return o2.overrideState - o1.overrideState; } if (o1.enqueueTime < o2.enqueueTime) { return -1; } Loading Loading @@ -1097,7 +1103,7 @@ public class JobSchedulerService extends com.android.server.SystemService // This is a new job, we can just immediately put it on the pending // list and try to run it. mJobPackageTracker.notePending(jobStatus); addOrderedItem(mPendingJobs, jobStatus, mEnqueueTimeComparator); addOrderedItem(mPendingJobs, jobStatus, sPendingJobComparator); maybeRunPendingJobsLocked(); } else { evaluateControllerStatesLocked(jobStatus); Loading Loading @@ -1858,7 +1864,7 @@ public class JobSchedulerService extends com.android.server.SystemService // state is such that all ready jobs should be run immediately. if (runNow != null && isReadyToBeExecutedLocked(runNow)) { mJobPackageTracker.notePending(runNow); addOrderedItem(mPendingJobs, runNow, mEnqueueTimeComparator); addOrderedItem(mPendingJobs, runNow, sPendingJobComparator); } else { queueReadyJobsForExecutionLocked(); } Loading Loading @@ -2030,7 +2036,7 @@ public class JobSchedulerService extends com.android.server.SystemService noteJobsPending(newReadyJobs); mPendingJobs.addAll(newReadyJobs); if (mPendingJobs.size() > 1) { mPendingJobs.sort(mEnqueueTimeComparator); mPendingJobs.sort(sPendingJobComparator); } newReadyJobs.clear(); Loading Loading @@ -2107,7 +2113,7 @@ public class JobSchedulerService extends com.android.server.SystemService noteJobsPending(runnableJobs); mPendingJobs.addAll(runnableJobs); if (mPendingJobs.size() > 1) { mPendingJobs.sort(mEnqueueTimeComparator); mPendingJobs.sort(sPendingJobComparator); } } else { if (DEBUG) { Loading Loading @@ -2813,11 +2819,9 @@ public class JobSchedulerService extends com.android.server.SystemService } // Shell command infrastructure: run the given job immediately int executeRunCommand(String pkgName, int userId, int jobId, boolean force) { if (DEBUG) { Slog.v(TAG, "executeRunCommand(): " + pkgName + "/" + userId + " " + jobId + " f=" + force); } int executeRunCommand(String pkgName, int userId, int jobId, boolean satisfied, boolean force) { Slog.d(TAG, "executeRunCommand(): " + pkgName + "/" + userId + " " + jobId + " s=" + satisfied + " f=" + force); try { final int uid = AppGlobals.getPackageManager().getPackageUid(pkgName, 0, Loading @@ -2832,7 +2836,8 @@ public class JobSchedulerService extends com.android.server.SystemService return JobSchedulerShellCommand.CMD_ERR_NO_JOB; } js.overrideState = (force) ? JobStatus.OVERRIDE_FULL : JobStatus.OVERRIDE_SOFT; js.overrideState = (force) ? JobStatus.OVERRIDE_FULL : (satisfied ? JobStatus.OVERRIDE_SORTING : JobStatus.OVERRIDE_SOFT); // Re-evaluate constraints after the override is set in case one of the overridden // constraints was preventing another constraint from thinking it needed to update. Loading @@ -2841,7 +2846,7 @@ public class JobSchedulerService extends com.android.server.SystemService } if (!js.isConstraintsSatisfied()) { js.overrideState = 0; js.overrideState = JobStatus.OVERRIDE_NONE; return JobSchedulerShellCommand.CMD_ERR_CONSTRAINTS; } Loading
apex/jobscheduler/service/java/com/android/server/job/JobSchedulerShellCommand.java +22 −4 Original line number Diff line number Diff line Loading @@ -136,6 +136,7 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { checkPermission("force scheduled jobs"); boolean force = false; boolean satisfied = false; int userId = UserHandle.USER_SYSTEM; String opt; Loading @@ -146,6 +147,11 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { force = true; break; case "-s": case "--satisfied": satisfied = true; break; case "-u": case "--user": userId = Integer.parseInt(getNextArgRequired()); Loading @@ -157,12 +163,17 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { } } if (force && satisfied) { pw.println("Cannot specify both --force and --satisfied"); return -1; } final String pkgName = getNextArgRequired(); final int jobId = Integer.parseInt(getNextArgRequired()); final long ident = Binder.clearCallingIdentity(); try { int ret = mInternal.executeRunCommand(pkgName, userId, jobId, force); int ret = mInternal.executeRunCommand(pkgName, userId, jobId, satisfied, force); if (printError(ret, pkgName, userId, jobId)) { return ret; } Loading Loading @@ -424,11 +435,18 @@ public final class JobSchedulerShellCommand extends BasicShellCommandHandler { pw.println("Job scheduler (jobscheduler) commands:"); pw.println(" help"); pw.println(" Print this help text."); pw.println(" run [-f | --force] [-u | --user USER_ID] PACKAGE JOB_ID"); pw.println(" Trigger immediate execution of a specific scheduled job."); pw.println(" run [-f | --force] [-s | --satisfied] [-u | --user USER_ID] PACKAGE JOB_ID"); pw.println(" Trigger immediate execution of a specific scheduled job. For historical"); pw.println(" reasons, some constraints, such as battery, are ignored when this"); pw.println(" command is called. If you don't want any constraints to be ignored,"); pw.println(" include the -s flag."); pw.println(" Options:"); pw.println(" -f or --force: run the job even if technical constraints such as"); pw.println(" connectivity are not currently met"); pw.println(" connectivity are not currently met. This is incompatible with -f "); pw.println(" and so an error will be reported if both are given."); pw.println(" -s or --satisfied: run the job only if all constraints are met."); pw.println(" This is incompatible with -f and so an error will be reported"); pw.println(" if both are given."); pw.println(" -u or --user: specify which user's job is to be run; the default is"); pw.println(" the primary or system user"); pw.println(" timeout [-u | --user USER_ID] [PACKAGE] [JOB_ID]"); Loading