Add null check to cleanupRecentTasksLocked.

If during boot, the package manager broadcast occurs before
TaskPersister has restored the recents list then mRecentTasks will be
null and an NPE will occur. This checks for null mRecentsTasks and
returns before the NPE happens.

Fixes bug 17300409.

Change-Id: I1588ad3a3c0d04bc6f273630ef5dadf6821e5710
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 972a86d..6ca536c 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3816,6 +3816,11 @@
      * of affiliations.
      */
     void cleanupRecentTasksLocked(int userId) {
+        if (mRecentTasks == null) {
+            // Happens when called from the packagemanager broadcast before boot.
+            return;
+        }
+
         final HashMap<ComponentName, ActivityInfo> availActCache = new HashMap<>();
         final HashMap<String, ApplicationInfo> availAppCache = new HashMap<>();
         final IPackageManager pm = AppGlobals.getPackageManager();