summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Matt Buckley <mattbuckley@google.com> 2024-12-11 22:31:23 -0800
committer Matt Buckley <mattbuckley@google.com> 2024-12-12 14:34:24 -0800
commit822acc9e892deca7a809fbf32e9255c93cf55612 (patch)
treef63c56e0022112e2df28d921023a4332fec3b560
parent921e6125655e756a3e6084c798f27c48a5ef1527 (diff)
Update documentation on "borrowSessionFromJava"
Update the "APerformanceHint_borrowSessionFromJava" documentation to specify the lifetime of the returned pointer (it lives until the Java wrapper dies) Test: n/a Bug: 380300424 Flag: EXEMPT NDK Change-Id: I90c74893cdc6febf49cfde5eaa6a88d796660779
-rw-r--r--include/android/performance_hint.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/android/performance_hint.h b/include/android/performance_hint.h
index 2b4a5f5f53..9ea6549e8a 100644
--- a/include/android/performance_hint.h
+++ b/include/android/performance_hint.h
@@ -478,8 +478,13 @@ void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* _Nonnull aWorkDurati
/**
* Return the APerformanceHintSession wrapped by a Java PerformanceHintManager.Session object.
*
- * The Java session maintains ownership over the wrapped native session, so it cannot be
- * closed using {@link APerformanceHint_closeSession}.
+ * The Java session maintains ownership over the wrapped native session, so it cannot be closed
+ * using {@link APerformanceHint_closeSession}. The return value is valid until the Java object
+ * containing this value dies.
+ *
+ * The returned pointer is intended to be used by JNI calls to access native performance APIs using
+ * a Java hint session wrapper, and then immediately discarded. Using the pointer after the death of
+ * the Java container results in undefined behavior.
*
* @param env The Java environment where the PerformanceHintManager.Session lives.
* @param sessionObj The Java Session to unwrap.