summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTYM Tsai <tymtsai@google.com>2022-07-19 05:56:51 +0000
committerTYM Tsai <tymtsai@google.com>2022-07-27 01:59:20 +0000
commitd30a3c7f85af7764f2a4bd14bc5dfd2294cfad7f (patch)
tree627b6d4c4d2b1f706c77dbb90df549f3efd0a381 /core/java/android
parent9d30d715fce8e8f6d36a4c23369b99900604ae45 (diff)
Catch exception when unlinkToDeath
Catch the exception to avoid the system down. Bug: 238417834 Test: atest CtsCaontentCaptureService Change-Id: Ifacb91d9e961b71df0ac41690b952be981711870 Merged-In: Ifacb91d9e961b71df0ac41690b952be981711870
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/view/contentcapture/MainContentCaptureSession.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java
index 98ef4e7ae6fa..90384b520315 100644
--- a/core/java/android/view/contentcapture/MainContentCaptureSession.java
+++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java
@@ -64,6 +64,7 @@ import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.NoSuchElementException;
import java.util.concurrent.atomic.AtomicBoolean;
/**
@@ -630,7 +631,11 @@ public final class MainContentCaptureSession extends ContentCaptureSession {
mComponentName = null;
mEvents = null;
if (mDirectServiceInterface != null) {
- mDirectServiceInterface.asBinder().unlinkToDeath(mDirectServiceVulture, 0);
+ try {
+ mDirectServiceInterface.asBinder().unlinkToDeath(mDirectServiceVulture, 0);
+ } catch (NoSuchElementException e) {
+ Log.w(TAG, "IContentCaptureDirectManager does not exist");
+ }
}
mDirectServiceInterface = null;
mHandler.removeMessages(MSG_FLUSH);