Don't test for home behavior when not present

On certain multi-window devices, it's not guaranteed that the device
will end up back at home when finishing a particular activity.
Therefore, check if the device has transitioned to home before testing
for behavior that depends on this.

Bug: 394172238
Test: atest android.app.cts.ActivityManagerTest
Flag: TEST_ONLY
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:6a2be5a0aae0f67d0b6f6b3a3f308cc5237fff54)
Merged-In: I88ef1adf4eecb972bb4b5115fe29c979b34e3b81
Change-Id: I30cda27297cebdb8a501157e863eb273f8a9eaee
1 file changed