Reconcile with jb-mr1-release

Change-Id: Idbdd25900489311c1d48c0bd6ef34c8c34c2d1e8
am ddafaadb: Explicitly export content providers

* commit 'ddafaadba3db45071e52391277ca0ac0bf5ce9dd':
  Explicitly export content providers
Reconcile with jb-mr1-release - do not merge

Change-Id: Ia1d2509ec937410d2bf6d6b1f81ddfca57d61567
am 71d93f39: (-s ours) Reconcile with jb-mr1-release - do not merge

* commit '71d93f3947eb6145ddb70289da7bf164f769ffb6':
Only set file size if the app didn't

This lets apps specify the eventual file size if it wants to,
while the provider will fill it in with the current file size
if the app didn't specify it.
b/6857704

Change-Id: Ide12957180a5826404821459368abd2de4f6d2ba
Merge "Only set file size if the app didn't"
Check external storage volume ID to ensure media is actually mounted.

Programs may request to media scan files (via MediaScannerConnection::scanFile)
before external storage is mounted.  If that happens, MediaProvider creates
an external-ffffffff.db (volume ID -1) database once external storage is
mounted, instead of the one with the expected volume ID.

Later, if android.process.media is killed and respawned, the real external
database (that is, the one corresponding to the actual external storage
volume ID) is attached.  At best, that database contains stale records.
However, in conjunction with another bug (where the LRU database garbage
collector prunes all but one external database), most often a new, empty
database is created.  This results in the sudden disappearance of all
ringtones and media from programs that depend on the media database.

Change-Id: Ie0bf72f700430a2744ad20669aed91e22c6d5d07
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
am 9b1fff74: Fix mediaprovider stats

* commit '9b1fff741d2dc2b5f64727417c1ae74a051f9b02':
  Fix mediaprovider stats
am dcbeb813: am 9b1fff74: Fix mediaprovider stats

* commit 'dcbeb813d0a88159202ad711209e90dfca1f596a':
  Fix mediaprovider stats
Reconcile with jb-mr1-release - do not merge

Change-Id: I317b42faec06d2263a72eca468ba9673f1bd4372
am 20eb840e: (-s ours) Reconcile with jb-mr1-release - do not merge

* commit '20eb840e930e0fe98e42882148da4547da569139':
am fda8379c: am f1597bc9: (-s ours) Merge "Fixed release of wakelock"

* commit 'fda8379c49cd45ef434d626532dc8d459fbabc5c':
  Fixed release of wakelock
am 3e0551d7: am fda8379c: am f1597bc9: (-s ours) Merge "Fixed release of wakelock"

* commit '3e0551d72e36691b7202ae55a125d667873ff1d7':
  Fixed release of wakelock
am b7fb6600: am 7021e104: Merge "MtpService: check primary storage status when use it in PTP mode"

* commit 'b7fb66005396514e11589cfcef4e3df346a09420':
  MtpService: check primary storage status when use it in PTP mode
am cfb9c213: am b7fb6600: am 7021e104: Merge "MtpService: check primary storage status when use it in PTP mode"

* commit 'cfb9c213d7bbcddae215f85343385adb9631a15d':
  MtpService: check primary storage status when use it in PTP mode
Reconcile with jb-mr1-release - do not merge

Change-Id: Idf52e01ae31e4f8665ff945fc53943906611e62e
am 4a10e73f: (-s ours) Reconcile with jb-mr1-release - do not merge

* commit '4a10e73f5803bbb6258fe2544157bc23bdff1155':
am 4a7bf688: Fix bug #7132595 Settings - UI mirroring for RTL locales (Arabic, Hebrew, farsi)

* commit '4a7bf688505af8daa7e7c3b4889520cf79a26a57':
  Fix bug #7132595 Settings - UI mirroring for RTL locales (Arabic, Hebrew, farsi)
am 395ad259: Include user identifier in external storage paths.

* commit '395ad2597601ccf285cfe679c7263a1b1feee231':
  Include user identifier in external storage paths.