diff --git a/core/java/android/view/contentcapture/ContentCaptureSession.java b/core/java/android/view/contentcapture/ContentCaptureSession.java index cc47f09d4e8d0..a4db840551421 100644 --- a/core/java/android/view/contentcapture/ContentCaptureSession.java +++ b/core/java/android/view/contentcapture/ContentCaptureSession.java @@ -290,6 +290,8 @@ public abstract class ContentCaptureSession implements AutoCloseable { *
Typically used to change the context associated with the default session from an activity. */ public final void setContentCaptureContext(@Nullable ContentCaptureContext context) { + if (!isContentCaptureEnabled()) return; + mClientContext = context; updateContentCaptureContext(context); }