summaryrefslogtreecommitdiffstats
path: root/services/tests
diff options
context:
space:
mode:
authorMatthew Williams <mjwilliams@google.com>2014-09-23 13:39:36 -0700
committerMatthew Williams <mjwilliams@google.com>2014-09-23 17:34:46 -0700
commit48a30db75dd0eedf8e065c89825b2af86a381b62 (patch)
tree5fd56bfd2acd997a623f9603c64a29aa2c5ed113 /services/tests
parentf7efd5c6a815b65e5401d51e0e9aae0f459eed72 (diff)
downloadframeworks_base-48a30db75dd0eedf8e065c89825b2af86a381b62.zip
frameworks_base-48a30db75dd0eedf8e065c89825b2af86a381b62.tar.gz
frameworks_base-48a30db75dd0eedf8e065c89825b2af86a381b62.tar.bz2
Fix lock ordering in JobScheduler
BUG: 17625667 Two part clean-up. 1) Don't try to lock in onControllerStateChanged. Do it in the handleMessage instead where the rest of the locking is. This is sufficient to fix this bug. 2) The other side of the deadlock came b/c we lock when cancelling and calling stopTrackingJob. Controllers handle their own locking so this isn't necessary. B/c of a potential race from the controller side, added an explicit check for the JSS to only run an expired job if it still exists. Change-Id: Iaeebbc19437eb5b73e3ced3168f1fc13e564a4be
Diffstat (limited to 'services/tests')
-rw-r--r--services/tests/servicestests/src/com/android/server/job/JobStoreTest.java4
1 files changed, 3 insertions, 1 deletions
diff --git a/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java b/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java
index 402f0dd..bd64392 100644
--- a/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java
+++ b/services/tests/servicestests/src/com/android/server/job/JobStoreTest.java
@@ -67,6 +67,7 @@ public class JobStoreTest extends AndroidTestCase {
assertEquals("Didn't get expected number of persisted tasks.", 1, jobStatusSet.size());
final JobStatus loadedTaskStatus = jobStatusSet.iterator().next();
assertTasksEqual(task, loadedTaskStatus.getJob());
+ assertTrue("JobStore#contains invalid.", mTaskStoreUnderTest.containsJob(ts));
assertEquals("Different uids.", SOME_UID, loadedTaskStatus.getUid());
compareTimestampsSubjectToIoLatency("Early run-times not the same after read.",
ts.getEarliestRunTime(), loadedTaskStatus.getEarliestRunTime());
@@ -103,7 +104,8 @@ public class JobStoreTest extends AndroidTestCase {
JobStatus loaded2 = it.next();
assertTasksEqual(task1, loaded1.getJob());
assertTasksEqual(task2, loaded2.getJob());
-
+ assertTrue("JobStore#contains invalid.", mTaskStoreUnderTest.containsJob(taskStatus1));
+ assertTrue("JobStore#contains invalid.", mTaskStoreUnderTest.containsJob(taskStatus2));
// Check that the loaded task has the correct runtimes.
compareTimestampsSubjectToIoLatency("Early run-times not the same after read.",
taskStatus1.getEarliestRunTime(), loaded1.getEarliestRunTime());