Bo Liu | 1020586 | 2022-09-15 16:24:36 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2022 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 | * @addtogroup NativeActivity Native Activity |
| 19 | * @{ |
| 20 | */ |
| 21 | |
| 22 | /** |
| 23 | * @file surface_control_jni.h |
| 24 | */ |
| 25 | |
| 26 | #ifndef ANDROID_SURFACE_CONTROL_JNI_H |
| 27 | #define ANDROID_SURFACE_CONTROL_JNI_H |
| 28 | |
| 29 | #include <jni.h> |
| 30 | #include <sys/cdefs.h> |
| 31 | |
| 32 | #include <android/surface_control.h> |
| 33 | |
| 34 | __BEGIN_DECLS |
| 35 | |
| 36 | /** |
| 37 | * Return the ASurfaceControl wrapped by a Java SurfaceControl object. |
| 38 | * |
Bo Liu | 80d42db | 2022-10-11 20:18:59 -0400 | [diff] [blame] | 39 | * The caller takes ownership of the returned ASurfaceControl returned and must |
| 40 | * release it * using ASurfaceControl_release. |
| 41 | * |
| 42 | * surfaceControlObj must be a non-null instance of android.view.SurfaceControl |
| 43 | * and isValid() must be true. |
Bo Liu | 1020586 | 2022-09-15 16:24:36 -0400 | [diff] [blame] | 44 | * |
| 45 | * Available since API level 34. |
| 46 | */ |
Bo Liu | bd5ee8e | 2022-11-11 14:59:37 -0500 | [diff] [blame] | 47 | ASurfaceControl* _Nonnull ASurfaceControl_fromJava(JNIEnv* _Nonnull env, |
Bo Liu | 1020586 | 2022-09-15 16:24:36 -0400 | [diff] [blame] | 48 | jobject _Nonnull surfaceControlObj) __INTRODUCED_IN(__ANDROID_API_U__); |
| 49 | |
| 50 | /** |
| 51 | * Return the ASurfaceTransaction wrapped by a Java Transaction object. |
| 52 | * |
| 53 | * The returned ASurfaceTransaction is still owned by the Java Transaction object is only |
| 54 | * valid while the Java Transaction object is alive. In particular, the returned transaction |
| 55 | * must NOT be deleted with ASurfaceTransaction_delete. |
Bo Liu | 80d42db | 2022-10-11 20:18:59 -0400 | [diff] [blame] | 56 | * |
| 57 | * transactionObj must be a non-null instance of |
| 58 | * android.view.SurfaceControl.Transaction and close() must not already be called. |
Bo Liu | 1020586 | 2022-09-15 16:24:36 -0400 | [diff] [blame] | 59 | * |
| 60 | * Available since API level 34. |
| 61 | */ |
Bo Liu | bd5ee8e | 2022-11-11 14:59:37 -0500 | [diff] [blame] | 62 | ASurfaceTransaction* _Nonnull ASurfaceTransaction_fromJava(JNIEnv* _Nonnull env, |
Bo Liu | 1020586 | 2022-09-15 16:24:36 -0400 | [diff] [blame] | 63 | jobject _Nonnull transactionObj) __INTRODUCED_IN(__ANDROID_API_U__); |
| 64 | |
| 65 | __END_DECLS |
| 66 | |
| 67 | #endif // ANDROID_SURFACE_CONTROL_JNI_H |
| 68 | /** @} */ |