summaryrefslogtreecommitdiffstats
path: root/camera2
diff options
context:
space:
mode:
authorSol Boucher <solb@google.com>2014-08-22 15:59:32 -0700
committerSol Boucher <solb@google.com>2014-08-22 17:01:54 -0700
commitd0185cc2f5786571565f01b26e1143ce0099bdc8 (patch)
tree7ed67afcce2d0fd8b9ac7099e8aa3f7cacb24392 /camera2
parent8aa57d57fb5c153aa317f46c0d5e44365ebbef80 (diff)
downloadandroid_frameworks_ex-d0185cc2f5786571565f01b26e1143ce0099bdc8.tar.gz
android_frameworks_ex-d0185cc2f5786571565f01b26e1143ce0099bdc8.tar.bz2
android_frameworks_ex-d0185cc2f5786571565f01b26e1143ce0099bdc8.zip
camera2-api: Tag camera2 JPEGs with any provided location
Bug: 17027000 Change-Id: I311028b9df4d74268fb415c163f7e6a2d2505dff
Diffstat (limited to 'camera2')
-rw-r--r--camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java19
-rw-r--r--camera2/portability/src/com/android/ex/camera2/portability/CameraSettings.java13
2 files changed, 30 insertions, 2 deletions
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java
index efa68e8..adf930e 100644
--- a/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java
+++ b/camera2/portability/src/com/android/ex/camera2/portability/AndroidCamera2Settings.java
@@ -22,6 +22,7 @@ import android.graphics.Rect;
import android.hardware.camera2.CameraAccessException;
import android.hardware.camera2.CameraDevice;
import android.hardware.camera2.params.MeteringRectangle;
+import android.location.Location;
import android.util.Range;
import com.android.ex.camera2.portability.CameraCapabilities.FlashMode;
@@ -231,7 +232,7 @@ public class AndroidCamera2Settings extends CameraSettings {
updateRequestSettingOrForceToDefault(CONTROL_AE_LOCK, mAutoExposureLocked);
updateRequestSettingOrForceToDefault(CONTROL_AWB_LOCK, mAutoWhiteBalanceLocked);
// TODO: mRecordingHintEnabled
- // TODO: mGpsData
+ updateRequestGpsData();
updateRequestSettingOrForceToDefault(JPEG_THUMBNAIL_SIZE,
new android.util.Size(
mExifThumbnailSize.width(), mExifThumbnailSize.height()));
@@ -469,4 +470,20 @@ public class AndroidCamera2Settings extends CameraSettings {
}
mRequestSettings.set(CONTROL_AWB_MODE, mode);
}
+
+ private void updateRequestGpsData() {
+ if (mGpsData == null || mGpsData.processingMethod == null) {
+ // It's a hack since we always use GPS time stamp but does
+ // not use other fields sometimes. Setting processing
+ // method to null means the other fields should not be used.
+ mRequestSettings.set(JPEG_GPS_LOCATION, null);
+ } else {
+ Location location = new Location(mGpsData.processingMethod);
+ location.setTime(mGpsData.timeStamp);
+ location.setAltitude(mGpsData.altitude);
+ location.setLatitude(mGpsData.latitude);
+ location.setLongitude(mGpsData.longitude);
+ mRequestSettings.set(JPEG_GPS_LOCATION, location);
+ }
+ }
}
diff --git a/camera2/portability/src/com/android/ex/camera2/portability/CameraSettings.java b/camera2/portability/src/com/android/ex/camera2/portability/CameraSettings.java
index 26d0f85..cae022d 100644
--- a/camera2/portability/src/com/android/ex/camera2/portability/CameraSettings.java
+++ b/camera2/portability/src/com/android/ex/camera2/portability/CameraSettings.java
@@ -73,9 +73,20 @@ public abstract class CameraSettings {
public final long timeStamp;
public final String processingMethod;
- /** Constructor. */
+ /**
+ * Construct what may or may not actually represent a location,
+ * depending on the value of {@code processingMethod}.
+ *
+ * <p>Setting {@code processingMethod} to {@code null} means that
+ * {@code latitude}, {@code longitude}, and {@code altitude} will be
+ * completely ignored.</p>
+ */
public GpsData(double latitude, double longitude, double altitude, long timeStamp,
String processingMethod) {
+ if (processingMethod == null &&
+ (latitude != 0.0 || longitude != 0.0 || altitude != 0.0)) {
+ Log.w(TAG, "GpsData's nonzero data will be ignored due to null processingMethod");
+ }
this.latitude = latitude;
this.longitude = longitude;
this.altitude = altitude;