Skip to content

Commit e44a64e

Browse files
vincent.cw_leeluca020400
authored andcommitted
Fix: "Clear All" recent app screen loop bug
The previous commit solves the issue that users can not swipe an app away from recent apps if it was exited with the back button. (see f59b813 Fix: Recent Apps not closing) However, it still has a similar problem in the case of users press the clear all button. Because the method removeAllVisibleTasks() will remove the task record from recent tasks in an earlier stage, so removeTaskByIdLocked() can not get the task record from either task stacks or recent tasks and notifyTaskStackChanged() will not be invoked. Solution: Call notifyTaskStackChanged as well for the non-existent task Test: 1. Clear all apps from recent apps first and make sure the list is emptied 2. Open an app and exit with back button 3. Go to recent apps and press the clear all button 4. Open recent apps again and the app should be removed from the list Bug: https://issuetracker.google.com/issues/137386250 Change-Id: I7ffd36fe7760b9f087e26c768219d7e7a5f12807 (cherry picked from commit a36beab)
1 parent d7c3493 commit e44a64e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

services/core/java/com/android/server/wm/ActivityStackSupervisor.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1639,8 +1639,13 @@ public void onRecentTaskRemoved(Task task, boolean wasTrimmed, boolean killProce
16391639
if (wasTrimmed) {
16401640
// Task was trimmed from the recent tasks list -- remove the active task record as well
16411641
// since the user won't really be able to go back to it
1642-
removeTaskById(task.mTaskId, killProcess, false /* removeFromRecents */,
1643-
"recent-task-trimmed");
1642+
boolean res = removeTaskById(task.mTaskId, killProcess,
1643+
false /* removeFromRecents */, "recent-task-trimmed");
1644+
1645+
// Notify task stack changes for the non-existent task
1646+
if (!res) {
1647+
mService.getTaskChangeNotificationController().notifyTaskStackChanged();
1648+
}
16441649
}
16451650
task.removedFromRecents();
16461651
}

0 commit comments

Comments
 (0)