diff options
author | Mike Lockwood <lockwood@android.com> | 2011-07-26 16:42:43 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-07-26 16:42:43 -0700 |
commit | 7c0d89ac97260634c3687c8c8136328c967d68ed (patch) | |
tree | 85c4a883a4cfbd4f499a7bf1616a6c53fea379f8 /packages | |
parent | 04310646477fd2b49747207b2991bf4d6c1ee52f (diff) | |
parent | 9837734b640ca3a1b95812612fc01c517fb02eb4 (diff) | |
download | frameworks_base-7c0d89ac97260634c3687c8c8136328c967d68ed.zip frameworks_base-7c0d89ac97260634c3687c8c8136328c967d68ed.tar.gz frameworks_base-7c0d89ac97260634c3687c8c8136328c967d68ed.tar.bz2 |
Merge "GlobalScreenshot: Set image file size in media database when taking screenshots"
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java | 12 |
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 |