Remove crop for Windowless Window leash

The crop creates interference with syncing an embedded window because
the crop doesn't happen in sync. Since the crop is really not needed,
it's simpler to just remove it.

Additionally, GL Surfaces were not setting scaling mode to
NATIVE_WINDOW_SCALING_MODE_FREEZE which prevents the sync from working
properly since the content would scale to the new size before a buffer
was sent. Since HWUI expects NATIVE_WINDOW_SCALING_MODE_FREEZE, this CL
also changes the scaling mode in CanvasContext for the surface used by
HWUI.

Added SurfaceSyncGroupContinuousTest presubmit test

Test: SurfaceSyncGroupContinuousTest
Bug: 237804605
Change-Id: I84c60c2a6fd6a88a1927138a0a93fbd0c16dfb6d
This commit is contained in:
Chavi Weingarten
2023-01-24 21:14:11 +00:00
parent 5916e506dd
commit 084f9f9890
4 changed files with 26 additions and 5 deletions

View File

@@ -361,7 +361,6 @@ public class WindowlessWindowManager implements IWindowSession {
}
t.setPosition(leash, frames.frame.left, frames.frame.top);
t.setWindowCrop(leash, frames.frame.width(), frames.frame.height());
if (viewFlags == View.VISIBLE) {
// TODO(b/262892794) ViewRootImpl modifies the app's rendering SurfaceControl

View File

@@ -248,6 +248,8 @@ void CanvasContext::setupPipelineSurface() {
// Order is important when new and old surfaces are the same, because old surface has
// its frame stats disabled automatically.
native_window_enable_frame_timestamps(mNativeSurface->getNativeWindow(), true);
native_window_set_scaling_mode(mNativeSurface->getNativeWindow(),
NATIVE_WINDOW_SCALING_MODE_FREEZE);
} else {
mRenderThread.removeFrameCallback(this);
mGenerationID++;

View File

@@ -22,6 +22,7 @@ import static android.server.wm.WindowManagerState.getLogicalDisplaySize;
import android.app.KeyguardManager;
import android.os.PowerManager;
import android.platform.test.annotations.Presubmit;
import android.view.SurfaceControl;
import android.view.cts.surfacevalidator.CapturedActivity;
import android.window.SurfaceSyncGroup;
@@ -68,11 +69,23 @@ public class SurfaceSyncGroupContinuousTest {
@Test
public void testSurfaceControlViewHostIPCSync_Fast() throws Throwable {
mCapturedActivity.verifyTest(new SyncValidatorSCVHTestCase(0 /* delayMs */), mName);
mCapturedActivity.verifyTest(
new SyncValidatorSCVHTestCase(0 /* delayMs */, false /* overrideDefaultDuration */),
mName);
}
@Test
public void testSurfaceControlViewHostIPCSync_Slow() throws Throwable {
mCapturedActivity.verifyTest(new SyncValidatorSCVHTestCase(100 /* delayMs */), mName);
mCapturedActivity.verifyTest(new SyncValidatorSCVHTestCase(100 /* delayMs */,
false /* overrideDefaultDuration */), mName);
}
@Test
@Presubmit
public void testSurfaceControlViewHostIPCSync_Short() throws Throwable {
mCapturedActivity.setMinimumCaptureDurationMs(5000);
mCapturedActivity.verifyTest(
new SyncValidatorSCVHTestCase(0 /* delayMs */, true /* overrideDefaultDuration */),
mName);
}
}

View File

@@ -54,10 +54,12 @@ public class SyncValidatorSCVHTestCase implements ISurfaceValidatorTestCase {
new Point(300, 800), new Point(200, 200)};
private int mLastSizeIndex = 1;
private long mDelayMs;
private final long mDelayMs;
private final boolean mOverrideDefaultDuration;
public SyncValidatorSCVHTestCase(long delayMs) {
public SyncValidatorSCVHTestCase(long delayMs, boolean overrideDefaultDuration) {
mDelayMs = delayMs;
mOverrideDefaultDuration = overrideDefaultDuration;
}
private final Runnable mRunnable = new Runnable() {
@@ -231,4 +233,9 @@ public class SyncValidatorSCVHTestCase implements ISurfaceValidatorTestCase {
public void end() {
mHandler.removeCallbacks(mRunnable);
}
@Override
public boolean hasAnimation() {
return !mOverrideDefaultDuration;
}
}