Skip to content

Commit 1a83b36

Browse files
peitao1986hyperb1iss
authored andcommitted
am: Account for time changes when showing recent activities
[Procedures] 1. Go to Settings->Date&Time Set time backwards, eg. 2016.6.15 -> 2016.6.10 2. Tap recent apps button to show recent activities. There will be no activities shown. Change-Id: Ifd860c0d08fac49f9d3c8eac590b6db9e6afb09d
1 parent 8b088b6 commit 1a83b36

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4230,7 +4230,8 @@ void getTasksLocked(List<RunningTaskInfo> list, int callingUid, boolean allowed)
42304230
if (focusedStack && topTask) {
42314231
// Give the latest time to ensure foreground task can be sorted
42324232
// at the first, because lastActiveTime of creating task is 0.
4233-
ci.lastActiveTime = System.currentTimeMillis();
4233+
// Only do this if the clock didn't run backwards, though.
4234+
ci.lastActiveTime = Math.max(ci.lastActiveTime, System.currentTimeMillis());
42344235
topTask = false;
42354236
}
42364237

0 commit comments

Comments
 (0)