Do mimetype filtering based on ID.

Wherever the provider is doing a query based on the mimetype, we can
optimize the SQL performance by switching in the (cached) mimetype ID
and joining against that instead.

Also fixed an issue that was likely leading to hi-res photos being
blown away during photo cleanup.

Bug:5289712
Change-Id: Ic51e4c6b0e5daa8b7a2440692755fd87d387f3f3
2 files changed