am c4d37f58: am 0eee8ac2: Merge "Fix thumbnail bug"

* commit 'c4d37f58a1b5405812eaf96b4bd3a051d86884eb':
  Fix thumbnail bug
This commit is contained in:
Marco Nelissen
2014-06-23 21:51:38 +00:00
committed by Android Git Automerger
2 changed files with 4 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Arrays;
/**
* The Media provider contains meta data for all available media on both internal
@@ -659,6 +660,7 @@ public final class MediaStore {
if (sThumbBuf == null) {
sThumbBuf = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
}
Arrays.fill(sThumbBuf, (byte)0);
if (thumbFile.getMiniThumbFromFile(origId, sThumbBuf) != null) {
bitmap = BitmapFactory.decodeByteArray(sThumbBuf, 0, sThumbBuf.length);
if (bitmap == null) {

View File

@@ -249,7 +249,8 @@ public class MiniThumbFile {
long magic = mBuffer.getLong();
int length = mBuffer.getInt();
if (size >= 1 + 8 + 4 + length && data.length >= length) {
if (size >= 1 + 8 + 4 + length && length != 0 && magic != 0 && flag == 1 &&
data.length >= length) {
mBuffer.get(data, 0, length);
return data;
}