Fix deadlock case when removing accounts.

The account cleanup flow generally operates on one database (either
contacts DB or profile DB), bringing the account set up-to-date with
the accounts that remain in the system.  However, the code was also
doing an update of the search index, which is bad in the profile case
because the search index is only associated with the contacts DB, and
threads must never ever open a profile transaction and then open a
contacts transaction (or deadlocks may occur).

This fixes the issue by skipping the pointless search index update if
in profile mode, but longer-term it would be good to get rid of code
that starts DB transactions outside of using ContactsTransaction.

Bug 5496295

Change-Id: Ieb4d42a21f85a85f18a4415463ea7c8dd3cc2477
1 file changed