From 9e9800c568439212fb1a8f05f94c61ddc197f7ee Mon Sep 17 00:00:00 2001 From: Lloyd Pique Date: Tue, 26 Feb 2019 16:26:09 -0800 Subject: [PATCH] SF: Fix for a leaked mock reported in processesVirtualDisplayAdded I'm not sure why it only started being reported recently, but removing the injected virtual display from the SurfaceFlinger current/drawing state fixes the leak. Bug: None Test: adb shell libsurfaceflinger_unittest Change-Id: Ibaf1a8878e296707b9fbbd0a647908cc1205cdc2 --- services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp index 1487d47109..9bf29a212f 100644 --- a/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp +++ b/services/surfaceflinger/tests/unittests/DisplayTransactionTest.cpp @@ -1926,6 +1926,10 @@ TEST_F(HandleTransactionLockedTest, processesVirtualDisplayAdded) { EXPECT_CALL(*mComposer, destroyVirtualDisplay(Case::Display::HWC_DISPLAY_ID)) .WillOnce(Return(Error::NONE)); EXPECT_CALL(*mConsumer, consumerDisconnect()).WillOnce(Return(NO_ERROR)); + + // Cleanup + mFlinger.mutableCurrentState().displays.removeItem(displayToken); + mFlinger.mutableDrawingState().displays.removeItem(displayToken); } TEST_F(HandleTransactionLockedTest, processesVirtualDisplayAddedWithNoSurface) { -- 2.11.0