From 9442e1147084c14bb9047fc286dce297fc0122ce Mon Sep 17 00:00:00 2001 From: Hyundo Moon Date: Mon, 12 Jun 2017 20:47:50 +0900 Subject: [PATCH] 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 --- media/java/android/media/ExifInterface.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/media/java/android/media/ExifInterface.java b/media/java/android/media/ExifInterface.java index 0a611481284b..6677178514e0 100644 --- a/media/java/android/media/ExifInterface.java +++ b/media/java/android/media/ExifInterface.java @@ -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)); } -- 2.11.0