Guarantee that db, shm and wal files are deleted together.

If media provider failed to open the database during an upgrade,
it deletes the database file and tries again.
But when deleing the file, it doesn't delete wal and shm files.
This commit is to guarantee that
all related files (db, wal, shm) are deleted together.

Signed-off-by: jangwon.lee <jangwon.lee@lge.com>

Change-Id: I7b4e3cf71d0b285399794ee9b45791c6a112a00c
Skip albumart when the size of image file bigger than maximal heap size.

When the audio doesn't contain embedded art, MediaProvider
will help to look for a suitable image file in the same
directory as the media file, excpet if that directory is
the root directory of the sd card or download directory.

MediaProvider looks for, in order of preference:
 1 AlbumArt.jpg
 2 AlbumArt*Large.jpg
 3 Any other jpg image with 'albumart' anywhere in the name
 4 Any other jpg image
 5 any other png image

If we put a image file and a audio file in same directory of
sdcard, and the size of a image should large than maximal heap size.
It will cause hte process android.process.media stop because OOM.
As a result, we need catch OutOfMemoryError exception to avoid this issue.

Change-Id: I4131188b4b75454f5bdb20c50b930ff8b7a370fa

Change-Id: I4131188b4b75454f5bdb20c50b930ff8b7a370fa
Avoid multiple extraction of thumbnails

When inserting a new memory card containing images, or taking a camera
picture, several requests for a thumbnail for the same picture are made.
At the time the requests are made, no thumbnail exists, so each of the
requests result in the full image being decoded and encoded to a
thumbnail, an operation taking about 100ms per thumbnail. Fixing this
cuts times for image thumbnails in half. Also improves Camera
shot-to-shot times.

When a thumbnail request is completed, scan the queue for identical
requests, and update those requests to avoid having to decode the same
image several times.

Change-Id: I53d720779925de882b0e2f080b0b87ec318e08a9
avoid SQLiteConstraintException in MediaProvider when external storage ejected

When external storage is ejected, the _data column is updated with empty string.
Then, SQLiteConstraintException occurs because the _data column is modified to be unique.
So, to avoid SQLiteConstraintException, the _data column should be updated with NULL.

Change-Id: I2b00b5327c37f584970261789c5462626a5a4ea7