Merge "Fix thumbnail bug"
This commit is contained in:
@@ -40,6 +40,7 @@ import java.io.FileNotFoundException;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Media provider contains meta data for all available media on both internal
|
* The Media provider contains meta data for all available media on both internal
|
||||||
@@ -655,6 +656,7 @@ public final class MediaStore {
|
|||||||
if (sThumbBuf == null) {
|
if (sThumbBuf == null) {
|
||||||
sThumbBuf = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
|
sThumbBuf = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
|
||||||
}
|
}
|
||||||
|
Arrays.fill(sThumbBuf, (byte)0);
|
||||||
if (thumbFile.getMiniThumbFromFile(origId, sThumbBuf) != null) {
|
if (thumbFile.getMiniThumbFromFile(origId, sThumbBuf) != null) {
|
||||||
bitmap = BitmapFactory.decodeByteArray(sThumbBuf, 0, sThumbBuf.length);
|
bitmap = BitmapFactory.decodeByteArray(sThumbBuf, 0, sThumbBuf.length);
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
|
|||||||
@@ -249,7 +249,8 @@ public class MiniThumbFile {
|
|||||||
long magic = mBuffer.getLong();
|
long magic = mBuffer.getLong();
|
||||||
int length = mBuffer.getInt();
|
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);
|
mBuffer.get(data, 0, length);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user