Fix deletion of least-recently-used external databases.

The present external database LRU garbage collector mistakenly includes
SQLite temporary files, including those associated with the internal
database, as distinct external databases.  This leads to a number of
problems, including partial deletion of databases and/or their temporary
files and early deletion of databases before the MAX_EXTERNAL_DATABASES
limit is reached.  In short, the present code works only, and
coincidentally, in a single circumstance: when there is an internal
database and _exactly one_ external database.

This fixes the above problem by removing SQLite temporary files from the
list of candidate databases.

Note, the actual bug here is in the android.app.ContextImpl::databaseList
method, which return SQLite temporary files as part of a context's
"database list" instead of hiding them and handling their deletion
internally.  However, since these methods are part of the Android public
API and used by third-party apps, the present fix is implemented in
MediaProvider only.  Should the Context database API be altered, this fix
will be made redundant but remain unharmful.

Change-Id: I222255babf02b437d9ab7109a5fb1396bd38a9dd
MediaProvider: allow write access to external SD

Without this, Gallery cannot delete photos on external SD.

Change-Id: Ifbebcdb167cca92a5a05158fa4c8b81512b77ba6