summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/service/wallpaper/IWallpaperEngine.aidl2
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java25
2 files changed, 10 insertions, 17 deletions
diff --git a/core/java/android/service/wallpaper/IWallpaperEngine.aidl b/core/java/android/service/wallpaper/IWallpaperEngine.aidl
index 93d4def2180e..1a00acf475e3 100644
--- a/core/java/android/service/wallpaper/IWallpaperEngine.aidl
+++ b/core/java/android/service/wallpaper/IWallpaperEngine.aidl
@@ -42,7 +42,7 @@ interface IWallpaperEngine {
@UnsupportedAppUsage
oneway void destroy();
oneway void setZoomOut(float scale);
- oneway void scalePreview(in Rect positionInWindow);
+ oneway void resizePreview(in Rect positionInWindow);
oneway void removeLocalColorsAreas(in List<RectF> regions);
oneway void addLocalColorsAreas(in List<RectF> regions);
SurfaceControl mirrorSurfaceControl();
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 2175859d9de6..2d1a41e92a99 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -163,7 +163,7 @@ public abstract class WallpaperService extends Service {
private static final int MSG_TOUCH_EVENT = 10040;
private static final int MSG_REQUEST_WALLPAPER_COLORS = 10050;
private static final int MSG_ZOOM = 10100;
- private static final int MSG_SCALE_PREVIEW = 10110;
+ private static final int MSG_RESIZE_PREVIEW = 10110;
private static final int MSG_REPORT_SHOWN = 10150;
private static final int MSG_UPDATE_DIMMING = 10200;
private static final List<Float> PROHIBITED_STEPS = Arrays.asList(0f, Float.POSITIVE_INFINITY,
@@ -323,7 +323,7 @@ public abstract class WallpaperService extends Service {
@Override
public void setFixedSize(int width, int height) {
- if (!mFixedSizeAllowed) {
+ if (!mFixedSizeAllowed && !mIWallpaperEngine.mIsPreview) {
// Regular apps can't do this. It can only work for
// certain designs of window animations, so you can't
// rely on it.
@@ -1372,16 +1372,9 @@ public abstract class WallpaperService extends Service {
}
}
- private void scalePreview(Rect position) {
- if (isPreview() && mPreviewSurfacePosition == null && position != null
- || mPreviewSurfacePosition != null
- && !mPreviewSurfacePosition.equals(position)) {
- mPreviewSurfacePosition = position;
- if (mSurfaceControl.isValid()) {
- reposition();
- } else {
- updateSurface(false, false, false);
- }
+ private void resizePreview(Rect position) {
+ if (position != null) {
+ mSurfaceHolder.setFixedSize(position.width(), position.height());
}
}
@@ -2295,8 +2288,8 @@ public abstract class WallpaperService extends Service {
mCaller.sendMessage(msg);
}
- public void scalePreview(Rect position) {
- Message msg = mCaller.obtainMessageO(MSG_SCALE_PREVIEW, position);
+ public void resizePreview(Rect position) {
+ Message msg = mCaller.obtainMessageO(MSG_RESIZE_PREVIEW, position);
mCaller.sendMessage(msg);
}
@@ -2383,8 +2376,8 @@ public abstract class WallpaperService extends Service {
case MSG_UPDATE_DIMMING:
mEngine.updateWallpaperDimming(Float.intBitsToFloat(message.arg1));
break;
- case MSG_SCALE_PREVIEW:
- mEngine.scalePreview((Rect) message.obj);
+ case MSG_RESIZE_PREVIEW:
+ mEngine.resizePreview((Rect) message.obj);
break;
case MSG_VISIBILITY_CHANGED:
if (DEBUG) Log.v(TAG, "Visibility change in " + mEngine