diff options
author | Steven Moreland <smoreland@google.com> | 2022-04-19 23:40:53 +0000 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2022-04-21 16:26:49 +0000 |
commit | 8d17c4547a43580d96713111622fe0f341dd34e9 (patch) | |
tree | 4ef92009e14f6284d5a474b8786ab7e6de751a35 | |
parent | ebfcecb72022013c39028ecae50e368102829b68 (diff) | |
download | native-8d17c4547a43580d96713111622fe0f341dd34e9.tar.gz |
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
-rw-r--r-- | libs/binder/ndk/include_ndk/android/binder_ibinder_jni.h | 6 |
1 files changed, 6 insertions, 0 deletions
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. |