[automerge] Fix Activity leak from ContentCapture Context-Updated event. 2p: 93debeaead

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16764050

Bug: 204891006
Change-Id: I3fa393e9f8e78b1e237ceed70e004949a7defe8c
diff --git a/core/java/android/view/contentcapture/ContentCaptureSession.java b/core/java/android/view/contentcapture/ContentCaptureSession.java
index cc47f09..a4db840 100644
--- a/core/java/android/view/contentcapture/ContentCaptureSession.java
+++ b/core/java/android/view/contentcapture/ContentCaptureSession.java
@@ -290,6 +290,8 @@
      * <p>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);
     }