Skip to content

Commit beb8be6

Browse files
Justin HoAndroid (Google) Code Review
authored andcommitted
Merge "Fixing crash when taking screenshot over secure window." into ics-mr1
2 parents 3116b7a + a46d778 commit beb8be6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,15 @@ void takeScreenshot(Runnable finisher, boolean statusBarVisible, boolean navBarV
358358
dims[0] = Math.abs(dims[0]);
359359
dims[1] = Math.abs(dims[1]);
360360
}
361+
362+
// Take the screenshot
361363
mScreenBitmap = Surface.screenshot((int) dims[0], (int) dims[1]);
364+
if (mScreenBitmap == null) {
365+
notifyScreenshotError(mContext, mNotificationManager);
366+
finisher.run();
367+
return;
368+
}
369+
362370
if (requiresRotation) {
363371
// Rotate the screenshot to the current orientation
364372
Bitmap ss = Bitmap.createBitmap(mDisplayMetrics.widthPixels,
@@ -372,13 +380,6 @@ void takeScreenshot(Runnable finisher, boolean statusBarVisible, boolean navBarV
372380
mScreenBitmap = ss;
373381
}
374382

375-
// If we couldn't take the screenshot, notify the user
376-
if (mScreenBitmap == null) {
377-
notifyScreenshotError(mContext, mNotificationManager);
378-
finisher.run();
379-
return;
380-
}
381-
382383
// Optimizations
383384
mScreenBitmap.setHasAlpha(false);
384385
mScreenBitmap.prepareToDraw();

0 commit comments

Comments
 (0)