Introduce QUERY_ARG_MATCH_* values for filtering.

The existing strategy of methods like setIncludePending() doesn't
scale well for callers to use multiple matching strategies.  For
example, callers are interested in these matching strategies:

MATCH_EXCLUDE: Ensure that any matches are excluded.
MATCH_INCLUDE: Ensure that any matches are included.
MATCH_ONLY: Return only exact matches.

The reason why we have this menu of options is because the underlying
fields have different default behavior.  For example, "trashed" items
are naturally excluded by default, but "favorite" items are naturally
included by default.

Callers only interesting in listing "trashed" items or "favorite"
items shouldn't need to perform their own inefficient Cursor diffing
logic, so we give them these flexible arguments.

Adjust MediaProvider internals to apply these matcher values to
all update() and delete() calls, in addition to query().

Bug: 143432502
Test: atest --test-mapping packages/providers/MediaProvider
Change-Id: I0d4bc063b8ea5ac2a602fab43a62c2de7724ba34
3 files changed