Track closing tasks so we don't inadvertently hide the leash

- When quickswitching quickly between the same apps, we end up with
  a scenario where we are closing the pausing app (that we are
  initially swiping up from),and also reopening it (from quickswitching
  back to that task).  Currently, the task is untracked (it gets
  removed when a pausing task is closed, yet is still visible on
  screen) and when we receive a new open transition for it, we assume
  the opening is from a hidden state.

  This change just keeps track of these visible-but-closing tasks
  to ensure that we don't inadvertently hide the leash before notifying
  launcher of the new task.

Bug: 296242449
Test: Quickswitch quickly between tasks such that we relaunch a pausing/
      closed task

Change-Id: Iaf8ec9119b9429b264d8a38f8722059c36273a7a
1 file changed