|
49 | 49 | #define ANDROID_NATIVE_PERFORMANCE_HINT_H |
50 | 50 |
|
51 | 51 | #include <sys/cdefs.h> |
| 52 | +#include <jni.h> |
52 | 53 |
|
53 | 54 | /****************************************************************** |
54 | 55 | * |
@@ -202,6 +203,9 @@ int APerformanceHint_reportActualWorkDuration( |
202 | 203 | * Release the performance hint manager pointer acquired via |
203 | 204 | * {@link APerformanceHint_createSession}. |
204 | 205 | * |
| 206 | + * This cannot be used to close a Java PerformanceHintManager.Session, as its |
| 207 | + * lifecycle is tied to the object in the SDK. |
| 208 | + * |
205 | 209 | * @param session The performance hint session instance to release. |
206 | 210 | */ |
207 | 211 | void APerformanceHint_closeSession( |
@@ -370,6 +374,21 @@ void AWorkDuration_setActualCpuDurationNanos(AWorkDuration* _Nonnull aWorkDurati |
370 | 374 | void AWorkDuration_setActualGpuDurationNanos(AWorkDuration* _Nonnull aWorkDuration, |
371 | 375 | int64_t actualGpuDurationNanos) __INTRODUCED_IN(__ANDROID_API_V__); |
372 | 376 |
|
| 377 | +/** |
| 378 | + * Return the APerformanceHintSession wrapped by a Java PerformanceHintManager.Session object. |
| 379 | + * |
| 380 | + * The Java session maintains ownership over the wrapped native session, so it cannot be |
| 381 | + * closed using {@link APerformanceHint_closeSession}. |
| 382 | + * |
| 383 | + * @param env The Java environment where the PerformanceHintManager.Session lives. |
| 384 | + * @param sessionObj The Java Session to unwrap. |
| 385 | + * |
| 386 | + * @return A pointer to the APerformanceHintManager that backs the Java Session. |
| 387 | + */ |
| 388 | +APerformanceHintSession* _Nonnull APerformanceHint_borrowSessionFromJava( |
| 389 | + JNIEnv* _Nonnull env, jobject _Nonnull sessionObj) __INTRODUCED_IN(36); |
| 390 | + |
| 391 | + |
373 | 392 | __END_DECLS |
374 | 393 |
|
375 | 394 | #endif // ANDROID_NATIVE_PERFORMANCE_HINT_H |
|
0 commit comments