Initial changes to add callback on task stack changes. (Bug 17672056, Bug 18291345)

Add a listener to listen for changes in the Task stacks to preload thumbnails from the
system.  In addition, reduce the amount of synchronous work done in activity creation
and first measure/layout passes.

Change-Id: I8bd9155d7a05e89c190a20429acff69a17808208
diff --git a/services/core/java/com/android/server/am/TaskRecord.java b/services/core/java/com/android/server/am/TaskRecord.java
index ee93233..d726685 100644
--- a/services/core/java/com/android/server/am/TaskRecord.java
+++ b/services/core/java/com/android/server/am/TaskRecord.java
@@ -383,12 +383,12 @@
         setNextAffiliate(null);
     }
 
-    void removedFromRecents(TaskPersister persister) {
+    void removedFromRecents() {
         disposeThumbnail();
         closeRecentsChain();
         if (inRecents) {
             inRecents = false;
-            persister.wakeup(this, false);
+            mService.notifyTaskPersisterLocked(this, false);
         }
     }