Fixes and cleanup for transactions.

- Make the thread-local transaction shared between the contacts and
  profile providers (as the implementation intended).
- Remove a bunch of extraneous variables from the contacts provider.
- Ensure that the profile provider switches the delegate into profile
  mode before running onBegin() or onCommit().
- Port the fix for applying contact changes to the profile DB.
- Fix an issue with profile aggregation after the profile has been
  deleted.
- Addressed a case in which we would create (and possibly hold onto)
  a profile DB transaction erroneously.
- Ported fix for aggregation when raw contacts are deleted.

Bug 5320369

Change-Id: I1f36d4c87c6b655dfcb5e339f151d3bf1d37a437
4 files changed