Let assume we have two activities.
A - main activity, that is "home launcher enabled" (proper intent filters etc.)
B - task root activity with singleTask specification (there can be only one instance of this activity) and with custom taskAffinity (to differentiate if from the main task root).
Let assume that B represents a task, that is valid only when it is not finished - returning to it or starting it again from recent tasks after finishing it is not an option.
In some point of the time - A starts B to begin a new task. The goal is to remove B from recent task list when user finishes B. User may navigate from B to other tasks (using home long press) and then navigate back to B as long as it is not finished. Launching A from launcher won't bring B to the foreground as they have different task affinities.
Android recognizes B as a root of a task, thus B is visible in the recent tasks list even if it is finished, and user can always go back to it. It is not a solution to move B to the one task with A, because in the time B is running - user should be able to switch between A and B tasks. Adding excludeFromRecents to B's manifest removes it completely from recent tasks list, and it is bad solution too.
How to achieve it? (sorry for my bad english)