summaryrefslogtreecommitdiffstats
path: root/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp
diff options
context:
space:
mode:
authorMatthew Williams <mjwilliams@google.com>2014-09-10 17:32:18 -0700
committerMatthew Williams <mjwilliams@google.com>2014-09-10 17:32:18 -0700
commit03a4da6e8e92b19c1345016c06694cb3aabbfc27 (patch)
tree4a3e0ca61ef6412590648037ba33638195346601 /tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp
parent1b848d4894b3aa82d2fcae605acbede3f865456e (diff)
downloadframeworks_base-03a4da6e8e92b19c1345016c06694cb3aabbfc27.zip
frameworks_base-03a4da6e8e92b19c1345016c06694cb3aabbfc27.tar.gz
frameworks_base-03a4da6e8e92b19c1345016c06694cb3aabbfc27.tar.bz2
Add flag to JobParameters for job expired
BUG: 17424511 Introduce an "isOverrideDeadlineExpired" which will allow clients to know when they are being run due to an expiry. Nb that we check deadline expiry by checking that the constraints on the job are not satisfied at execution time. Really this is the same thing, as a job will not be run without its constraints being met, unless the job has expired. Change-Id: I4b91e5b5eadccabd91296d5a5ca66b859dbfaf5c
Diffstat (limited to 'tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp')
-rw-r--r--tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java11
1 files changed, 8 insertions, 3 deletions
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 a68e04e..9df11fe 100644
--- a/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
+++ b/tests/JobSchedulerTestApp/src/com/android/demo/jobSchedulerApp/service/TestJobService.java
@@ -29,6 +29,7 @@ import android.os.Messenger;
import android.os.RemoteException;
import android.util.Log;
import android.util.SparseArray;
+import android.widget.Toast;
import com.android.demo.jobSchedulerApp.MainActivity;
@@ -84,12 +85,15 @@ public class TestJobService extends JobService {
currentId++;
jobParamsMap.put(currentId, params);
final int currId = this.currentId;
- Log.d(TAG, "putting :" + currId + " for " + params.toString());
- Log.d(TAG, " pulled: " + jobParamsMap.get(currId));
if (mActivity != null) {
mActivity.onReceivedStartJob(params);
}
+ Toast.makeText(
+ this, "On start job: '" + params.getJobId() + "' deadline exceeded: " +
+ params.isOverrideDeadlineExpired(),
+ Toast.LENGTH_LONG).show();
+
return true;
}
@@ -100,7 +104,7 @@ public class TestJobService extends JobService {
int ind = jobParamsMap.indexOfValue(params);
jobParamsMap.remove(ind);
mActivity.onReceivedStopJob();
- return true;
+ return false; // no reschedule
}
static int currentId = 0;
@@ -129,6 +133,7 @@ public class TestJobService extends JobService {
return false;
} else {
jobFinished(params, false);
+ jobParamsMap.removeAt(0);
return true;
}
}