ExifInterface: Prevent DATETIME value from being set unproperly
Although the DATETIME and DATETIME_ORIGINAL tags are for different purposes, the DATETIME value is set to the same value as DATETIME_ORIGINAL tag's when loading the attributes of an image. This CL prevents the problem by setting the value of DATETIME tag only when it does not exist. Bug: 62137632 Test: Passed ExifInterface CTS Change-Id: Ic5c43c53cb363a782bcac20915d74ea534ec70e4
This commit is contained in:
@@ -2661,9 +2661,9 @@ public class ExifInterface {
|
||||
}
|
||||
|
||||
private void addDefaultValuesForCompatibility() {
|
||||
// The value of DATETIME tag has the same value of DATETIME_ORIGINAL tag.
|
||||
// If DATETIME tag has no value, then set the value to DATETIME_ORIGINAL tag's.
|
||||
String valueOfDateTimeOriginal = getAttribute(TAG_DATETIME_ORIGINAL);
|
||||
if (valueOfDateTimeOriginal != null) {
|
||||
if (valueOfDateTimeOriginal != null && getAttribute(TAG_DATETIME) == null) {
|
||||
mAttributes[IFD_TYPE_PRIMARY].put(TAG_DATETIME,
|
||||
ExifAttribute.createString(valueOfDateTimeOriginal));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user