Fixed a few issues with ActivityManagerPinnedStackTests test class

Wait for stacks in activity manager and window manager to have the
same value before proceeding with the state information we got as
there could be a transition running when we got the state information
separately from AM and WM.
Also cleaned up the test some.

Bug: 26982333
Bug: 26982215
Change-Id: I1b3bdea75d180d7db026967ae77bfd8a901baa1b
3 files changed