3ac1daac4044c70ad4ee673214074306de499a18 |
|
14-Jul-2017 |
Suprabh Shukla <suprabh@google.com> |
Restricting background apps from running jobs Introducing a new app op which controls whether apps are allowed to run jobs in the background. When the app op mode is set to ignored, jobs will be delayed until the app is in the foreground. The same semantics as background check for O apps will apply, which means power whitelisted apps can still run jobs freely and apps will have some settle time after going to background after which their jobs will be stopped. Test: Added AppOpsUpgradeTest for upgrading appops to inherit existing value of OP_RUN_ANY_IN_BACKGROUND from OP_RUN_IN_BACKGROUND Added backgroundRestrictionsTest for background jobs. To run the test: mmm -j32 services/tests/servicestests/ adb install -r \ out/target/product/marlin/data/app/JobTestApp/JobTestApp.apk adb install -r \ out/target/product/marlin/data/app/FrameworksServicesTests/FrameworksServicesTests.apk adb shell am instrument -e class 'com.android.server.job.BackgroundRestrictionsTest' -w 'com.android.frameworks.servicestests/android.support.test.runner.AndroidJUnitRunner' Bug: 63001625 Change-Id: I6eb01adb6cd2c1d0e7be4f7eca960f57ad9581bf
/frameworks/base/services/tests/servicestests/test-apps/JobTestApp/src/com/android/servicestests/apps/jobtestapp/TestJobService.java
|