summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinand <winandfx@gmail.com>2013-08-28 02:02:23 +0400
committerJorge Ruesga <jorge@ruesga.com>2013-09-12 22:54:18 +0200
commit1dd89eb3d2419b318d3b9963e5f554b047a6d89d (patch)
tree4ceba00784daa5b10b4347d6acfe02ab9afb41e2
parent95eddd7926f71c253fbc1ebf32629eb1d8ea6575 (diff)
downloadandroid_packages_apps_Gallery2-1dd89eb3d2419b318d3b9963e5f554b047a6d89d.tar.gz
android_packages_apps_Gallery2-1dd89eb3d2419b318d3b9963e5f554b047a6d89d.tar.bz2
android_packages_apps_Gallery2-1dd89eb3d2419b318d3b9963e5f554b047a6d89d.zip
Add GPS tags and timestamp to Exif when photo is saved
Patchset 2: Fix formatting Sync exif code of PhotoModule and PanoramaModule Change-Id: I8b6f77687f01c537a2a3d5bb2b2d8b4ad21642c8
-rw-r--r--src/com/android/camera/PanoramaModule.java6
-rw-r--r--src/com/android/camera/PhotoModule.java9
2 files changed, 12 insertions, 3 deletions
diff --git a/src/com/android/camera/PanoramaModule.java b/src/com/android/camera/PanoramaModule.java
index 57405ecd8..66cdc2d30 100644
--- a/src/com/android/camera/PanoramaModule.java
+++ b/src/com/android/camera/PanoramaModule.java
@@ -914,12 +914,11 @@ public class PanoramaModule implements CameraModule,
ExifInterface exif = new ExifInterface();
try {
exif.readExif(jpegData);
- exif.addGpsDateTimeStampTag(mTimeTaken);
exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME, mTimeTaken,
TimeZone.getDefault());
exif.setTag(exif.buildTag(ExifInterface.TAG_ORIENTATION,
ExifInterface.getOrientationValueForRotation(orientation)));
- writeLocation(loc, exif);
+ writeLocation(loc, mTimeTaken, exif);
exif.writeExif(jpegData, filepath);
} catch (IOException e) {
Log.e(TAG, "Cannot set exif for " + filepath, e);
@@ -932,11 +931,12 @@ public class PanoramaModule implements CameraModule,
return null;
}
- private static void writeLocation(Location location, ExifInterface exif) {
+ private static void writeLocation(Location location, long timestamp, ExifInterface exif) {
if (location == null) {
return;
}
exif.addGpsTags(location.getLatitude(), location.getLongitude());
+ exif.addGpsDateTimeStampTag(timestamp);
exif.setTag(exif.buildTag(ExifInterface.TAG_GPS_PROCESSING_METHOD, location.getProvider()));
}
diff --git a/src/com/android/camera/PhotoModule.java b/src/com/android/camera/PhotoModule.java
index add797391..7854ca258 100644
--- a/src/com/android/camera/PhotoModule.java
+++ b/src/com/android/camera/PhotoModule.java
@@ -80,6 +80,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Formatter;
import java.util.List;
+import java.util.TimeZone;
public class PhotoModule
implements CameraModule,
@@ -890,6 +891,14 @@ public class PhotoModule
exif.setTag(directionRefTag);
exif.setTag(directionTag);
}
+ if (mLocation != null) {
+ exif.addGpsTags(mLocation.getLatitude(), mLocation.getLongitude());
+ exif.addGpsDateTimeStampTag(date);
+ exif.setTag(exif.buildTag(ExifInterface.TAG_GPS_PROCESSING_METHOD,
+ mLocation.getProvider()));
+ }
+ exif.addDateTimeStampTag(ExifInterface.TAG_DATE_TIME,
+ date, TimeZone.getDefault());
if (isSamsungHDR) {
final long finalDate = date;