More improve IME transition during task switch

This CL aims to optimize the previous CL[1] to schedule removing
tasksnapshot after a fixed timeout according the tasksnapshot:
    - With IME snapshot: 350ms
    - Without IME snapshot: 100ms

As the previous approach has some cons espically when the tasksnapshot
has IME shown:
1) It lacks a signal or callback to notify WmShell to dismiss
tasksnapshot when IME is actually drawn on the task and always
dismissed after the timeout.

2) The timing to schedule tasksnapsit removal is when
ActivityRecord#onWindowFirstDrawn, which is much eariler than the
window focused (about 100-150ms), and it may easier to see flickering
when the task is showing IME.

The reason is that IME is drawn after window focused and started input
connection. Also, starts from R, IME insets visiblity
is handled by the app's UI thread, so if the schedule removal timing
been triggered too early and if IME / App takes more time to handle IME
surface layout, then user might aware the app task flickering when
tasksnapshot dismissed, since IME is not yet be drawn and then it
show up again when the next layout finished.

In this CL, we made the following changes to improve the above cons
- Postpone the schedule removing tasksnapshot (with IME) timing to
  after the app task has focused.
- Modify the tasksnapshot removal timeout (with IME)  from 350ms to
  450ms (with renaming to MAX_DELAY_REMOVAL_TIME_IME_VISIBLE),
  in case some edge cases may take longer time to process IME layout.
- add ITaskOrganizer#onImeDrawnOnTask(taskId) to notify the shell
  task organizer to properly remove the tasksnapshot without waiting
  until the max timeout.

[1]:  I5fb0fa3a1e6a5e6210d3baf400a84c5892bd2e34

Fix: 192065018
Test: ateset StartingSurfaceDrawerTests#\
        testRemoveTaskSnapshotWithImeSurfaceWhenOnImeDrawn
Test: manual tests by
   1) launching Android Message with focusing an editor
   2) swiping out to home and launch another apps (e.g. chrome)
   3) swiping up to overview, tapping Android Message task
   4) verify if IME is flickering after switched back.
Change-Id: I81031f64966b1aeb55cc09f381d4d83ec3460dc9
12 files changed