OSDN Git Service

Fix surface frame size reporting.
authorJeff Brown <jeffbrown@google.com>
Tue, 25 Jan 2011 20:56:56 +0000 (12:56 -0800)
committerJeff Brown <jeffbrown@google.com>
Tue, 25 Jan 2011 21:10:30 +0000 (13:10 -0800)
commit30bc34f191ca8a009af313fc751e5b4bff6e39a1
treedf69e21f61230b146a7718f590efadb72f130772
parentb8942108826893657ca0b8b6d5d6d153739a76f6
Fix surface frame size reporting.

The SurfaceHolder provided by the wallpaper service was not reporting
the correct size in getSurfaceFrame().  This broke an optimization in
the ImageWallpaper.  The old code happened to work because calling
lockCanvas on the SurfaceHolder with a null dirty rectangle happened
to have the side-effect of updating the SurfaceHolder's surface frame
size field because it passed mSurfaceFrame as the dirty rect, causing
mSurfaceFrame to be set to the size of the region to be drawn.

However, relying on this side-effect is wrong.  Among other things,
the dirty region could actually be smaller than the surface frame.

This patch fixes WallpaperService, SurfaceView and ViewRoot to ensure
that the surface frame size is always set explicitly and is not modified
by calls to lockCanvas.

Change-Id: I10948f5ec269409ceaf0f7d32b3f6731e9499ebc
core/java/android/service/wallpaper/WallpaperService.java
core/java/android/view/SurfaceView.java
core/java/android/view/ViewRoot.java
core/java/com/android/internal/service/wallpaper/ImageWallpaper.java
core/java/com/android/internal/view/BaseSurfaceHolder.java
policy/src/com/android/internal/policy/impl/PhoneWindow.java