ContactsProvider: make lookupAndCacheId() synchronized

ContactProvider insert a new mimetype to database if
it's not found in db, but an error is observed that
column mimetype is not unique when inserting.
It's a concurrency error when multiple threads are
executing lookupAndCacheId() synchronously,
so we make this method synchronized to guarantee
that query and insert will be executed atomically.

Change-Id: I1d7006bb0dadef159be64525985a93d68f79704b
Signed-off-by: Leavitt Zhang <leavittz@nvidia.com>