From 453fc364c3ef49f0a965b0df2c64a6d42b9dca9f Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Tue, 20 Jun 2017 10:47:55 -0700 Subject: [PATCH] Limit creating new surface for legacy apps to size changes. Creating the surface for every change (such as creation and visibility) can lead to issues swapping buffers. This changelist limits the action to only when the size changes. Change-Id: Ic549d244613a93a43a9f4ddf284bbfb0c13300fa Fixes: 62801621 Test: follow repro steps in bug, verified no crash. Test: go/wm-smoke --- core/java/android/view/SurfaceView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index 34ceeb7bcc0d1..7e0ade4c8d20f 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -641,7 +641,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb mSurface.copyFrom(mSurfaceControl); } - if (getContext().getApplicationInfo().targetSdkVersion + if (sizeChanged && getContext().getApplicationInfo().targetSdkVersion < Build.VERSION_CODES.O) { // Some legacy applications use the underlying native {@link Surface} object // as a key to whether anything has changed. In these cases, updates to the