Use RecentTasksListener to trigger TopTaskTracker

Currently launcher gets task stack updates through WM core. Ideally we
would like to migrate into a model where launcher gets these updates
through shell instead.

Test: Manually check that the correct task info is delivered to launcher
from shell
Bug: 341932484
Bug: 344684650
Flag: NONE Just adding a listener, no logic added

Change-Id: Iaf534a4bfee968138d4a4ff282a66e62759af2c0
This commit is contained in:
Orhan Uysal committed 2024-06-11 21:00:22 +00:00
1 parent c22a8e7495
commit c948537a82
4 files changed
+18 -8

No files matched your search

@@ -75,7 +75,7 @@ public class RecentTasksList {
private ArrayList<ActivityManager.RunningTaskInfo> mRunningTasks;
public RecentTasksList(LooperExecutor mainThreadExecutor, KeyguardManager keyguardManager,
SystemUiProxy sysUiProxy) {
SystemUiProxy sysUiProxy, TopTaskTracker topTaskTracker) {
mMainThreadExecutor = mainThreadExecutor;
mKeyguardManager = keyguardManager;
mChangeId = 1;
@@ -106,6 +106,13 @@ public class RecentTasksList {
RecentTasksList.this.onRunningTaskChanged(taskInfo);
});
}
@Override
public void onTaskMovedToFront(ActivityManager.RunningTaskInfo taskInfo) {
mMainThreadExecutor.execute(() -> {
topTaskTracker.onTaskMovedToFront(taskInfo);
});
}
});
// We may receive onRunningTaskAppeared events later for tasks which have already been
// included in the list returned by mSysUiProxy.getRunningTasks(), or may receive
@@ -135,7 +142,7 @@ public class RecentTasksList {
* Asynchronously fetches the list of recent tasks, reusing cached list if available.
*
* @param loadKeysOnly Whether to load other associated task data, or just the key
* @param callback The callback to receive the list of recent tasks
* @param callback The callback to receive the list of recent tasks
* @return The change id of the current task list
*/
public synchronized int getTasks(boolean loadKeysOnly,
@@ -200,7 +207,7 @@ public class RecentTasksList {
mChangeId++;
}
/**
/**
* Registers a listener for running tasks
*/
public void registerRunningTasksListener(RecentsModel.RunningTasksListener listener) {