ScreenRotationAnimation: Use Surface#setScalingMode

We are the last user of SurfaceControl#setOverrideScalingMode
in ScreenRotationAnimation we have no need to call it since we
are the BufferProducer and we can just use Surface#setScalingMode

Bug: 161937501
Test: Existing tests pass
Change-Id: I049145a91fedbbca5f009648f1537b0380c5e771
This commit is contained in:
Robert Carr
2020-10-06 13:41:15 -07:00
parent f09bdfc4f7
commit 7675809673
2 changed files with 5 additions and 7 deletions

View File

@@ -739,7 +739,7 @@ public class Surface implements Parcelable {
* Set the scaling mode to be used for this surfaces buffers
* @hide
*/
void setScalingMode(@ScalingMode int scalingMode) {
public void setScalingMode(@ScalingMode int scalingMode) {
synchronized (mLock) {
checkNotReleasedLocked();
int err = nativeSetScalingMode(mNativeObject, scalingMode);

View File

@@ -203,16 +203,14 @@ class ScreenRotationAnimation {
.setCallsite("ScreenRotationAnimation")
.build();
// In case display bounds change, screenshot buffer and surface may mismatch so set a
// scaling mode.
SurfaceControl.Transaction t2 = mService.mTransactionFactory.get();
t2.setOverrideScalingMode(mScreenshotLayer, Surface.SCALING_MODE_SCALE_TO_WINDOW);
t2.apply(true /* sync */);
// Capture a screenshot into the surface we just created.
final int displayId = displayContent.getDisplayId();
final Surface surface = mService.mSurfaceFactory.get();
// In case display bounds change, screenshot buffer and surface may mismatch so set a
// scaling mode.
surface.copyFrom(mScreenshotLayer);
surface.setScalingMode(Surface.SCALING_MODE_SCALE_TO_WINDOW);
SurfaceControl.ScreenshotHardwareBuffer screenshotBuffer =
mService.mDisplayManagerInternal.systemScreenshot(displayId);
if (screenshotBuffer != null) {