History log of /frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4d89e42eee94cc8694aa0115f04c7329534e10ae 30-Mar-2018 Jeff Sharkey <jsharkey@android.com> Watch all networks for job invalidation signals.

Until now, ConnectivityController was only watching for the
system-wide "default" network to change. Since the "default" network
can change on a per-UID basis, we could end up with jobs not being
rematched correctly.

To resolve this, we start watching for the firehose of all network
changes across the device. Since this results in increased noise,
we add a local cache of per-UID answers, and only re-evaluate jobs
when the changing network is the "default" network for that UID.

For NetworkPolicyManager.Listener, we only need to listen to
onUidRulesChanged(), since the other events always boil down into
specific rule changes.

Extends unit tests to verify all this logic behaves correctly.

Test: atest com.android.server.job.controllers.ConnectivityControllerTest
Bug: 73553301
Change-Id: I5b23ecd1facb6de723c5a6a7ddf9769a032d439e
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
ac2e8efa4395d30ebeda5885dcb7cb679f793d4c 23-Feb-2018 Jeff Sharkey <jsharkey@android.com> Knobs for connectivity experiments.

We keep the sane default values of 50% through a job window for
delaying on congested networks and promoting prefetch jobs, but now
allow experiments to override these values.

There's only ever one of each controller, so just create it tied to
the JobSchedulerService that owns it. (People that need hooks for
testing can provide a mock JSS, instead of doing extra constructor
overloads.)

Use IndentingPrintWriter for dumping constants.

Test: bit FrameworksServicesTests:com.android.server.job.
Bug: 72353440, 73019091
Change-Id: Icdb40ee3b0bb22a20ed821888b42b87f33eb49ec
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
fee8c7b42aeebf3a11b978ee657803da0dfa8147 22-Feb-2018 Jeff Sharkey <jsharkey@android.com> Mechanical refactoring to improve job dumping.

First, JobStatusFunctor was really Consumer<JobStatus> before we
had the java.util.function APIs, so switch everyone over. Replace
most usages with lambdas; no additional runtime cost, since existing
code was already creating classes.

Move dump() to accept Predicate<JobStatus> for their filtering
behavior, enabling more future advanced filtering using any
attributes of JobStatus. Also move dump() to IndentingPrintWriter
to avoid passing around tedious prefix information. Makes it much
easier to print sane-looking output.

Add IndentingPrintWriter support for initial prefix values.

Test: manual dumpsys output looks sane
Bug: 73019091
Change-Id: I4c2398443b42dfb48135ab900d4331ff6d2bb5c4
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
01bb530242eea8ff32fa3e0db70cbb40951fce24 22-Feb-2018 Jeff Sharkey <jsharkey@android.com> More consistent controller logging.

Unify behind a single strategy that allows us to enable specific
controllers (or everything) via setprop for debugging.

Test: builds, boots
Bug: 73019091
Change-Id: I039a0b722c3da2c38d2ea64932b31281d85eab1a
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
85f2fbcb1fc3277ea825ec3dc52f636b47302425 18-Dec-2017 Kweku Adams <kwekua@google.com> incidentd: dumping jobscheduler to proto

Bug: 65750819
Test: flash device and check incident.proto output
Also test: $ cts-tradefed run cts-dev --module CtsIncidentHostTestCases --test com.android.server.cts.JobSchedulerIncidentTest
Change-Id: I4abc01ca893edcbaf4d2254e4f807e06f5cb91f8
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
7da13d7c3e5b48c0410ae869c5679652de97e5aa 05-Apr-2017 Dianne Hackborn <hackbod@google.com> Add new "work queue" feature to JobScheduler.

This gives semantics similar to the start command
queue of services.

The implementation is currently lacking in URI permission
grant handling of the work intents; that will be coming
in a follow-up change.

This includes a first step of adjusting/fixing locking
within JobSchedulerService. The JobServiceContext class
has a bunch of stuff it does that assumes it doesn't need
locking because it schedules the work on a handler. However,
to be able to correctly implement the work finish flow (that
takes care of stopping the job when there is no more work),
we can't dispatch these asynchronously so need to get rid of
that and just do explicit locking.

The switch to explicit locking is half-way there (again the
remaining part will be a follow-on CL). Right now we have
the locking, but still also the handler. But it turns out
there were a number of things we were doing without a lock
held where we actually should have been holding a lock, so
this is better anyway.

Test: new tests added

Change-Id: Iebd098046209b28e60fd2f4d855d7f91cd3a8b03
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
ef3aa6ee53c5e4f1c50dd5a9b5821c54e449d4b3 30-Apr-2016 Dianne Hackborn <hackbod@google.com> Fix issue #28477006: Add small event log to job scheduler

Added. Also fixed dumpsys output when filtering, to apply the
filter to (almost) all of the output.

Change-Id: Iafb446599ad8fddbe8a766784deff618a6cfdbb7
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
141f11c82a2dbf042833f75aeae6f028e8ae2084 06-Apr-2016 Dianne Hackborn <hackbod@google.com> More work on issue #26390151: Add new JobScheduler API...

...for monitoring content providers

- Improve media provider change reporting so that observers can
avoid spurious reports of the top-level content directory changing.
- Fix a bug where collected content changes while a job was running
were not being properly propagated to the next job.

Change-Id: I29e3c2960e6fec75b16ee3ee6588d47342bf8c75
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
cb926fcec46b111d69059874d63c4cbebb5903c4 15-Mar-2016 Amith Yamasani <yamasani@google.com> Move device idle logic into a job StateController

Move most of device idle (doze) logic from JobSchedulerService
to DeviceIdleJobsController.

Allow whitelisted apps to run during device idle by adding
a new constraint DEVICE_NOT_DOZING. Using the word DOZE to
disambiguate from IDLE because the latter is used to mean
that the job wants to run in idle-maintenance period.

Bug: 26851107

Change-Id: I97f5286bd4d5ca18fbc46c2037c310fd369e18bf
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
b0001f6fb1383d9824c2733896b0b348e7f77240 16-Feb-2016 Dianne Hackborn <hackbod@google.com> Remove internal locking from JobStatus.

Now all state of JobStatus is implicitly protected by the lock
of whoever is using it -- in this case the global lock for the
JobSchedulerService. This allows us to remove all of the atomic
variables and just replace those with a simple bit field.

The required constraints for a job are now statically defined
once a JobStatus is created, and don't change. (They wouldn't
change before, but now this is absolutely specified to be the
case.) This required tweaking the constructors a bit so that
the earliest and latest run times are computed as part of the
core class initialization.

Also clarified methods on StateController that are called with
the lock held, and took advantage of that in the various
controllers to not now redundantly re-acquire the lock.

Change-Id: I595c5e7d1bff1bd2ff906d612581af82878a25ee
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
33d31c5b70c7d056e799e34bb6eccbe6939714ea 16-Feb-2016 Dianne Hackborn <hackbod@google.com> Simplify job scheduler service locking.

Unify all locks to just one lock protecting the entire service.
There is really no need for more complicated locking -- there is
nothing in the code that can take a long time to complete. And
having a single lock will allow various parts of the code to be
much simpler and easier to maintain.

This is just the first step of the change, switching all of the
locking to use one lock. With this done, we can now start
simplifying the code. For example, JobStatus no longer needs
to do any locking (or have atomic variables and such), it can
just rely on its callers holding the global service lock.

Change-Id: I502916ed7f2994b601750c67a59a96b1a4e95c6d
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
1a30bd9b13fd127d9bbfdc5fd4cb2f80ab7ece21 11-Jan-2016 Dianne Hackborn <hackbod@google.com> Add and implement JobScheduler content observer APIs.

Allows one to schedule jobs to run when content URIs
change, and find out what changed when the job executes.

This required adding a new API to StateController to
tell it when we are about to start executing a job, so
we can transfer the currently collected changes out of
its internal state to fill it in to the JobParameters.

Also some additional dumpsys debug output to help
understand what is going on in the job scheduler.

Change-Id: I91f51b226ff4add7a271a8333beffa5e86c7bf18
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
fa8e5084eed63ab8d92c71fcff656690a30293c3 16-Oct-2015 Matthew Williams <mjwilliams@google.com> Sanity check loaded periodics and cap runtime.

BUG: 24900376
We've seen an issue where periodic run times can be massively
inflated after loading from disk.
As a safeguard, cap the period's loaded runtime to be [p, 2p]
from the time of loading.

Change-Id: Ie4464490c8d6702fee8efe9190c3da5dc5f013f6
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
b0ff32245cb6b51e43dd3ee40b86d683c62de2b9 04-Mar-2015 Amith Yamasani <yamasani@google.com> Throttle jobs for idle apps

First pass at delaying jobs from apps that are idle.

TODO: Throttle syncs
TODO: Provide a periodic point at which apps are checked for idleness.

Apps that switch to foreground process state are tracked by UsageStats
as an INTERACTION event that affects the last-used timestamp.

JobScheduler's logic for when an app is ready is trumped by the idleness
of the app, and only if the battery is not charging. When charging state
changes, we update the idle state of all the tracked jobs.

android package is whitelisted.

Bug: 20066058
Change-Id: I0a0acb517b100a5c7b11e3f435f4141375f3451f
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
88e98dfa59e68a860d8c3b462ec03bc0b06d6b5c 23-Mar-2015 Dianne Hackborn <hackbod@google.com> More work on device idle mode.

- There is now an API for people to find out about
its state.
- Moved DeviceIdleController to be closer to the
power manager implementation, since they are
closely related.
- Job scheduler now knows about idle state and doesn't
run jobs while the device is idle.
- Battery stats now keeps track of "idling" vs "idle mode".
Idling is when we consider the device to be idle,
independent of whether we are actually in deep idle mode.
This allows us to keep track of longer-term changes
independently of cycling in and out of idle mode.
- Battery stats also now keeps track of package changes in
its daily stats.
- Small optimization to network policy manager service to
not touch uids that do not have the NETWORK permission.

Change-Id: I0b3304fb3722c78cdfdd0c1eada7369ece7cbcf9
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
08c7116ab9cd04ad6dd3c04aa1017237e7f409ac 28-Feb-2015 John Spurlock <jspurlock@google.com> Remove unused imports in frameworks/base.

Change-Id: I031443de83f93eb57a98863001826671b18f3b17
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
326f230ceba67a9b72d2606f7c503bef6f938ddd 08-Oct-2014 Georgi Nikolov <geonik@google.com> BUG 17887323: Need to turn off DEBUG log spam in Job Scheduler

Change-Id: Ida7af915c5b616216692493434b63c521398dfb0
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java
7060b04f6d92351b67222e636ab378a0273bf3e7 10-Jun-2014 Christopher Tate <ctate@google.com> Out with the old; in with the new

Switch to the official "JobScheduler" etc naming.

Bug 14997851

Change-Id: I73a61aaa9af0740c114d08188bd97c52f3ac86b7
/frameworks/base/services/core/java/com/android/server/job/controllers/StateController.java