WallpaperService: Respond to WM protocol change.

The client is now responsible for updating the size of its own Surface.
When we updated ViewRootImpl we forgot to make this change for wallpaper
service.

Bug: 172346563
Test: Existing tests pass.
Change-Id: I2107106c8057151f3fa0d9761ce88abeefc58350
This commit is contained in:
Robert Carr
2020-11-24 15:07:30 -08:00
committed by Rob Carr
parent 8b819c0a03
commit c6036ba887

View File

@@ -199,6 +199,7 @@ public abstract class WallpaperService extends Service {
final InsetsSourceControl[] mTempControls = new InsetsSourceControl[0];
final MergedConfiguration mMergedConfiguration = new MergedConfiguration();
private final Point mSurfaceSize = new Point();
private final Point mLastSurfaceSize = new Point();
private final Matrix mTmpMatrix = new Matrix();
private final float[] mTmpValues = new float[9];
@@ -908,6 +909,14 @@ public abstract class WallpaperService extends Service {
if (mSurfaceControl.isValid()) {
mSurfaceHolder.mSurface.copyFrom(mSurfaceControl);
}
if (!mLastSurfaceSize.equals(mSurfaceSize)) {
mLastSurfaceSize.set(mSurfaceSize.x, mSurfaceSize.y);
if (mSurfaceControl != null && mSurfaceControl.isValid()) {
SurfaceControl.Transaction t = new SurfaceControl.Transaction();
t.setBufferSize(mSurfaceControl, mSurfaceSize.x, mSurfaceSize.y);
t.apply();
}
}
if (DEBUG) Log.v(TAG, "New surface: " + mSurfaceHolder.mSurface
+ ", frame=" + mWinFrames);