From d93ed17d5eac1d7ca542ef7e5d771a123431d0fe Mon Sep 17 00:00:00 2001 From: Adam He Date: Tue, 18 Jun 2019 16:51:57 -0700 Subject: [PATCH] Fixed event flushing to handle when mDirectServiceInterface is not ready yet. Fixes: 135474027 Test: atest CtsContentCaptureServiceTestCases Change-Id: I5bc12cd5f48138650c82b052c785a505fc8f4773 --- .../contentcapture/MainContentCaptureSession.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java index c5a5f7360321d..cee79439d1b3d 100644 --- a/core/java/android/view/contentcapture/MainContentCaptureSession.java +++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java @@ -428,14 +428,16 @@ public final class MainContentCaptureSession extends ContentCaptureSession { } final int flushFrequencyMs; - if (reason == FLUSH_REASON_IDLE_TIMEOUT) { - flushFrequencyMs = mManager.mOptions.idleFlushingFrequencyMs; - } else if (reason == FLUSH_REASON_TEXT_CHANGE_TIMEOUT) { + if (reason == FLUSH_REASON_TEXT_CHANGE_TIMEOUT) { flushFrequencyMs = mManager.mOptions.textChangeFlushingFrequencyMs; } else { - Log.e(TAG, "handleScheduleFlush(" + getDebugState(reason) + "): not called with a " - + "timeout reason."); - return; + if (reason != FLUSH_REASON_IDLE_TIMEOUT) { + if (sDebug) { + Log.d(TAG, "handleScheduleFlush(" + getDebugState(reason) + "): not a timeout " + + "reason because mDirectServiceInterface is not ready yet"); + } + } + flushFrequencyMs = mManager.mOptions.idleFlushingFrequencyMs; } mNextFlush = System.currentTimeMillis() + flushFrequencyMs;