Debian Codegraph @

core/jni/android_os_NativeHandle.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2018 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 #ifndef ANDROID_OS_NATIVE_HANDLE_H
18 #define ANDROID_OS_NATIVE_HANDLE_H
19
20 #include "hwbinder/EphemeralStorage.h"
21
22 #include <cutils/native_handle.h>
23 #include <jni.h>
24
25 namespace android {
26
27 struct JNativeHandle {
28
29 /**
30 * Returns a Java NativeHandle object representing the parameterized
31 * native_handle_t instance.
32 */
33 static jobject MakeJavaNativeHandleObj(JNIEnv *env, const native_handle_t *handle);
34
35 /**
36 * Returns a heap-allocated native_handle_t instance representing the
37 * parameterized Java object. Note that if no valid EphemeralStorage*
38 * parameter is supplied (storage is nullptr), the return value must
39 * be explicitly deallocated (using native_handle_delete).
40 */
41 static native_handle_t* MakeCppNativeHandle(JNIEnv *env, jobject jHandle,
42 EphemeralStorage *storage);
43
44 /**
45 * Returns an (uninitialized) array of Java NativeHandle objects.
46 */
47 static jobjectArray AllocJavaNativeHandleObjArray(JNIEnv *env, jsize length);
48 };
49
50 }
51
52 #endif // ANDROID_OS_NATIVE_HANDLE_H