summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSol Boucher <solb@google.com>2014-08-23 06:19:14 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-08-23 06:19:14 +0000
commitbfed64d0dc0020ab53ec734ea2547ea71ce0178f (patch)
tree936911c56bceb4a9f488ca74ab5892aa2408e393
parentd90959c9fcf4ec6d6f332ab534993913538bfe38 (diff)
parent336f88ed91a43eb4d1d67fb805171433676279e3 (diff)
downloadandroid_frameworks_ex-bfed64d0dc0020ab53ec734ea2547ea71ce0178f.tar.gz
android_frameworks_ex-bfed64d0dc0020ab53ec734ea2547ea71ce0178f.tar.bz2
android_frameworks_ex-bfed64d0dc0020ab53ec734ea2547ea71ce0178f.zip
am 336f88ed: Merge "camera2-api: Tag camera2 JPEGs with any provided location" into lmp-dev
* commit '336f88ed91a43eb4d1d67fb805171433676279e3': camera2-api: Tag camera2 JPEGs with any provided location
-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;