diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java index 90384b5203154..c32ca9e2e2158 100644 --- a/core/java/android/view/contentcapture/MainContentCaptureSession.java +++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java @@ -528,7 +528,12 @@ public final class MainContentCaptureSession extends ContentCaptureSession { @Override @UiThread void flush(@FlushReason int reason) { - if (mEvents == null) return; + if (mEvents == null || mEvents.size() == 0) { + if (sVerbose) { + Log.v(TAG, "Don't flush for empty event buffer."); + } + return; + } if (mDisabled.get()) { Log.e(TAG, "handleForceFlush(" + getDebugState(reason) + "): should not be when "