Merge "Call method while holding lock." into lmp-dev
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 0ad36fc..275185a 100755
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -3695,7 +3695,7 @@
     }
 
     //explicitly remove thd old information in mRecentTasks when removing existing user.
-    private void removeRecentTasksForUser(int userId) {
+    private void removeRecentTasksForUserLocked(int userId) {
         if(userId <= 0) {
             Slog.i(TAG, "Can't remove recent task on user " + userId);
             return;
@@ -17724,10 +17724,10 @@
                 // Kill all the processes for the user.
                 forceStopUserLocked(userId, "finish user");
             }
-        }
 
-        // Explicitly remove the old information in mRecentTasks.
-        removeRecentTasksForUser(userId);
+            // Explicitly remove the old information in mRecentTasks.
+            removeRecentTasksForUserLocked(userId);
+        }
 
         for (int i=0; i<callbacks.size(); i++) {
             try {