Loading libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +3 −1 Original line number Diff line number Diff line Loading @@ -435,7 +435,9 @@ class DragResizeInputListener implements AutoCloseable { } // Removing this surface on the background thread to ensure that mInitInputChannels has // already been finished. mSurfaceControlTransactionSupplier.get().remove(mDecorationSurface).apply(); // Do not |remove| the surface, the decoration might still be needed even if // drag-resizing isn't. mDecorationSurface.release(); }); } Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DragResizeInputListenerTest.kt +21 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.wm.shell.windowdecor.DragResizeInputListener.TaskResizeInputE import com.google.common.truth.Truth.assertThat import java.util.function.Consumer import java.util.function.Supplier import kotlin.test.assertNotNull import org.junit.After import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -69,9 +70,12 @@ class DragResizeInputListenerTest : ShellTestCase() { private val sinkInputChannel = mock<InputChannel>() private val decorationSurface = SurfaceControl.Builder().setName("decoration surface").build() private val createdSurfaces = ArrayList<SurfaceControl>() private val removedSurfaces = ArrayList<SurfaceControl>() @After fun tearDown() { createdSurfaces.clear() removedSurfaces.clear() decorationSurface.release() } Loading Loading @@ -217,6 +221,19 @@ class DragResizeInputListenerTest : ShellTestCase() { assertThat(createdSurfaces[1].isValid).isFalse() } @Test fun testClose_releasesDecorationSurfaceWithoutRemoval() { val inputListener = create() testBgExecutor.flushAll() inputListener.close() testMainExecutor.flushAll() testBgExecutor.flushAll() val decorationSurface = assertNotNull(createdSurfaces[0]) assertThat(decorationSurface.isValid).isFalse() assertThat(removedSurfaces.contains(decorationSurface)).isFalse() } private fun verifyNoInputChannelGrantRequests() { verify(mockWindowSession, never()) .grantInputChannel( Loading Loading @@ -258,7 +275,10 @@ class DragResizeInputListenerTest : ShellTestCase() { { object : StubTransaction() { override fun remove(sc: SurfaceControl): SurfaceControl.Transaction { return super.remove(sc).also { sc.release() } return super.remove(sc).also { sc.release() removedSurfaces.add(sc) } } } }, Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/DragResizeInputListener.java +3 −1 Original line number Diff line number Diff line Loading @@ -435,7 +435,9 @@ class DragResizeInputListener implements AutoCloseable { } // Removing this surface on the background thread to ensure that mInitInputChannels has // already been finished. mSurfaceControlTransactionSupplier.get().remove(mDecorationSurface).apply(); // Do not |remove| the surface, the decoration might still be needed even if // drag-resizing isn't. mDecorationSurface.release(); }); } Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/windowdecor/DragResizeInputListenerTest.kt +21 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import com.android.wm.shell.windowdecor.DragResizeInputListener.TaskResizeInputE import com.google.common.truth.Truth.assertThat import java.util.function.Consumer import java.util.function.Supplier import kotlin.test.assertNotNull import org.junit.After import org.junit.Test import org.junit.runner.RunWith Loading Loading @@ -69,9 +70,12 @@ class DragResizeInputListenerTest : ShellTestCase() { private val sinkInputChannel = mock<InputChannel>() private val decorationSurface = SurfaceControl.Builder().setName("decoration surface").build() private val createdSurfaces = ArrayList<SurfaceControl>() private val removedSurfaces = ArrayList<SurfaceControl>() @After fun tearDown() { createdSurfaces.clear() removedSurfaces.clear() decorationSurface.release() } Loading Loading @@ -217,6 +221,19 @@ class DragResizeInputListenerTest : ShellTestCase() { assertThat(createdSurfaces[1].isValid).isFalse() } @Test fun testClose_releasesDecorationSurfaceWithoutRemoval() { val inputListener = create() testBgExecutor.flushAll() inputListener.close() testMainExecutor.flushAll() testBgExecutor.flushAll() val decorationSurface = assertNotNull(createdSurfaces[0]) assertThat(decorationSurface.isValid).isFalse() assertThat(removedSurfaces.contains(decorationSurface)).isFalse() } private fun verifyNoInputChannelGrantRequests() { verify(mockWindowSession, never()) .grantInputChannel( Loading Loading @@ -258,7 +275,10 @@ class DragResizeInputListenerTest : ShellTestCase() { { object : StubTransaction() { override fun remove(sc: SurfaceControl): SurfaceControl.Transaction { return super.remove(sc).also { sc.release() } return super.remove(sc).also { sc.release() removedSurfaces.add(sc) } } } }, Loading