summaryrefslogtreecommitdiffstats
path: root/media/jni
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-04-23 08:55:59 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-04-23 08:55:59 -0700
commit825e8716a6ddaf9c70767c5f7228d16da73f7573 (patch)
tree169d8744dd7d48fcdf68128497539a83e8abe132 /media/jni
parentb8b49559f6444c0c52c86680f2c2c8ee950be94d (diff)
parent9df53fae3afd1c6b5278216be2fd33a255602aef (diff)
downloadframeworks_base-825e8716a6ddaf9c70767c5f7228d16da73f7573.zip
frameworks_base-825e8716a6ddaf9c70767c5f7228d16da73f7573.tar.gz
frameworks_base-825e8716a6ddaf9c70767c5f7228d16da73f7573.tar.bz2
Merge "MTP: Add extended operations to support in-place editing of files"
Diffstat (limited to 'media/jni')
-rw-r--r--media/jni/android_mtp_MtpDatabase.cpp42
1 files changed, 12 insertions, 30 deletions
diff --git a/media/jni/android_mtp_MtpDatabase.cpp b/media/jni/android_mtp_MtpDatabase.cpp
index 06708da..585cd30 100644
--- a/media/jni/android_mtp_MtpDatabase.cpp
+++ b/media/jni/android_mtp_MtpDatabase.cpp
@@ -29,6 +29,7 @@
#include "MtpDatabase.h"
#include "MtpDataPacket.h"
+#include "MtpObjectInfo.h"
#include "MtpProperty.h"
#include "MtpStringBuffer.h"
#include "MtpUtils.h"
@@ -138,7 +139,7 @@ public:
MtpDataPacket& packet);
virtual MtpResponseCode getObjectInfo(MtpObjectHandle handle,
- MtpDataPacket& packet);
+ MtpObjectInfo& info);
virtual MtpResponseCode getObjectFilePath(MtpObjectHandle handle,
MtpString& outFilePath,
@@ -744,7 +745,7 @@ MtpResponseCode MyMtpDatabase::getObjectPropertyList(MtpObjectHandle handle,
}
MtpResponseCode MyMtpDatabase::getObjectInfo(MtpObjectHandle handle,
- MtpDataPacket& packet) {
+ MtpObjectInfo& info) {
char date[20];
JNIEnv* env = AndroidRuntime::getJNIEnv();
@@ -754,46 +755,27 @@ MtpResponseCode MyMtpDatabase::getObjectInfo(MtpObjectHandle handle,
return MTP_RESPONSE_INVALID_OBJECT_HANDLE;
jint* intValues = env->GetIntArrayElements(mIntBuffer, 0);
- MtpStorageID storageID = intValues[0];
- MtpObjectFormat format = intValues[1];
- MtpObjectHandle parent = intValues[2];
+ info.mStorageID = intValues[0];
+ info.mFormat = intValues[1];
+ info.mParent = intValues[2];
env->ReleaseIntArrayElements(mIntBuffer, intValues, 0);
jlong* longValues = env->GetLongArrayElements(mLongBuffer, 0);
uint64_t size = longValues[0];
- uint64_t modified = longValues[1];
+ info.mCompressedSize = (size > 0xFFFFFFFFLL ? 0xFFFFFFFF : size);
+ info.mDateModified = longValues[1];
env->ReleaseLongArrayElements(mLongBuffer, longValues, 0);
-// int associationType = (format == MTP_FORMAT_ASSOCIATION ?
+// info.mAssociationType = (format == MTP_FORMAT_ASSOCIATION ?
// MTP_ASSOCIATION_TYPE_GENERIC_FOLDER :
// MTP_ASSOCIATION_TYPE_UNDEFINED);
- int associationType = MTP_ASSOCIATION_TYPE_UNDEFINED;
-
- packet.putUInt32(storageID);
- packet.putUInt16(format);
- packet.putUInt16(0); // protection status
- packet.putUInt32((size > 0xFFFFFFFFLL ? 0xFFFFFFFF : size));
- packet.putUInt16(0); // thumb format
- packet.putUInt32(0); // thumb compressed size
- packet.putUInt32(0); // thumb pix width
- packet.putUInt32(0); // thumb pix height
- packet.putUInt32(0); // image pix width
- packet.putUInt32(0); // image pix height
- packet.putUInt32(0); // image bit depth
- packet.putUInt32(parent);
- packet.putUInt16(associationType);
- packet.putUInt32(0); // association desc
- packet.putUInt32(0); // sequence number
+ info.mAssociationType = MTP_ASSOCIATION_TYPE_UNDEFINED;
jchar* str = env->GetCharArrayElements(mStringBuffer, 0);
- packet.putString(str); // file name
+ MtpString temp(str);
+ info.mName = strdup((const char *)temp);
env->ReleaseCharArrayElements(mStringBuffer, str, 0);
- packet.putEmptyString();
- formatDateTime(modified, date, sizeof(date));
- packet.putString(date); // date modified
- packet.putEmptyString(); // keywords
-
checkAndClearExceptionFromCallback(env, __FUNCTION__);
return MTP_RESPONSE_OK;
}