OSDN Git Service

Don't kill process when dismissing stack
authorJorim Jaggi <jjaggi@google.com>
Fri, 6 Nov 2015 19:54:50 +0000 (20:54 +0100)
committerJorim Jaggi <jjaggi@google.com>
Fri, 6 Nov 2015 20:23:23 +0000 (20:23 +0000)
Also clear the binder identity to incorrect permission
checks, which lead to crashes when dismissing the docked
stack.

Change-Id: I53175769745e8bbdbc296806b9297eb3c53d4452

services/core/java/com/android/server/am/ActivityManagerService.java

index e27dba6..e13d3e7 100644 (file)
@@ -17444,14 +17444,16 @@ public final class ActivityManagerService extends ActivityManagerNative
             throw new IllegalArgumentException("Removing home stack is not allowed.");
         }
         synchronized (this) {
+            long origId = Binder.clearCallingIdentity();
             ActivityStack stack = mStackSupervisor.getStack(stackId);
             if (stack != null) {
                 ArrayList<TaskRecord> tasks = stack.getAllTasks();
                 for (int i = tasks.size() - 1; i >= 0; i--) {
-                    removeTaskByIdLocked(tasks.get(i).taskId, true /* killProcess */,
+                    removeTaskByIdLocked(tasks.get(i).taskId, false /* killProcess */,
                             !REMOVE_FROM_RECENTS);
                 }
             }
+            Binder.restoreCallingIdentity(origId);
         }
     }