Wait for the task to be in recents before validation

- There are two issues:
  1) Currently the system does not add the task to the task list until
     the activity starting the task has been resumed (to be fixed in a
     follow up platform CL). When the three activities are started in
     sequence, it's possible for one of the activities to not reach the
     resumed state leading to an unexpected number of recent tasks the
     next time it's fetched.
  2) When swiping up, it may take time for getTasks to return and call
     applyLoadPlan, so try and wait until the task views have had a
     chance to be applied before continuing.
  3) Use the launcher activity tracker instead of activity rule since it
     will return the same activity even after the activity is destroyed
- Move the margin handling to the caller instead of the scroll method

Bug: 141580748
Change-Id: I2b7634f5ac6869ba4b369b3bd60e0f63747c0f0b
8 files changed