diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java index f196f75861ec9..ad4ba76a17cb1 100644 --- a/core/java/android/view/contentcapture/MainContentCaptureSession.java +++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java @@ -583,9 +583,9 @@ public final class MainContentCaptureSession extends ContentCaptureSession { // NOTE: we must save a reference to the current mEvents and then set it to to null, // otherwise clearing it would clear it in the receiving side if the service is also local. final List events = mEvents == null - ? Collections.emptyList() - : mEvents; - mEvents = null; + ? Collections.EMPTY_LIST + : new ArrayList<>(mEvents); + mEvents.clear(); mLastComposingSpan.clear(); return new ParceledListSlice<>(events); }