From 86a32d0d4ee7b9ba85d9797e9f1d9a418ee224d6 Mon Sep 17 00:00:00 2001 From: Saho Kobayashi Date: Tue, 2 May 2023 15:51:19 +0900 Subject: [PATCH] Correctly remove drag surface when perform drag failed Currently DragDropController uses release to remove drag surface when performDrag fails, but release does not remove the surface from the screen. This CL changes release to remove to correctly remove the drag surface. Bug: 278663749 Test: DragDropControllerTests Change-Id: I47f8c279fb49944e540078187437a4d7b153e721 --- .../core/java/com/android/server/wm/DragDropController.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/DragDropController.java b/services/core/java/com/android/server/wm/DragDropController.java index 2583514361887..4a3d0c142e1d1 100644 --- a/services/core/java/com/android/server/wm/DragDropController.java +++ b/services/core/java/com/android/server/wm/DragDropController.java @@ -181,7 +181,11 @@ class DragDropController { } } finally { if (surface != null) { - surface.release(); + try (final SurfaceControl.Transaction transaction = + mService.mTransactionFactory.get()) { + transaction.remove(surface); + transaction.apply(); + } } } }