From 822acc9e892deca7a809fbf32e9255c93cf55612 Mon Sep 17 00:00:00 2001 From: Matt Buckley Date: Wed, 11 Dec 2024 22:31:23 -0800 Subject: 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 --- include/android/performance_hint.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/android') 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. -- cgit v1.2.3-59-g8ed1b