summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/screenshot
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-07-26 13:55:16 -0400
committerMike Lockwood <lockwood@android.com>2011-07-26 16:58:14 -0400
commit9837734b640ca3a1b95812612fc01c517fb02eb4 (patch)
tree86374f28cf2fb6301098d3d92d972d6cba0419cc /packages/SystemUI/src/com/android/systemui/screenshot
parentc6eaa713a3f5b9337eca60ba2ab570cf6e80c357 (diff)
downloadframeworks_base-9837734b640ca3a1b95812612fc01c517fb02eb4.zip
frameworks_base-9837734b640ca3a1b95812612fc01c517fb02eb4.tar.gz
frameworks_base-9837734b640ca3a1b95812612fc01c517fb02eb4.tar.bz2
GlobalScreenshot: Set image file size in media database when taking screenshots
Otherwise the value would be left at zero since we are inserting the database record before writing the file Bug: 5064246 Change-Id: I54be6ff14a7f170994aaf586aaddb06c5b746e89 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/screenshot')
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index 3e037c1..3a47e6e 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -24,6 +24,7 @@ import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.Activity;
+import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.graphics.Bitmap;
@@ -99,6 +100,7 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi
// Save the screenshot to the MediaStore
ContentValues values = new ContentValues();
+ ContentResolver resolver = context.getContentResolver();
values.put(MediaStore.Images.ImageColumns.DATA, imageFilePath);
values.put(MediaStore.Images.ImageColumns.TITLE, imageFileName);
values.put(MediaStore.Images.ImageColumns.DISPLAY_NAME, imageFileName);
@@ -106,14 +108,18 @@ class SaveImageInBackgroundTask extends AsyncTask<SaveImageInBackgroundData, Voi
values.put(MediaStore.Images.ImageColumns.DATE_ADDED, currentTime);
values.put(MediaStore.Images.ImageColumns.DATE_MODIFIED, currentTime);
values.put(MediaStore.Images.ImageColumns.MIME_TYPE, "image/png");
- Uri uri = context.getContentResolver().insert(
- MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
+ Uri uri = resolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
- OutputStream out = context.getContentResolver().openOutputStream(uri);
+ OutputStream out = resolver.openOutputStream(uri);
image.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
out.close();
+ // update file size in the database
+ values.clear();
+ values.put(MediaStore.Images.ImageColumns.SIZE, new File(imageFilePath).length());
+ resolver.update(uri, values, null, null);
+
params[0].result = 0;
} catch (Exception e) {
// IOException/UnsupportedOperationException may be thrown if external storage is not