Merge changes from topic "presubmit-am-64e6e8709f7d4e6a844c50eac8f28918" into sc-v2-dev-plus-aosp
* changes:
[automerge] Fix Activity leak from ContentCapture Context-Updated event. 2p: 93debeaead
Fix Activity leak from ContentCapture Context-Updated event.
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);
}