MTP: Use DateTime form in GetObjectPropDesc for date/time properties.
Change-Id: I5a3c0b07a9f2958b86947256606e6a824dbe93a6
Signed-off-by: Mike Lockwood <lockwood@android.com>
diff --git a/media/jni/android_media_MtpDatabase.cpp b/media/jni/android_media_MtpDatabase.cpp
index 4525d1f..f04a2ae 100644
--- a/media/jni/android_media_MtpDatabase.cpp
+++ b/media/jni/android_media_MtpDatabase.cpp
@@ -948,18 +948,21 @@
result = new MtpProperty(property, MTP_TYPE_UINT128);
break;
case MTP_PROPERTY_NAME:
- case MTP_PROPERTY_DATE_MODIFIED:
case MTP_PROPERTY_DISPLAY_NAME:
- case MTP_PROPERTY_DATE_ADDED:
case MTP_PROPERTY_ARTIST:
case MTP_PROPERTY_ALBUM_NAME:
case MTP_PROPERTY_ALBUM_ARTIST:
- case MTP_PROPERTY_ORIGINAL_RELEASE_DATE:
case MTP_PROPERTY_GENRE:
case MTP_PROPERTY_COMPOSER:
case MTP_PROPERTY_DESCRIPTION:
result = new MtpProperty(property, MTP_TYPE_STR);
break;
+ case MTP_PROPERTY_DATE_MODIFIED:
+ case MTP_PROPERTY_DATE_ADDED:
+ case MTP_PROPERTY_ORIGINAL_RELEASE_DATE:
+ result = new MtpProperty(property, MTP_TYPE_STR);
+ result->setFormDateTime();
+ break;
case MTP_PROPERTY_OBJECT_FILE_NAME:
// We allow renaming files and folders
result = new MtpProperty(property, MTP_TYPE_STR, true);
diff --git a/media/mtp/MtpProperty.cpp b/media/mtp/MtpProperty.cpp
index 86889c3..42945f5 100644
--- a/media/mtp/MtpProperty.cpp
+++ b/media/mtp/MtpProperty.cpp
@@ -312,6 +312,10 @@
}
}
+void MtpProperty::setFormDateTime() {
+ mFormFlag = kFormDateTime;
+}
+
void MtpProperty::print() {
LOGV("MtpProperty %04X\n", mCode);
LOGV(" type %04X\n", mType);
diff --git a/media/mtp/MtpProperty.h b/media/mtp/MtpProperty.h
index c12399c..f783a87 100644
--- a/media/mtp/MtpProperty.h
+++ b/media/mtp/MtpProperty.h
@@ -58,6 +58,7 @@
kFormNone = 0,
kFormRange = 1,
kFormEnum = 2,
+ kFormDateTime = 3,
};
uint32_t mGroupCode;
@@ -90,6 +91,7 @@
void setFormRange(int min, int max, int step);
void setFormEnum(const int* values, int count);
+ void setFormDateTime();
void print();