summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngus Kong <shkong@google.com>2011-09-29 01:14:24 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-09-29 01:14:24 -0700
commitffe0a712b5a9bd1d46351b02e1bd738bc61578c2 (patch)
tree2126a882e33e7ecd5f4a5d6e89b7e5087303fe4d
parent73ff7b0b4323033d6a6d18cea2acd21d28168c4a (diff)
parentea312297ff6132bbafed99b90a72e4858b888fa4 (diff)
downloadLegacyCamera-ffe0a712b5a9bd1d46351b02e1bd738bc61578c2.zip
LegacyCamera-ffe0a712b5a9bd1d46351b02e1bd738bc61578c2.tar.gz
LegacyCamera-ffe0a712b5a9bd1d46351b02e1bd738bc61578c2.tar.bz2
Merge "Add dimension attributes to MediaStore."
-rw-r--r--src/com/android/camera/Camera.java7
-rw-r--r--src/com/android/camera/Storage.java6
-rw-r--r--src/com/android/camera/VideoCamera.java8
-rw-r--r--src/com/android/camera/panorama/PanoramaActivity.java6
4 files changed, 17 insertions, 10 deletions
diff --git a/src/com/android/camera/Camera.java b/src/com/android/camera/Camera.java
index 4bfd602..dc4d45d 100644
--- a/src/com/android/camera/Camera.java
+++ b/src/com/android/camera/Camera.java
@@ -678,7 +678,8 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
if (!mIsImageCaptureIntent) {
- storeImage(jpegData, mLocation);
+ Size s = mParameters.getPictureSize();
+ storeImage(jpegData, mLocation, s.width, s.height);
} else {
mJpegImageData = jpegData;
if (!mQuickCapture) {
@@ -745,12 +746,12 @@ public class Camera extends ActivityBase implements FocusManager.Listener,
}
}
- private void storeImage(final byte[] data, Location loc) {
+ private void storeImage(final byte[] data, Location loc, int width, int height) {
long dateTaken = System.currentTimeMillis();
String title = Util.createJpegName(dateTaken);
int orientation = Exif.getOrientation(data);
Uri uri = Storage.addImage(mContentResolver, title, dateTaken,
- loc, orientation, data);
+ loc, orientation, data, width, height);
if (uri != null) {
// Create a thumbnail whose width is equal or bigger than that of the preview.
int ratio = (int) Math.ceil((double) mParameters.getPictureSize().width
diff --git a/src/com/android/camera/Storage.java b/src/com/android/camera/Storage.java
index 3cb05a8..a9f67c9 100644
--- a/src/com/android/camera/Storage.java
+++ b/src/com/android/camera/Storage.java
@@ -47,8 +47,8 @@ public class Storage {
private static final int BUFSIZE = 4096;
- public static Uri addImage(ContentResolver resolver, String title,
- long date, Location location, int orientation, byte[] jpeg) {
+ public static Uri addImage(ContentResolver resolver, String title, long date,
+ Location location, int orientation, byte[] jpeg, int width, int height) {
// Save the image.
String path = DIRECTORY + '/' + title + ".jpg";
FileOutputStream out = null;
@@ -74,6 +74,8 @@ public class Storage {
values.put(ImageColumns.ORIENTATION, orientation);
values.put(ImageColumns.DATA, path);
values.put(ImageColumns.SIZE, jpeg.length);
+ values.put(ImageColumns.WIDTH, width);
+ values.put(ImageColumns.HEIGHT, height);
if (location != null) {
values.put(ImageColumns.LATITUDE, location.getLatitude());
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 4e2532a..537db23 100644
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -1297,6 +1297,9 @@ public class VideoCamera extends ActivityBase
mCurrentVideoValues.put(Video.Media.DATE_TAKEN, dateTaken);
mCurrentVideoValues.put(Video.Media.MIME_TYPE, mime);
mCurrentVideoValues.put(Video.Media.DATA, mVideoFilename);
+ mCurrentVideoValues.put(Video.Media.RESOLUTION,
+ Integer.toString(mProfile.videoFrameWidth) + "x" +
+ Integer.toString(mProfile.videoFrameHeight));
Log.v(TAG, "New video filename: " + mVideoFilename);
}
@@ -2204,8 +2207,9 @@ public class VideoCamera extends ActivityBase
long dateTaken = System.currentTimeMillis();
String title = Util.createJpegName(dateTaken);
int orientation = Exif.getOrientation(data);
- Uri uri = Storage.addImage(mContentResolver, title, dateTaken,
- loc, orientation, data);
+ Size s = mParameters.getPictureSize();
+ Uri uri = Storage.addImage(mContentResolver, title, dateTaken, loc, orientation, data,
+ s.width, s.height);
if (uri != null) {
// Create a thumbnail whose width is equal or bigger than that of the preview.
int ratio = (int) Math.ceil((double) mParameters.getPictureSize().width
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index b335249..b410c29 100644
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -753,7 +753,7 @@ public class PanoramaActivity extends Activity implements
mMainHandler.sendEmptyMessage(MSG_GENERATE_FINAL_MOSAIC_ERROR);
} else {
int orientation = Exif.getOrientation(jpeg.data);
- Uri uri = savePanorama(jpeg.data, orientation);
+ Uri uri = savePanorama(jpeg.data, jpeg.width, jpeg.height, orientation);
if (uri != null) {
// Create a thumbnail whose width is equal or bigger
// than the entire screen.
@@ -841,12 +841,12 @@ public class PanoramaActivity extends Activity implements
mReviewLayout.setVisibility(View.VISIBLE);
}
- private Uri savePanorama(byte[] jpegData, int orientation) {
+ private Uri savePanorama(byte[] jpegData, int width, int height, int orientation) {
if (jpegData != null) {
String imagePath = PanoUtil.createName(
getResources().getString(R.string.pano_file_name_format), mTimeTaken);
return Storage.addImage(getContentResolver(), imagePath, mTimeTaken, null,
- orientation, jpegData);
+ orientation, jpegData, width, height);
}
return null;
}