private static void onRecentTaskAdded(Object[] args) {
        XTask tr = XTaskHelper.toXTask(args[0]);
        XLog.i("RecentTaskHooks onRecentTaskAdded: %s", tr);
        BootStrap.THANOS_X.getActivityManagerService().notifyTaskCreated(tr.getTaskId(), tr.getIntent().getComponent());
    }
We use this hook to listen for task add and removal.
android/android_framework/patch-magisk/patch-framework/src/main/java/github/tornaco/thanox/android/server/patch/framework/hooks/wm/RecentTaskHooks.java