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
diff --git a/quickstep/src/com/android/quickstep/RecentTasksList.java b/quickstep/src/com/android/quickstep/RecentTasksList.java
index 00b3e90..e15a3f1 100644
--- a/quickstep/src/com/android/quickstep/RecentTasksList.java
+++ b/quickstep/src/com/android/quickstep/RecentTasksList.java
@@ -60,6 +60,7 @@
mBgThreadExecutor = BackgroundExecutor.get();
mKeyguardManager = new KeyguardManagerCompat(context);
mChangeId = 1;
+ ActivityManagerWrapper.getInstance().registerTaskStackListener(this);
}
/**
@@ -97,6 +98,7 @@
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