1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 /** 18 * @file hardware_buffer_jni.h 19 */ 20 21 #ifndef ANDROID_HARDWARE_BUFFER_JNI_H 22 #define ANDROID_HARDWARE_BUFFER_JNI_H 23 24 #include <sys/cdefs.h> 25 26 #include <android/hardware_buffer.h> 27 28 #include <jni.h> 29 30 __BEGIN_DECLS 31 32 /** 33 * Return the AHardwareBuffer associated with a Java HardwareBuffer object, 34 * for interacting with it through native code. This method does not acquire any 35 * additional reference to the AHardwareBuffer that is returned. To keep the 36 * AHardwareBuffer live after the Java HardwareBuffer object got garbage 37 * collected, be sure to use AHardwareBuffer_acquire() to acquire an additional 38 * reference. 39 */ 40 AHardwareBuffer* AHardwareBuffer_fromHardwareBuffer(JNIEnv* env, 41 jobject hardwareBufferObj); 42 43 /** 44 * Return a new Java HardwareBuffer object that wraps the passed native 45 * AHardwareBuffer object. 46 */ 47 jobject AHardwareBuffer_toHardwareBuffer(JNIEnv* env, 48 AHardwareBuffer* hardwareBuffer); 49 50 __END_DECLS 51 52 #endif // ANDROID_HARDWARE_BUFFER_JNI_H 53