This is a major performance improvement for inserting large numbers (hundreds or thousands) of Notes.
Added support for bulkInsert() to the content provider as well as the API (addNewNotes). This will work with existing provider but new provider implementation is much faster.
Added support for inserting a new note into a deck with one provider call (instead of three in existing API implementation) to the provider's insert() method. Again, this will work with existing provider, but new provider implementation is about 39% faster.
Added API support for updating an existing note: updateNote() and updateNoteTags(). (This is already supported by existing provider).
Added API support for counting number of notes (with a certain model id) in a deck: countNotes(). I couldn't see a way to count notes in a deck while ignoring model id. (This is already supported by existing provider).
Added provider support for "count(*)" column in projection.
Added a meta-data key to the provider (in manifest) so that the API can query whether the provider supports these new features.
Here are the stats from my testing on a Nexus 6P (6.0.1):
Insert 2122 notes (same model (three fields), same deck, single card)
Ankidroid v.20600116 (3 provider calls per note): 191secs
Rewrote as single provider call per note: 138secs
Rewrote as single provider call in total (bulk insert): 119secs
This PR: single provider call in total (bulk insert, single transaction):
Ignore duplicates (empty deck): 44secs
Ignore duplicates (deck already contains 2122 notes, so none added): 34secs
No duplicate check (empty deck): 8.5secs