From 60b765b707a88a97d7f8aed76b5ea753601cb1ff Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Wed, 16 Aug 2017 12:29:53 -0700 Subject: Fixed synchronization when calling cancellation signal. Test: none for this particular issue, but CtsAutoFillServiceTestCases pass Bug: 64759228 Change-Id: Ifaf0082de55ddb5446af134e190c89f7e10bf1fe --- .../java/com/android/server/autofill/RemoteFillService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java index f8c0e27643b3..dd980535f628 100644 --- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java +++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java @@ -562,7 +562,10 @@ final class RemoteFillService implements DeathRecipient { void onTimeout(RemoteFillService remoteService) { // NOTE: Must make these 2 calls asynchronously, because the cancellation signal is // handled by the service, which could block. - final ICancellationSignal cancellation = mCancellation; + final ICancellationSignal cancellation; + synchronized (mLock) { + cancellation = mCancellation; + } if (cancellation != null) { remoteService.dispatchOnFillTimeout(cancellation); } @@ -587,7 +590,10 @@ final class RemoteFillService implements DeathRecipient { public boolean cancel() { if (!super.cancel()) return false; - final ICancellationSignal cancellation = mCancellation; + final ICancellationSignal cancellation; + synchronized (mLock) { + cancellation = mCancellation; + } if (cancellation != null) { try { cancellation.cancel(); -- cgit v1.2.3-59-g8ed1b