Fix ActivityEmbedding flicker test flakiness
The AE backstack restoration is now enabled by default for field test.
The test application was not following the guideline and was adding
the embedding rules after Activity created. Adding more check to
abort the restoration as early as possible. The changes includes:
- Abort the restoration earlier if the Task is no longer existed
in the WM Core.
- Also checking if the restoration should be aborted in #postCreated
- Start the task root activity only if the Task is empty after the
legacy TaskFragments are removed.
Bug: 371083896
Bug: 289875940
Test: OpenActivityEmbeddingSecondaryToSplitTest
Flag: com.android.window.flags.ae_back_stack_restore
Change-Id: Iefebfc6b6e70edddeb0e078429b65b826885daef
3 files changed