Rework thumbnail handling

Since ids of media file are usually not continuous, the original file of thumbnail are sparse.
When there are big numbers files on external storage, the size of this file will be horrible.
Ex, when the id is 20000, then the .thumbnails/.thumbdata3-xx file will be 50000*10k = 488.28M.
Can refer http://stackoverflow.com/questions/12396715/android-huge-thumbdata4-file-in-dcim-folder
Because after 4.0, MediaProvider will scan any files, this will be a big problem.
So I modify MiniThumbFile.java to avoid this.
According to the id, we now produce an index file.
In this index file, one id will use BYTES_PER_MINTHUMB_INDEX(8) bytes in offset (i\d+1)*BYTES_PER_MINTHUMB_INDEX.
The data of these 8 bytes is the index of thumbnail file. The first BYTES_PER_MINTHUMB_INDEX bytes keep next available index.
And when you need insert a thumbnail, the index increase by 1. In this way, the block data in thumbnail file will be
continuous. And thus unnecessary zero paddings will not be saved.

http://jira.omnirom.org/browse/OMNI-924

Also includes: https://github.com/CyanogenMod/android_frameworks_base/commit/8bd0a83c1dcd89a74ad53ad6bc77c9dd4d3e8c71

Change-Id: Ifdf0cc77c9317935a520c67b598cae532eafba47
(cherry picked from commit ad2f9d4807c4b01ba0cd3a67e69b40ae4209ff55)