Catch exception when unlinkToDeath
Catch the exception to avoid the system down. Bug: 238417834 Test: atest CtsCaontentCaptureService Change-Id: Ifacb91d9e961b71df0ac41690b952be981711870
This commit is contained in:
@@ -64,6 +64,7 @@ import java.lang.ref.WeakReference;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -630,7 +631,11 @@ public final class MainContentCaptureSession extends ContentCaptureSession {
|
|||||||
mComponentName = null;
|
mComponentName = null;
|
||||||
mEvents = null;
|
mEvents = null;
|
||||||
if (mDirectServiceInterface != null) {
|
if (mDirectServiceInterface != null) {
|
||||||
|
try {
|
||||||
mDirectServiceInterface.asBinder().unlinkToDeath(mDirectServiceVulture, 0);
|
mDirectServiceInterface.asBinder().unlinkToDeath(mDirectServiceVulture, 0);
|
||||||
|
} catch (NoSuchElementException e) {
|
||||||
|
Log.w(TAG, "IContentCaptureDirectManager does not exist");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mDirectServiceInterface = null;
|
mDirectServiceInterface = null;
|
||||||
mHandler.removeMessages(MSG_FLUSH);
|
mHandler.removeMessages(MSG_FLUSH);
|
||||||
|
|||||||
Reference in New Issue
Block a user