Prevent LAST_MODIFIED from changing after deletion

Previously LAST_MODIFIED is updated every time any modification is done
to a row, even if it is marked as deleted. A deleted row should not
be changed other then undeleting it, but it is hard to enforce this
on existing clients. Instead, LAST_MODIFIED will freeze at the moment
it was deleted.

In this CL, before the values are updated a separate query will update
LAST_MODIFIED for all rows that will be affected, unless it is already
marked as deleted. If a update will unmark the rows as deleted, a rows
will have its' LAST_MODIFIED updated.

Fixes: 31975372
Test: runtest contactsprov
Note: In the current master most of the contacts provider tests are
    broken due to UserManager changed to use getApplicationContext()
    on its' constructor, which is not mocked by the test context.
    This CL is tested with the change reverted.

Change-Id: I7ce1e98fa14932c50e84bb9ef6b2549e93faddc4
5 files changed