Stabilise BottomSheet tests by waiting for test to reach expected state

Also, follow IdlingResource best coding practices by unregistering the
resource as well. UnRegister IdlingResource in try-finally block, this
helps only fail bottomsheet tests and leaves other tests unaffected.

Bug: 211075693
Test: atest com.android.providers.media.photopicker.espresso

Change-Id: Ia1340c2b67c4ff9d4ace1bc633f2b05491ec45ea
5 files changed