Merge "ImageWallpaper: Only draw on valid surfaces" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
05be517fb7
@@ -158,6 +158,7 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
private int mLastRequestedHeight = -1;
|
private int mLastRequestedHeight = -1;
|
||||||
private AsyncTask<Void, Void, Bitmap> mLoader;
|
private AsyncTask<Void, Void, Bitmap> mLoader;
|
||||||
private boolean mNeedsDrawAfterLoadingWallpaper;
|
private boolean mNeedsDrawAfterLoadingWallpaper;
|
||||||
|
private boolean mSurfaceValid;
|
||||||
|
|
||||||
public DrawableEngine() {
|
public DrawableEngine() {
|
||||||
super();
|
super();
|
||||||
@@ -248,11 +249,6 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTouchEvent(MotionEvent event) {
|
|
||||||
super.onTouchEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onOffsetsChanged(float xOffset, float yOffset,
|
public void onOffsetsChanged(float xOffset, float yOffset,
|
||||||
float xOffsetStep, float yOffsetStep,
|
float xOffsetStep, float yOffsetStep,
|
||||||
@@ -288,13 +284,23 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
@Override
|
@Override
|
||||||
public void onSurfaceDestroyed(SurfaceHolder holder) {
|
public void onSurfaceDestroyed(SurfaceHolder holder) {
|
||||||
super.onSurfaceDestroyed(holder);
|
super.onSurfaceDestroyed(holder);
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.i(TAG, "onSurfaceDestroyed");
|
||||||
|
}
|
||||||
|
|
||||||
mLastSurfaceWidth = mLastSurfaceHeight = -1;
|
mLastSurfaceWidth = mLastSurfaceHeight = -1;
|
||||||
|
mSurfaceValid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSurfaceCreated(SurfaceHolder holder) {
|
public void onSurfaceCreated(SurfaceHolder holder) {
|
||||||
super.onSurfaceCreated(holder);
|
super.onSurfaceCreated(holder);
|
||||||
|
if (DEBUG) {
|
||||||
|
Log.i(TAG, "onSurfaceCreated");
|
||||||
|
}
|
||||||
|
|
||||||
mLastSurfaceWidth = mLastSurfaceHeight = -1;
|
mLastSurfaceWidth = mLastSurfaceHeight = -1;
|
||||||
|
mSurfaceValid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -314,6 +320,9 @@ public class ImageWallpaper extends WallpaperService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void drawFrame() {
|
void drawFrame() {
|
||||||
|
if (!mSurfaceValid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
DisplayInfo displayInfo = getDefaultDisplayInfo();
|
DisplayInfo displayInfo = getDefaultDisplayInfo();
|
||||||
int newRotation = displayInfo.rotation;
|
int newRotation = displayInfo.rotation;
|
||||||
|
|||||||
Reference in New Issue
Block a user