summaryrefslogtreecommitdiffstats
path: root/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp
diff options
context:
space:
mode:
authorMatthew Williams <mjwilliams@google.com>2014-08-21 13:47:47 -0700
committerMatthew Williams <mjwilliams@google.com>2014-08-21 20:28:12 -0700
commit9ae3dbeefcd6bc139c74bfe3d51de823e3be4b4b (patch)
tree9091f11de601187a418a60d579035a2edeb3a33d /tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp
parentbfecd904bf0ea8875caaaaafa5e3ae8c44b5175f (diff)
downloadframeworks_base-9ae3dbeefcd6bc139c74bfe3d51de823e3be4b4b.zip
frameworks_base-9ae3dbeefcd6bc139c74bfe3d51de823e3be4b4b.tar.gz
frameworks_base-9ae3dbeefcd6bc139c74bfe3d51de823e3be4b4b.tar.bz2
JobScheduler only run jobs for started users.
BUG: 12876556 Minor changes to test app to make persisting an option. Change-Id: I1b40347878ec5ca44cd717ebfeb544f6c58473b5
Diffstat (limited to 'tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp')
-rw-r--r--tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java5
-rw-r--r--tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java25
2 files changed, 4 insertions, 26 deletions
diff --git a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java
index e15929d..6e5484e 100644
--- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java
+++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/MainActivity.java
@@ -65,6 +65,8 @@ public class MainActivity extends Activity {
mAnyConnectivityRadioButton = (RadioButton) findViewById(R.id.checkbox_any);
mRequiresChargingCheckBox = (CheckBox) findViewById(R.id.checkbox_charging);
mRequiresIdleCheckbox = (CheckBox) findViewById(R.id.checkbox_idle);
+ mIsPersistedCheckbox = (CheckBox) findViewById(R.id.checkbox_persisted);
+
mServiceComponent = new ComponentName(this, TestJobService.class);
// Start service and provide it a way to communicate with us.
Intent startServiceIntent = new Intent(this, TestJobService.class);
@@ -85,6 +87,7 @@ public class MainActivity extends Activity {
RadioButton mAnyConnectivityRadioButton;
CheckBox mRequiresChargingCheckBox;
CheckBox mRequiresIdleCheckbox;
+ CheckBox mIsPersistedCheckbox;
ComponentName mServiceComponent;
/** Service object to interact scheduled jobs. */
@@ -146,7 +149,7 @@ public class MainActivity extends Activity {
}
builder.setRequiresDeviceIdle(mRequiresIdleCheckbox.isChecked());
builder.setRequiresCharging(mRequiresChargingCheckBox.isChecked());
-
+ builder.setIsPersisted(mIsPersistedCheckbox.isChecked());
mTestService.scheduleJob(builder.build());
}
diff --git a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
index e2c3be0..a68e04e 100644
--- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
+++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
@@ -90,31 +90,6 @@ public class TestJobService extends JobService {
mActivity.onReceivedStartJob(params);
}
- // Spin off a new task on a separate thread for a couple seconds.
- new AsyncTask<Void, Void, Void>() {
- @Override
- protected Void doInBackground(Void... voids) {
- try {
- Log.d(TAG, "Sleeping for 3 seconds.");
- Thread.sleep(3000L);
- } catch (InterruptedException e) {}
- final JobParameters params = jobParamsMap.get(currId);
- Log.d(TAG, "Pulled :" + currId + " " + params);
- jobFinished(params, false);
-
- Log.d(TAG, "Rescheduling new job: " + params.getJobId());
- scheduleJob(
- new JobInfo.Builder(params.getJobId(),
- new ComponentName(getBaseContext(), TestJobService.class))
- .setMinimumLatency(2000L)
- .setOverrideDeadline(3000L)
- .setRequiresCharging(true)
- .build()
- );
-
- return null;
- }
- }.execute();
return true;
}