summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mark Renouf <mrenouf@google.com> 2022-06-28 20:27:46 +0000
committer Mark Renouf <mrenouf@google.com> 2022-07-06 13:09:59 +0000
commita433556fc07feed84f18ff050428e3edf4fd9e22 (patch)
tree31f41089e95c6c526a3bbbe06cc17eefd633dad4
parent0251a89274a6b4d641aa1d3d751b80b2130279b1 (diff)
Fix crash due to race on close()
It's possible for close to be called during local cleanup concurrently with the remote call. A recent change (ag/15993920) added a missing Binder.unlinkToDeath call to close(). This now causes a crash now if the registration was removed at just the right time in another thread. This synchronizes access to close() to avoid this. Bug: 237406501 Test: atest ScrollCaptureConnectionTest Change-Id: I0126bfac1efdece2e4eff144a44f29a963553b74
-rw-r--r--core/java/android/view/ScrollCaptureConnection.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/java/android/view/ScrollCaptureConnection.java b/core/java/android/view/ScrollCaptureConnection.java
index d70de74ee75f..c50f70a08063 100644
--- a/core/java/android/view/ScrollCaptureConnection.java
+++ b/core/java/android/view/ScrollCaptureConnection.java
@@ -214,7 +214,7 @@ public class ScrollCaptureConnection extends IScrollCaptureConnection.Stub imple
@BinderThread
@Override
- public void close() {
+ public synchronized void close() {
Trace.instantForTrack(TRACE_TAG_GRAPHICS, TRACE_TRACK, "close");
if (mActive) {
Log.w(TAG, "close(): capture session still active! Ending now.");