VoiceInteraction: Fix testVoiceInteractorDestroy flakiness.

The test activity checks that the interactor is properly marked destroyed in
the callback that executes when the interactor is destroyed. There is a race
condition because there's no synchronization between
VoiceInteractor.destroy() and the accessors on VoiceInteractor/Activity.

With this change, the accessors are polled until the values update.

Also moves these checks out of the onDestroyedCallback; there's no reason to
keep them there and it's a bit more readable with them moved out.

Bug: 178325554
Test: atest CtsVoiceInteractionTestCases --iterations
Change-Id: I000ace2f207473eafad3e2ca48a6b279883a6d0a
2 files changed