diff options
6 files changed, 20 insertions, 17 deletions
diff --git a/core/java/android/view/contentcapture/ChildContentCaptureSession.java b/core/java/android/view/contentcapture/ChildContentCaptureSession.java index 8baa55f8e377..6e2e1009fd40 100644 --- a/core/java/android/view/contentcapture/ChildContentCaptureSession.java +++ b/core/java/android/view/contentcapture/ChildContentCaptureSession.java @@ -74,8 +74,8 @@ final class ChildContentCaptureSession extends ContentCaptureSession { } @Override - void flush(@FlushReason int reason) { - mParent.flush(reason); + void internalFlush(@FlushReason int reason) { + mParent.internalFlush(reason); } @Override diff --git a/core/java/android/view/contentcapture/ContentCaptureManager.java b/core/java/android/view/contentcapture/ContentCaptureManager.java index 3f3484d5a527..b7a77d701045 100644 --- a/core/java/android/view/contentcapture/ContentCaptureManager.java +++ b/core/java/android/view/contentcapture/ContentCaptureManager.java @@ -663,7 +663,7 @@ public final class ContentCaptureManager { @UiThread public void flush(@FlushReason int reason) { if (mOptions.lite) return; - getMainContentCaptureSession().flush(reason); + getMainContentCaptureSession().internalFlush(reason); } /** diff --git a/core/java/android/view/contentcapture/ContentCaptureSession.java b/core/java/android/view/contentcapture/ContentCaptureSession.java index 6bb2975d9cf1..791a6f4254ec 100644 --- a/core/java/android/view/contentcapture/ContentCaptureSession.java +++ b/core/java/android/view/contentcapture/ContentCaptureSession.java @@ -342,7 +342,7 @@ public abstract class ContentCaptureSession implements AutoCloseable { /** * Flushes the buffered events to the service. */ - abstract void flush(@FlushReason int reason); + abstract void internalFlush(@FlushReason int reason); /** * Sets the {@link ContentCaptureContext} associated with the session. diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java index eddfc42da9bd..29cae857098d 100644 --- a/core/java/android/view/contentcapture/MainContentCaptureSession.java +++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java @@ -375,7 +375,7 @@ public final class MainContentCaptureSession extends ContentCaptureSession { void onDestroy() { clearAndRunOnContentCaptureThread(() -> { try { - flush(FLUSH_REASON_SESSION_FINISHED); + internalFlush(FLUSH_REASON_SESSION_FINISHED); } finally { destroySession(); } @@ -623,7 +623,7 @@ public final class MainContentCaptureSession extends ContentCaptureSession { flushReason = forceFlush ? FLUSH_REASON_FORCE_FLUSH : FLUSH_REASON_FULL; } - flush(flushReason); + internalFlush(flushReason); } private boolean hasStarted() { @@ -687,15 +687,18 @@ public final class MainContentCaptureSession extends ContentCaptureSession { if (sVerbose) Log.v(TAG, "Nothing to flush"); return; } - flush(reason); + internalFlush(reason); } - /** @hide */ + /** + * Internal API to flush the buffered events to the service. + * + * Do not confuse this with the public API {@link #flush()}. + * + * @hide */ @VisibleForTesting(visibility = VisibleForTesting.Visibility.PACKAGE) @Override - public void flush(@FlushReason int reason) { - // TODO: b/380381249 renaming the internal APIs to prevent confusions between this and the - // public API. + public void internalFlush(@FlushReason int reason) { runOnContentCaptureThread(() -> flushImpl(reason)); } diff --git a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java index f87b6994900f..ee8d428d8370 100644 --- a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java +++ b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java @@ -224,7 +224,7 @@ public class ContentCaptureSessionTest { } @Override - void flush(int reason) { + void internalFlush(int reason) { throw new UnsupportedOperationException("should not have been called"); } diff --git a/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java b/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java index 4a5123ec0663..a1d7f87614e4 100644 --- a/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java +++ b/core/tests/coretests/src/android/view/contentcapture/MainContentCaptureSessionTest.java @@ -263,7 +263,7 @@ public class MainContentCaptureSessionTest { session.mEvents = new ArrayList<>(Arrays.asList(EVENT)); session.mDirectServiceInterface = mMockContentCaptureDirectManager; - session.flush(REASON); + session.internalFlush(REASON); mTestableLooper.processAllMessages(); verifyZeroInteractions(mMockContentProtectionEventProcessor); @@ -280,7 +280,7 @@ public class MainContentCaptureSessionTest { session.mEvents = new ArrayList<>(Arrays.asList(EVENT)); session.mDirectServiceInterface = mMockContentCaptureDirectManager; - session.flush(REASON); + session.internalFlush(REASON); mTestableLooper.processAllMessages(); verifyZeroInteractions(mMockContentProtectionEventProcessor); @@ -298,7 +298,7 @@ public class MainContentCaptureSessionTest { session.mEvents = new ArrayList<>(Arrays.asList(EVENT)); session.mDirectServiceInterface = mMockContentCaptureDirectManager; - session.flush(REASON); + session.internalFlush(REASON); mTestableLooper.processAllMessages(); verifyZeroInteractions(mMockContentProtectionEventProcessor); @@ -316,7 +316,7 @@ public class MainContentCaptureSessionTest { session.mEvents = new ArrayList<>(Arrays.asList(EVENT)); session.mDirectServiceInterface = mMockContentCaptureDirectManager; - session.flush(REASON); + session.internalFlush(REASON); mTestableLooper.processAllMessages(); verifyZeroInteractions(mMockContentProtectionEventProcessor); @@ -544,7 +544,7 @@ public class MainContentCaptureSessionTest { session.mContentCaptureHandler = null; session.mDirectServiceInterface = null; - session.flush(REASON); + session.internalFlush(REASON); assertThat(session.mEvents).hasSize(1); assertThat(session.mEventProcessQueue).isEmpty(); |