summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/screenshot
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2012-01-04 16:43:10 -0800
committerWinson Chung <winsonc@google.com>2012-01-04 16:43:42 -0800
commita46d77863565671cd19b79f8af441d8d658953be (patch)
tree389a2d165a98b884c47d23afe8eee9a9746b7afd /packages/SystemUI/src/com/android/systemui/screenshot
parenta17e100b7a192cae3935d2ae144fb1a1115a4ca7 (diff)
downloadframeworks_base-a46d77863565671cd19b79f8af441d8d658953be.zip
frameworks_base-a46d77863565671cd19b79f8af441d8d658953be.tar.gz
frameworks_base-a46d77863565671cd19b79f8af441d8d658953be.tar.bz2
Fixing crash when taking screenshot over secure window.
Change-Id: If3d4e458030e37aae3310b23dcad2ff5fe29fa73
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/screenshot')
-rw-r--r--packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
index 2232995..c4a92f7 100644
--- a/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
+++ b/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java
@@ -358,7 +358,15 @@ class GlobalScreenshot {
dims[0] = Math.abs(dims[0]);
dims[1] = Math.abs(dims[1]);
}
+
+ // Take the screenshot
mScreenBitmap = Surface.screenshot((int) dims[0], (int) dims[1]);
+ if (mScreenBitmap == null) {
+ notifyScreenshotError(mContext, mNotificationManager);
+ finisher.run();
+ return;
+ }
+
if (requiresRotation) {
// Rotate the screenshot to the current orientation
Bitmap ss = Bitmap.createBitmap(mDisplayMetrics.widthPixels,
@@ -372,13 +380,6 @@ class GlobalScreenshot {
mScreenBitmap = ss;
}
- // If we couldn't take the screenshot, notify the user
- if (mScreenBitmap == null) {
- notifyScreenshotError(mContext, mNotificationManager);
- finisher.run();
- return;
- }
-
// Optimizations
mScreenBitmap.setHasAlpha(false);
mScreenBitmap.prepareToDraw();