From 6f5a5c481ad58ff1d24d5c38674964c0eb9f9909 Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Tue, 21 Apr 2020 16:20:05 +0800 Subject: [PATCH] Remove invocation of closeTransaction while using a11y service The operation applies to a local transaction, so it should not touch the global transaction. Bug: 143734779 Test atest AccessibilityWindowManagerTest# setAccessibilityWindowIdToSurfaceMetadata Test: Enable accessibility service (e.g. TalkBack) and check logcat shouldn't have "Call to SurfaceControl.closeTransaction without matching openTransaction". Change-Id: I5a2879656471c85f91931e385e4873b4499ed977 --- .../com/android/server/wm/WindowManagerService.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index a5014145aa60f..8720458873315 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -7658,15 +7658,8 @@ public class WindowManagerService extends IWindowManager.Stub Slog.w(TAG, "Cannot find window which accessibility connection is added to"); return; } - try (SurfaceControl.Transaction t = new SurfaceControl.Transaction()) { - t.setMetadata( - state.mSurfaceControl, - SurfaceControl.METADATA_ACCESSIBILITY_ID, - accessibilityWindowId); - t.apply(); - } finally { - SurfaceControl.closeTransaction(); - } + mTransaction.setMetadata(state.mSurfaceControl, + SurfaceControl.METADATA_ACCESSIBILITY_ID, accessibilityWindowId).apply(); } }