Loading services/tests/servicestests/src/com/android/server/job/BackgroundRestrictionsTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -71,7 +71,7 @@ public class BackgroundRestrictionsTest { private static final String TEST_APP_PACKAGE = "com.android.servicestests.apps.jobtestapp"; private static final String TEST_APP_PACKAGE = "com.android.servicestests.apps.jobtestapp"; private static final String TEST_APP_ACTIVITY = TEST_APP_PACKAGE + ".TestJobActivity"; private static final String TEST_APP_ACTIVITY = TEST_APP_PACKAGE + ".TestJobActivity"; private static final long POLL_INTERVAL = 500; private static final long POLL_INTERVAL = 500; private static final long DEFAULT_WAIT_TIMEOUT = 5000; private static final long DEFAULT_WAIT_TIMEOUT = 10_000; private Context mContext; private Context mContext; private AppOpsManager mAppOpsManager; private AppOpsManager mAppOpsManager; Loading services/tests/servicestests/test-apps/JobTestApp/src/com/android/servicestests/apps/jobtestapp/TestJobService.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,8 @@ public class TestJobService extends JobService { public boolean onStartJob(JobParameters params) { public boolean onStartJob(JobParameters params) { Log.i(TAG, "Test job executing: " + params.getJobId()); Log.i(TAG, "Test job executing: " + params.getJobId()); Intent reportJobStartIntent = new Intent(ACTION_JOB_STARTED); Intent reportJobStartIntent = new Intent(ACTION_JOB_STARTED); reportJobStartIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params); reportJobStartIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params) .addFlags(Intent.FLAG_RECEIVER_FOREGROUND); sendBroadcast(reportJobStartIntent); sendBroadcast(reportJobStartIntent); return true; return true; } } Loading @@ -43,7 +44,8 @@ public class TestJobService extends JobService { public boolean onStopJob(JobParameters params) { public boolean onStopJob(JobParameters params) { Log.i(TAG, "Test job stopped executing: " + params.getJobId()); Log.i(TAG, "Test job stopped executing: " + params.getJobId()); Intent reportJobStopIntent = new Intent(ACTION_JOB_STOPPED); Intent reportJobStopIntent = new Intent(ACTION_JOB_STOPPED); reportJobStopIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params); reportJobStopIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params) .addFlags(Intent.FLAG_RECEIVER_FOREGROUND); sendBroadcast(reportJobStopIntent); sendBroadcast(reportJobStopIntent); // Deadline constraint is dropped on reschedule, so it's more reliable to use a new job. // Deadline constraint is dropped on reschedule, so it's more reliable to use a new job. return false; return false; Loading Loading
services/tests/servicestests/src/com/android/server/job/BackgroundRestrictionsTest.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -71,7 +71,7 @@ public class BackgroundRestrictionsTest { private static final String TEST_APP_PACKAGE = "com.android.servicestests.apps.jobtestapp"; private static final String TEST_APP_PACKAGE = "com.android.servicestests.apps.jobtestapp"; private static final String TEST_APP_ACTIVITY = TEST_APP_PACKAGE + ".TestJobActivity"; private static final String TEST_APP_ACTIVITY = TEST_APP_PACKAGE + ".TestJobActivity"; private static final long POLL_INTERVAL = 500; private static final long POLL_INTERVAL = 500; private static final long DEFAULT_WAIT_TIMEOUT = 5000; private static final long DEFAULT_WAIT_TIMEOUT = 10_000; private Context mContext; private Context mContext; private AppOpsManager mAppOpsManager; private AppOpsManager mAppOpsManager; Loading
services/tests/servicestests/test-apps/JobTestApp/src/com/android/servicestests/apps/jobtestapp/TestJobService.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -34,7 +34,8 @@ public class TestJobService extends JobService { public boolean onStartJob(JobParameters params) { public boolean onStartJob(JobParameters params) { Log.i(TAG, "Test job executing: " + params.getJobId()); Log.i(TAG, "Test job executing: " + params.getJobId()); Intent reportJobStartIntent = new Intent(ACTION_JOB_STARTED); Intent reportJobStartIntent = new Intent(ACTION_JOB_STARTED); reportJobStartIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params); reportJobStartIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params) .addFlags(Intent.FLAG_RECEIVER_FOREGROUND); sendBroadcast(reportJobStartIntent); sendBroadcast(reportJobStartIntent); return true; return true; } } Loading @@ -43,7 +44,8 @@ public class TestJobService extends JobService { public boolean onStopJob(JobParameters params) { public boolean onStopJob(JobParameters params) { Log.i(TAG, "Test job stopped executing: " + params.getJobId()); Log.i(TAG, "Test job stopped executing: " + params.getJobId()); Intent reportJobStopIntent = new Intent(ACTION_JOB_STOPPED); Intent reportJobStopIntent = new Intent(ACTION_JOB_STOPPED); reportJobStopIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params); reportJobStopIntent.putExtra(JOB_PARAMS_EXTRA_KEY, params) .addFlags(Intent.FLAG_RECEIVER_FOREGROUND); sendBroadcast(reportJobStopIntent); sendBroadcast(reportJobStopIntent); // Deadline constraint is dropped on reschedule, so it's more reliable to use a new job. // Deadline constraint is dropped on reschedule, so it's more reliable to use a new job. return false; return false; Loading