Fix a race condition in acquiring content provider

Client could be stuck at the lock before toggling the waiting flag,
meanwhile the publishing of the provider could been holding the lock
and check that flag, thus result in not notifying the client.

Now setting the flag with the global lock held.

Bug: 186228106
Bug: 190034355
Test: atest CtsContentTestCases:android.content.cts
Test: atest FrameworksCoreTests:android.content
Change-Id: I7c7a3326c302cc01e52a9a5d78ea9d089be0dcae
1 file changed