Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9439241d authored by Chih-Chung Chang's avatar Chih-Chung Chang
Browse files

resolved conflicts for merge of 20afae51 to master

Change-Id: Ief637e412e4d716526de68c7761bdb8cbf436333
parents 96b25164 20afae51
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -322,6 +322,8 @@ public final class MediaStore {
        private static final int MICRO_KIND = 3;
        private static final String[] PROJECTION = new String[] {_ID, MediaColumns.DATA};
        static final int DEFAULT_GROUP_ID = 0;
        private static final Object sThumbBufLock = new Object();
        private static byte[] sThumbBuf;

        private static Bitmap getMiniThumbFromFile(Cursor c, Uri baseUri, ContentResolver cr, BitmapFactory.Options options) {
            Bitmap bitmap = null;
@@ -397,13 +399,17 @@ public final class MediaStore {
                long magic = thumbFile.getMagic(origId);
                if (magic != 0) {
                    if (kind == MICRO_KIND) {
                        byte[] data = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
                        if (thumbFile.getMiniThumbFromFile(origId, data) != null) {
                            bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
                        synchronized (sThumbBufLock) {
                            if (sThumbBuf == null) {
                                sThumbBuf = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
                            }
                            if (thumbFile.getMiniThumbFromFile(origId, sThumbBuf) != null) {
                                bitmap = BitmapFactory.decodeByteArray(sThumbBuf, 0, sThumbBuf.length);
                                if (bitmap == null) {
                                    Log.w(TAG, "couldn't decode byte array.");
                                }
                            }
                        }
                        return bitmap;
                    } else if (kind == MINI_KIND) {
                        String column = isVideo ? "video_id=" : "image_id=";
@@ -427,13 +433,17 @@ public final class MediaStore {

                // Assuming thumbnail has been generated, at least original image exists.
                if (kind == MICRO_KIND) {
                    byte[] data = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
                    if (thumbFile.getMiniThumbFromFile(origId, data) != null) {
                        bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
                    synchronized (sThumbBufLock) {
                        if (sThumbBuf == null) {
                            sThumbBuf = new byte[MiniThumbFile.BYTES_PER_MINTHUMB];
                        }
                        if (thumbFile.getMiniThumbFromFile(origId, sThumbBuf) != null) {
                            bitmap = BitmapFactory.decodeByteArray(sThumbBuf, 0, sThumbBuf.length);
                            if (bitmap == null) {
                                Log.w(TAG, "couldn't decode byte array.");
                            }
                        }
                    }
                } else if (kind == MINI_KIND) {
                    if (c.moveToFirst()) {
                        bitmap = getMiniThumbFromFile(c, baseUri, cr, options);