summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2010-07-26 17:49:28 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-07-26 17:49:28 -0700
commitf7785521bf9ed9ce24d34b1c9f0e73487eb52f1e (patch)
tree16effa6734345f9843ddf97733426dd422d84cac /media
parentbc55034ef9a33685891b3498e1c56caebf7a93cb (diff)
parentf78b26a572e3ba5d47009f3a810a15e252b5503c (diff)
downloadframeworks_base-f7785521bf9ed9ce24d34b1c9f0e73487eb52f1e.zip
frameworks_base-f7785521bf9ed9ce24d34b1c9f0e73487eb52f1e.tar.gz
frameworks_base-f7785521bf9ed9ce24d34b1c9f0e73487eb52f1e.tar.bz2
Merge "MTP: Don't request thumbnails for folder objects in MtpCursor"
Diffstat (limited to 'media')
-rw-r--r--media/mtp/MtpCursor.cpp30
-rw-r--r--media/mtp/MtpCursor.h2
2 files changed, 19 insertions, 13 deletions
diff --git a/media/mtp/MtpCursor.cpp b/media/mtp/MtpCursor.cpp
index 5b6672a..91201c3 100644
--- a/media/mtp/MtpCursor.cpp
+++ b/media/mtp/MtpCursor.cpp
@@ -367,7 +367,7 @@ bool MtpCursor::fillObject(CursorWindow* window, MtpDevice* device,
goto fail;
break;
case OBJECT_THUMB:
- if (!putThumbnail(window, objectID, row, i))
+ if (!putThumbnail(window, objectID, objectInfo->mFormat, row, i))
goto fail;
break;
default:
@@ -427,19 +427,25 @@ bool MtpCursor::putString(CursorWindow* window, const char* text, int row, int c
return true;
}
-bool MtpCursor::putThumbnail(CursorWindow* window, int objectID, int row, int column) {
+bool MtpCursor::putThumbnail(CursorWindow* window, int objectID, int format, int row, int column) {
MtpDevice* device = mClient->getDevice(mDeviceID);
- int size;
- void* thumbnail = device->getThumbnail(objectID, size);
-
- LOGD("putThumbnail: %p, size: %d\n", thumbnail, size);
- int offset = window->alloc(size);
- if (!offset) {
- window->freeLastRow();
- LOGE("Failed allocating %u bytes for thumbnail", size);
- return false;
+ void* thumbnail;
+ int size, offset;
+ if (format == MTP_FORMAT_ASSOCIATION) {
+ thumbnail = NULL;
+ size = offset = 0;
+ } else {
+ thumbnail = device->getThumbnail(objectID, size);
+
+ LOGD("putThumbnail: %p, size: %d\n", thumbnail, size);
+ offset = window->alloc(size);
+ if (!offset) {
+ window->freeLastRow();
+ LOGE("Failed allocating %u bytes for thumbnail", size);
+ return false;
+ }
}
- if (size > 0)
+ if (thumbnail)
window->copyIn(offset, (const uint8_t*)thumbnail, size);
// This must be updated after the call to alloc(), since that
diff --git a/media/mtp/MtpCursor.h b/media/mtp/MtpCursor.h
index d51c052..3f84753 100644
--- a/media/mtp/MtpCursor.h
+++ b/media/mtp/MtpCursor.h
@@ -68,7 +68,7 @@ private:
bool prepareRow(CursorWindow* window);
bool putLong(CursorWindow* window, int value, int row, int column);
bool putString(CursorWindow* window, const char* text, int row, int column);
- bool putThumbnail(CursorWindow* window, int objectID, int row, int column);
+ bool putThumbnail(CursorWindow* window, int objectID, int format, int row, int column);
};
}; // namespace android