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
// 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);