1 //
2 // Copyright (C) 2020 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 // clang-format off
18 #include "native_bridge_support/vdso/interceptable_functions.h"
19 
20 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_abortCaptures);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_capture);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_close);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_getDevice);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_logicalCamera_capture);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_logicalCamera_setRepeatingRequest);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_setRepeatingRequest);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_stopRepeating);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraCaptureSession_updateSharedOutput);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraDevice_close);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraDevice_createCaptureRequest);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraDevice_createCaptureRequest_withPhysicalIds);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraDevice_createCaptureSession);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraDevice_createCaptureSessionWithSessionParameters);
34 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraDevice_getId);
35 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraDevice_isSessionConfigurationSupported);
36 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_create);
37 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_delete);
38 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_deleteCameraIdList);
39 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_getCameraCharacteristics);
40 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_getCameraIdList);
41 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_openCamera);
42 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_registerAvailabilityCallback);
43 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_registerExtendedAvailabilityCallback);
44 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_unregisterAvailabilityCallback);
45 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraManager_unregisterExtendedAvailabilityCallback);
46 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraMetadata_copy);
47 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraMetadata_free);
48 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraMetadata_fromCameraMetadata);
49 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraMetadata_getAllTags);
50 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraMetadata_getConstEntry);
51 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraMetadata_isLogicalMultiCamera);
52 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraOutputTarget_create);
53 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACameraOutputTarget_free);
54 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_addTarget);
55 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_copy);
56 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_free);
57 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_getAllTags);
58 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_getConstEntry);
59 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_getConstEntry_physicalCamera);
60 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_getUserContext);
61 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_removeTarget);
62 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_double);
63 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_float);
64 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_i32);
65 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_i64);
66 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_physicalCamera_double);
67 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_physicalCamera_float);
68 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_physicalCamera_i32);
69 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_physicalCamera_i64);
70 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_physicalCamera_rational);
71 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_physicalCamera_u8);
72 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_rational);
73 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setEntry_u8);
74 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureRequest_setUserContext);
75 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionOutputContainer_add);
76 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionOutputContainer_create);
77 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionOutputContainer_free);
78 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionOutputContainer_remove);
79 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionOutput_create);
80 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionOutput_free);
81 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionPhysicalOutput_create);
82 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionSharedOutput_add);
83 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionSharedOutput_create);
84 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ACaptureSessionSharedOutput_remove);
85 
init_stub_library()86 static void __attribute__((constructor(0))) init_stub_library() {
87   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_abortCaptures);
88   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_capture);
89   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_close);
90   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_getDevice);
91   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_logicalCamera_capture);
92   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_logicalCamera_setRepeatingRequest);
93   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_setRepeatingRequest);
94   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_stopRepeating);
95   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraCaptureSession_updateSharedOutput);
96   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraDevice_close);
97   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraDevice_createCaptureRequest);
98   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraDevice_createCaptureRequest_withPhysicalIds);
99   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraDevice_createCaptureSession);
100   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraDevice_createCaptureSessionWithSessionParameters);
101   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraDevice_getId);
102   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraDevice_isSessionConfigurationSupported);
103   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_create);
104   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_delete);
105   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_deleteCameraIdList);
106   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_getCameraCharacteristics);
107   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_getCameraIdList);
108   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_openCamera);
109   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_registerAvailabilityCallback);
110   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_registerExtendedAvailabilityCallback);
111   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_unregisterAvailabilityCallback);
112   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraManager_unregisterExtendedAvailabilityCallback);
113   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraMetadata_copy);
114   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraMetadata_free);
115   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraMetadata_fromCameraMetadata);
116   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraMetadata_getAllTags);
117   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraMetadata_getConstEntry);
118   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraMetadata_isLogicalMultiCamera);
119   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraOutputTarget_create);
120   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACameraOutputTarget_free);
121   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_addTarget);
122   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_copy);
123   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_free);
124   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_getAllTags);
125   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_getConstEntry);
126   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_getConstEntry_physicalCamera);
127   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_getUserContext);
128   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_removeTarget);
129   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_double);
130   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_float);
131   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_i32);
132   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_i64);
133   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_physicalCamera_double);
134   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_physicalCamera_float);
135   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_physicalCamera_i32);
136   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_physicalCamera_i64);
137   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_physicalCamera_rational);
138   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_physicalCamera_u8);
139   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_rational);
140   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setEntry_u8);
141   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureRequest_setUserContext);
142   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionOutputContainer_add);
143   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionOutputContainer_create);
144   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionOutputContainer_free);
145   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionOutputContainer_remove);
146   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionOutput_create);
147   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionOutput_free);
148   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionPhysicalOutput_create);
149   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionSharedOutput_add);
150   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionSharedOutput_create);
151   INIT_INTERCEPTABLE_STUB_FUNCTION("libcamera2ndk.so", ACaptureSessionSharedOutput_remove);
152 }
153 // clang-format on
154