summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-09-24 21:26:37 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2018-09-24 21:26:38 -0700
commit4fc327fc833f29c051f02e73fd22294196c30af6 (patch)
treeb26b768b636eb5f69ec4bc090f20e089b5896ec2
parentca880d6fdbe6b3c3b5ae775245ab7efd0ac8630a (diff)
parentf5ba161f66524e04e86b8821bac023273e1106da (diff)
downloadandroid_packages_apps_Snap-4fc327fc833f29c051f02e73fd22294196c30af6.tar.gz
android_packages_apps_Snap-4fc327fc833f29c051f02e73fd22294196c30af6.tar.bz2
android_packages_apps_Snap-4fc327fc833f29c051f02e73fd22294196c30af6.zip
Merge "SnapdragonCamera:Fix location recording" into camera-SnapdragonCamera.lnx.2.0
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java3
-rwxr-xr-x[-rw-r--r--]src/com/android/camera/MediaSaveService.java3
-rwxr-xr-xsrc/com/android/camera/Storage.java27
3 files changed, 26 insertions, 7 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index c9250c09e..8564d4cb9 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -2469,7 +2469,7 @@ public class CaptureModule implements CameraModule, PhotoController,
}
} else {
mActivity.getMediaSaveService().addImage(bytes, title, date,
- null, image.getWidth(), image.getHeight(), orientation, null,
+ null, image.getWidth(), image.getHeight(), orientation, exif,
mOnMediaSavedListener, mContentResolver, "jpeg");
if (mLongshotActive) {
@@ -2796,6 +2796,7 @@ public class CaptureModule implements CameraModule, PhotoController,
} else {
Log.d(TAG, "no location - getRecordLocation: " + getRecordLocation());
}
+
builder.set(CaptureRequest.JPEG_ORIENTATION, CameraUtil.getJpegRotation(id, mOrientation));
builder.set(CaptureRequest.JPEG_THUMBNAIL_SIZE, mPictureThumbSize);
builder.set(CaptureRequest.JPEG_THUMBNAIL_QUALITY, (byte)80);
diff --git a/src/com/android/camera/MediaSaveService.java b/src/com/android/camera/MediaSaveService.java
index 8394162db..14aaf7a49 100644..100755
--- a/src/com/android/camera/MediaSaveService.java
+++ b/src/com/android/camera/MediaSaveService.java
@@ -36,6 +36,7 @@ import android.os.Binder;
import android.os.IBinder;
import android.provider.MediaStore.Video;
import android.util.Log;
+import android.widget.Toast;
import com.android.camera.exif.ExifInterface;
import com.android.camera.mpo.MpoData;
@@ -296,7 +297,7 @@ public class MediaSaveService extends Service {
if (f.exists() && f.isFile()) {
size = (int) f.length();
}
- return Storage.addImage(resolver, title, date, loc, orientation,
+ return Storage.addImage(resolver, title, date, loc, orientation, null,
size, path, width, height, pictureFormat);
}
diff --git a/src/com/android/camera/Storage.java b/src/com/android/camera/Storage.java
index a71a88a47..82b8adcf5 100755
--- a/src/com/android/camera/Storage.java
+++ b/src/com/android/camera/Storage.java
@@ -128,13 +128,13 @@ public class Storage {
if (f.exists() && f.isFile()) {
size = (int) f.length();
}
- return addImage(resolver, title, date, location, orientation,
+ return addImage(resolver, title, date, location, orientation, exif,
size, path, width, height, mimeType);
}
// Get a ContentValues object for the given photo data
public static ContentValues getContentValuesForData(String title,
- long date, Location location, int orientation, int jpegLength,
+ long date, Location location, int orientation, ExifInterface exif, int jpegLength,
String path, int width, int height, String mimeType) {
// Insert into MediaStore.
ContentValues values = new ContentValues(9);
@@ -169,22 +169,39 @@ public class Storage {
if (location != null) {
values.put(ImageColumns.LATITUDE, location.getLatitude());
values.put(ImageColumns.LONGITUDE, location.getLongitude());
+ } else if (exif != null) {
+ double[] latlng = exif.getLatLongAsDoubles();
+ if (latlng != null) {
+ values.put(Images.Media.LATITUDE, latlng[0]);
+ values.put(Images.Media.LONGITUDE, latlng[1]);
+ }
}
return values;
}
// Add the image to media store.
public static Uri addImage(ContentResolver resolver, String title,
- long date, Location location, int orientation, int jpegLength,
+ long date, Location location, int orientation, ExifInterface exif,int jpegLength,
String path, int width, int height, String mimeType) {
// Insert into MediaStore.
ContentValues values =
- getContentValuesForData(title, date, location, orientation, jpegLength, path,
+ getContentValuesForData(title, date, location, orientation, exif, jpegLength, path,
width, height, mimeType);
return insertImage(resolver, values);
}
+ public static Uri addImage(ContentResolver resolver, String title,
+ long date, Location location, int orientation,int jpegLength,
+ String path, int width, int height, String mimeType) {
+ // Insert into MediaStore.
+ ContentValues values =
+ getContentValuesForData(title, date, location, orientation, null, jpegLength,
+ path, width, height, mimeType);
+
+ return insertImage(resolver, values);
+ }
+
public static long addRawImage(String title, byte[] data,
String mimeType) {
String path = generateFilepath(title, mimeType);
@@ -249,7 +266,7 @@ public class Storage {
String path, int width, int height, String mimeType) {
ContentValues values =
- getContentValuesForData(title, date, location, orientation, jpegLength, path,
+ getContentValuesForData(title, date, location, orientation, null, jpegLength, path,
width, height, mimeType);
// Update the MediaStore