Fix deadlock opportunity.

The Profile provider was not synchronizing all transactions on the
contacts DB as it needed to.  During commit, most transactions were
doing queries on the contacts DB.  As a result, a profile op thread
could have a profile lock and then try to get a contact lock, and
contact op threads could have a contact lock and try to get a profile
lock while updating provider status.

Ensuring that all transactions first require a lock on the contacts
DB avoids the deadlock scenario.

Bug 5381085

Change-Id: I832e075ea37f0d650187b8ec067677ccee75a838
1 file changed