OSDN Git Service

Fix crash in starting lock task
authorJason Monk <jmonk@google.com>
Mon, 23 Jun 2014 20:30:20 +0000 (16:30 -0400)
committerJason Monk <jmonk@google.com>
Fri, 27 Jun 2014 14:11:56 +0000 (10:11 -0400)
Sometimes when coming from a dialog the current activity has changed,
which causes AM to crash and take down the framework.  Instead don't
check the current activity as the user has confirmed the operation
so it is not coming from the background.

Change-Id: I0daeabcfcf814c52bcc7907a624fe6e9453c427f

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

index 9cd5091..c514cdf 100644 (file)
@@ -7768,7 +7768,8 @@ public final class ActivityManagerService extends ActivityManagerNative
                 // Since we lost lock on task, make sure it is still there.
                 task = mStackSupervisor.anyTaskForIdLocked(task.taskId);
                 if (task != null) {
-                    if ((mFocusedActivity == null) || (task != mFocusedActivity.task)) {
+                    if (!isSystemInitiated
+                            && ((mFocusedActivity == null) || (task != mFocusedActivity.task))) {
                         throw new IllegalArgumentException("Invalid task, not in foreground");
                     }
                     mStackSupervisor.setLockTaskModeLocked(task, isSystemInitiated);