From 8d17c4547a43580d96713111622fe0f341dd34e9 Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Tue, 19 Apr 2022 23:40:53 +0000 Subject: javaObjectForIBinder: warn rets global and local Trying to manually delete the result of this function as a local ref is problematic. Bug: 227719836 Test: N/A Change-Id: I267eaa25202fccc047aa23d1d0a45ed212e4ce10 --- libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h b/libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h index 6880d86e1a..8e288b307e 100644 --- a/libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h +++ b/libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h @@ -56,6 +56,12 @@ __attribute__((warn_unused_result)) AIBinder* AIBinder_fromJavaBinder(JNIEnv* en * If the binder is null, null is returned. If this binder object was originally an IBinder object, * the original java object will be returned. * + * WARNING: this function returns global and local references. This can be + * figured out using GetObjectRefType. Though, when this function is called + * from within a Java context, the local ref will automatically be cleaned + * up. If this is called outside of a Java frame, + * PushObjectFrame/PopObjectFrame can simulate this automatic cleanup. + * * Available since API level 29. * * \param env Java environment. Must not be null. -- cgit v1.2.3-59-g8ed1b