Fix race condition of lazy service binding

There is a race condition introduced by service binding and api calls,
checkAttention and onStartProximityUpdates. Fixing the race condition by
introducing a CountDownLatch that gets counted down on service binding
and reinitialized on service unbinding.

Bug: 219525510
Test: atest CtsAttentionServiceDeviceTestCases
Commented out and tested individual test at a time. Previous tests that
failed individually such as CheckAttentionSuccess or
ProximityUpdatesSuccess pass.

Change-Id: I168b325c65e8d82767f278c65d62268afa4060a1
(cherry picked from commit f6d7d7a7900bab48269704a6bdea2b95750b43ef)
1 file changed