Extend JobInfo to support NetworkRequest.
The current JobInfo.NETWORK_TYPE values offer basic network selection ability, but more precise requirements continue to come up. Instead of creating more NETWORK_TYPE constants, add support for the existing NetworkRequest object, which is the idiomatic way for an app to express the type of network they'd like to use. Move the implementation details of NETWORK_TYPE constants to use this new NetworkRequest functionality. Deprecate NETWORK_TYPE_METERED, since the lack of the NOT_METERED capability doesn't imply that the connection is metered. (Apps using this API to get to a cellular network should use TRANSPORT_CELLULAR instead.) Add new SystemClock APIs that return java.time.Clock instances for various Android-specific clocks. This gives us a clean interface (with negligible overhead) for swapping in artificial clocks for testing purposes. Improve JobStoreTest to validate new NetworkRequest features, and add one last sanity check to assertTasksEqual() to compare raw bits-on-wire, to catch people who forget to check new fields. Watch for IoThread to go idle to run tests faster. Test: bit FrameworksServicesTests:com.android.server.job. Bug: 67040695 Change-Id: I189e7602132a0ec26d2f0cc6dadc188664961a47
Loading
Please register or sign in to comment