From ccbb4f3bf3a84172a1c8da9dc8ef4e00d6e92042 Mon Sep 17 00:00:00 2001 From: Kevin Date: Wed, 27 Feb 2019 12:16:37 -0800 Subject: [PATCH] Fix RecentTasksList change id incrementing The change id in RecentTasksList would never actually increment as we never register it as a TaskStackListener. As a result, we always execute the result callback immediately when getting a task and the task list is always valid. In addition, when the list IS up to date, we still fetch the list again in the background when we should instead just return early. This CL addresses both of these issues. Test: Added logs to see that task loading wasn't happening when lists are the same Change-Id: I228f8d7cd3cb22ef88d71e1bee40708c2bcf26d6 --- quickstep/src/com/android/quickstep/RecentTasksList.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java index 00b3e90938..e15a3f1ca1 100644 --- a/quickstep/src/com/android/quickstep/RecentTasksList.java +++ b/quickstep/src/com/android/quickstep/RecentTasksList.java @@ -60,6 +60,7 @@ public class RecentTasksList extends TaskStackChangeListener { mBgThreadExecutor = BackgroundExecutor.get(); mKeyguardManager = new KeyguardManagerCompat(context); mChangeId = 1; + ActivityManagerWrapper.getInstance().registerTaskStackListener(this); } /** @@ -97,6 +98,7 @@ public class RecentTasksList extends TaskStackChangeListener { if (mLastLoadedId == mChangeId && (!mLastLoadHadKeysOnly || loadKeysOnly)) { // The list is up to date, callback with the same list mMainThreadExecutor.execute(resultCallback); + return requestLoadId; } // Kick off task loading in the background