summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjinwu <jinwu@codeaurora.org>2018-09-21 18:00:28 +0800
committerjinwu <jinwu@codeaurora.org>2018-09-21 18:00:28 +0800
commitf5ba161f66524e04e86b8821bac023273e1106da (patch)
tree4692abb7e518747529b7e3456010bf2774fcb51d /src
parenta26301351c28e820f6c2346ebd07265cfed14c8b (diff)
downloadandroid_packages_apps_Snap-f5ba161f66524e04e86b8821bac023273e1106da.tar.gz
android_packages_apps_Snap-f5ba161f66524e04e86b8821bac023273e1106da.tar.bz2
android_packages_apps_Snap-f5ba161f66524e04e86b8821bac023273e1106da.zip
SnapdragonCamera:Fix location recording
Get location information from ExifInterface when location is not send to MediaSaveService Change-Id: I7bd49fc5cd303f5bc5b43edb8769156d693232df CRs-Fixed: 2279097
Diffstat (limited to 'src')
-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 7bfee3041..0240607af 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -2438,7 +2438,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) {
@@ -2765,6 +2765,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 217f44f27..6a5f2b6d8 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;
@@ -279,7 +280,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 13f65e14c..d125ebe63 100755
--- a/src/com/android/camera/Storage.java
+++ b/src/com/android/camera/Storage.java
@@ -122,13 +122,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);
@@ -152,22 +152,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);
@@ -198,7 +215,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