am 0250bc2f: Merge "Catch exception when ViewRoot\'s surface is not valid. Bug #3399426" into honeycomb

* commit '0250bc2faca14a332155b9111e0ee5dfc8493d6a':
  Catch exception when ViewRoot's surface is not valid. Bug #3399426
This commit is contained in:
Romain Guy
2011-01-27 15:43:03 -08:00
committed by Android Git Automerger
2 changed files with 4 additions and 1 deletions

View File

@@ -1537,6 +1537,7 @@ public final class ViewRoot extends Handler implements ViewParent,
int top = dirty.top; int top = dirty.top;
int right = dirty.right; int right = dirty.right;
int bottom = dirty.bottom; int bottom = dirty.bottom;
canvas = surface.lockCanvas(dirty); canvas = surface.lockCanvas(dirty);
if (left != dirty.left || top != dirty.top || right != dirty.right || if (left != dirty.left || top != dirty.top || right != dirty.right ||

View File

@@ -296,8 +296,10 @@ static inline SkBitmap::Config convertPixelFormat(PixelFormat format)
static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect) static jobject Surface_lockCanvas(JNIEnv* env, jobject clazz, jobject dirtyRect)
{ {
const sp<Surface>& surface(getSurface(env, clazz)); const sp<Surface>& surface(getSurface(env, clazz));
if (!Surface::isValid(surface)) if (!Surface::isValid(surface)) {
doThrow(env, "java/lang/IllegalArgumentException", NULL);
return 0; return 0;
}
// get dirty region // get dirty region
Region dirtyRegion; Region dirtyRegion;