OSDN Git Service

Watch all networks for job invalidation signals.
authorJeff Sharkey <jsharkey@android.com>
Fri, 30 Mar 2018 00:22:41 +0000 (18:22 -0600)
committerJeff Sharkey <jsharkey@android.com>
Fri, 30 Mar 2018 00:22:44 +0000 (18:22 -0600)
commit4d89e42eee94cc8694aa0115f04c7329534e10ae
treef048c3f9abaecdc151e3be11d746a97612863ef3
parentdac0fe910ab16edb2c2433986f709da3b3f6c15f
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
services/core/java/com/android/server/job/JobSchedulerService.java
services/core/java/com/android/server/job/controllers/ConnectivityController.java
services/core/java/com/android/server/job/controllers/StateController.java
services/tests/servicestests/src/com/android/server/job/controllers/ConnectivityControllerTest.java