From b9932b66e6933a316ce2d9636170171ac9eef7ab Mon Sep 17 00:00:00 2001 From: Chuwei Xu Date: Fri, 22 Mar 2019 14:55:55 +0800 Subject: [PATCH] DO NOT MERGE Fix CtsActivityManagerDeviceTestCases fails Avoid 'Failed to create EGLSurface for window 0x951b6808, eglErr = EGL_BAD_ALLOC'. testStackFocusSwitchOnDisplayRemoved, testStackFocusSwitchOnDisplayRemoved2, testStackFocusSwitchOnDisplayRemoved3 can have the same problem. When these testcases release the VirtualDisplay, it will trigger onParentSet() in TaskStackContainers.At that time mBoostedAppAnimationLayer may be used for animating, and ResizeableActivity is in it. So mBoostedAppAnimationLayer.destroy() can also destroy the surface of ResizeableActivity, but at the same time config changed will make mAttachInfo.mThreadedRenderer.updateSurface(mSurface) of performTraversals() in ViewRootImpl to update the surface and cause crash like 'Failed to create EGLSurface for window 0x951b6808,eglErr = EGL_BAD_ALLOC'. So change to use transaction to call destroy() for mBoostedAppAnimationLayer to delay it, then ResizeableActivity is not in mBoostedAppAnimationLayer and can test pass. Bug: 127896059 Test: run cts-on-gsi -m CtsActivityManagerDeviceTestCases -t android.server.am.ActivityManagerMultiDisplayTests Change-Id: I44ee86d1620f9c2953c574146ec6f529ce6f4656 --- .../java/com/android/server/wm/DisplayContent.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java index 22ac65df4337e..1fb28e1969a8f 100644 --- a/services/core/java/com/android/server/wm/DisplayContent.java +++ b/services/core/java/com/android/server/wm/DisplayContent.java @@ -3703,13 +3703,19 @@ class DisplayContent extends WindowContainer