summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2018-12-19 13:41:09 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2018-12-19 13:41:09 -0800
commit187eebb4e8b458be4397420ce4974bb1246d2a8d (patch)
tree66b31c1cf2bb12cbfbe223f55e0d9d94afc6fe72 /src
parentf60e8d921cd96fee03cdaecf169178b7f9abb5a1 (diff)
parentcc0555c62f7df75eb9d2c0d389a46498b895ae7b (diff)
downloadandroid_packages_apps_Snap-187eebb4e8b458be4397420ce4974bb1246d2a8d.tar.gz
android_packages_apps_Snap-187eebb4e8b458be4397420ce4974bb1246d2a8d.tar.bz2
android_packages_apps_Snap-187eebb4e8b458be4397420ce4974bb1246d2a8d.zip
Merge "SnapdraongCamera:Update HEIF thumbnail" into camera-SnapdragonCamera.lnx.2.0
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/camera/CameraActivity.java45
-rwxr-xr-xsrc/com/android/camera/CaptureModule.java2
-rwxr-xr-xsrc/com/android/camera/MediaSaveService.java2
-rwxr-xr-xsrc/com/android/camera/Storage.java1
4 files changed, 36 insertions, 14 deletions
diff --git a/src/com/android/camera/CameraActivity.java b/src/com/android/camera/CameraActivity.java
index 958a2cd51..9f225d1c7 100755
--- a/src/com/android/camera/CameraActivity.java
+++ b/src/com/android/camera/CameraActivity.java
@@ -726,6 +726,22 @@ public class CameraActivity extends Activity
return s;
}
+ private int getOrientationFromUri(Uri uri) {
+ String[] projection = {
+ MediaStore.Images.Media.ORIENTATION
+ };
+ Cursor cursor = getContentResolver().query(uri, projection, null, null, null);
+ if (cursor == null)
+ return 0;
+ int orientation_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.ORIENTATION);
+ int ori = 0;
+ if (cursor.moveToFirst()) {
+ ori = cursor.getInt(orientation_index);
+ }
+ cursor.close();
+ return ori;
+ }
+
public void updateThumbnail(final byte[] jpegData) {
if (mUpdateThumbnailTask != null) mUpdateThumbnailTask.cancel(true);
mUpdateThumbnailTask = new UpdateThumbnailTask(jpegData, true);
@@ -790,6 +806,7 @@ public class CameraActivity extends Activity
private class UpdateThumbnailTask extends AsyncTask<Void, Void, Bitmap> {
private byte[] mJpegData;
private boolean mCheckOrientation;
+ private int mOrientation = -1;
public UpdateThumbnailTask(final byte[] jpegData, boolean checkOrientation) {
mJpegData = jpegData;
@@ -810,8 +827,10 @@ public class CameraActivity extends Activity
String path = getPathFromUri(uri);
if (path == null) {
return null;
- }
- else {
+ } else {
+ if (path.endsWith(Storage.HEIF_POSTFIX)) {
+ mOrientation = getOrientationFromUri(uri);
+ }
if (img.isPhoto()) {
return decodeImageCenter(path);
} else {
@@ -851,16 +870,20 @@ public class CameraActivity extends Activity
// saves jpeg with orientation tag set.
int orientation = 0;
if (mCheckOrientation) {
- ExifInterface exif = new ExifInterface();
- try {
- if (mJpegData != null) {
- exif.readExif(mJpegData);
- } else {
- exif.readExif(path);
+ if (mOrientation != -1) {
+ orientation = mOrientation;
+ } else {
+ ExifInterface exif = new ExifInterface();
+ try {
+ if (mJpegData != null) {
+ exif.readExif(mJpegData);
+ } else {
+ exif.readExif(path);
+ }
+ orientation = Exif.getOrientation(exif);
+ } catch (IOException e) {
+ // ignore
}
- orientation = Exif.getOrientation(exif);
- } catch (IOException e) {
- // ignore
}
}
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java
index 760a8d49b..733bf6954 100755
--- a/src/com/android/camera/CaptureModule.java
+++ b/src/com/android/camera/CaptureModule.java
@@ -3122,8 +3122,6 @@ public class CaptureModule implements CameraModule, PhotoController,
}
private void applySettingsForJpegInformation(CaptureRequest.Builder builder, int id) {
- if (mSettingsManager.getSavePictureFormat() == SettingsManager.HEIF_FORMAT)
- return;
Location location = mLocationManager.getCurrentLocation();
if(location != null) {
// make copy so that we don't alter the saved location since we may re-use it
diff --git a/src/com/android/camera/MediaSaveService.java b/src/com/android/camera/MediaSaveService.java
index 078a9c427..5f172843d 100755
--- a/src/com/android/camera/MediaSaveService.java
+++ b/src/com/android/camera/MediaSaveService.java
@@ -391,7 +391,7 @@ public class MediaSaveService extends Service {
@Override
protected void onPostExecute(Uri uri) {
- boolean previouslyFull = isQueueFull();
+ if (listener != null) listener.onMediaSaved(uri);
}
}
diff --git a/src/com/android/camera/Storage.java b/src/com/android/camera/Storage.java
index 1f5671c97..05589bcc9 100755
--- a/src/com/android/camera/Storage.java
+++ b/src/com/android/camera/Storage.java
@@ -51,6 +51,7 @@ public class Storage {
public static final String DIRECTORY = DCIM + "/Camera";
public static final String RAW_DIRECTORY = DCIM + "/Camera/raw";
public static final String JPEG_POSTFIX = ".jpg";
+ public static final String HEIF_POSTFIX = ".heic";
// Match the code in MediaProvider.computeBucketValues().
public static final String BUCKET_ID =