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(AHardwareBuffer_acquire);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_allocate);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_createFromHandle);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_describe);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_getNativeHandle);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_isSupported);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_lock);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_lockAndGetInfo);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_lockPlanes);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_recvHandleFromUnixSocket);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_release);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_sendHandleToUnixSocket);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_unlock);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindowBuffer_getHardwareBuffer);
34 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_OemStorageGet);
35 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_OemStorageSet);
36 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_acquire);
37 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_cancelBuffer);
38 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_dequeueBuffer);
39 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getBuffersDataSpace);
40 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getFormat);
41 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getHeight);
42 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getLastDequeueDuration);
43 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getLastDequeueStartTime);
44 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getLastQueueDuration);
45 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getWidth);
46 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_lock);
47 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_query);
48 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_queryf);
49 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_queueBuffer);
50 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_release);
51 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setAutoPrerotation);
52 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setAutoRefresh);
53 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBufferCount);
54 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersDataSpace);
55 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersDimensions);
56 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersFormat);
57 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersGeometry);
58 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersTimestamp);
59 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersTransform);
60 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setCancelBufferInterceptor);
61 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setDequeueBufferInterceptor);
62 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setDequeueTimeout);
63 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setFrameRate);
64 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setPerformInterceptor);
65 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setQueueBufferInterceptor);
66 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setSharedBufferMode);
67 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setSwapInterval);
68 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setUsage);
69 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_tryAllocateBuffers);
70 DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_unlockAndPost);
71 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android32AHardwareBuffer_to_GraphicBufferEP15AHardwareBuffer);
72 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android32AHardwareBuffer_to_GraphicBufferEPK15AHardwareBuffer);
73 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android34AHardwareBuffer_from_GraphicBufferEPNS_13GraphicBufferE);
74 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android34AHardwareBuffer_isValidPixelFormatEj);
75 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android36AHardwareBuffer_convertToPixelFormatEj);
76 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android38AHardwareBuffer_convertFromPixelFormatEj);
77 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android38AHardwareBuffer_to_ANativeWindowBufferEP15AHardwareBuffer);
78 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android38AHardwareBuffer_to_ANativeWindowBufferEPK15AHardwareBuffer);
79 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android41AHardwareBuffer_convertToGrallocUsageBitsEm);
80 DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android43AHardwareBuffer_convertFromGrallocUsageBitsEm);
81
init_stub_library()82 static void __attribute__((constructor(0))) init_stub_library() {
83 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_acquire);
84 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_allocate);
85 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_createFromHandle);
86 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_describe);
87 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_getNativeHandle);
88 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_isSupported);
89 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_lock);
90 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_lockAndGetInfo);
91 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_lockPlanes);
92 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_recvHandleFromUnixSocket);
93 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_release);
94 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_sendHandleToUnixSocket);
95 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", AHardwareBuffer_unlock);
96 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindowBuffer_getHardwareBuffer);
97 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_OemStorageGet);
98 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_OemStorageSet);
99 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_acquire);
100 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_cancelBuffer);
101 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_dequeueBuffer);
102 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_getBuffersDataSpace);
103 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_getFormat);
104 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_getHeight);
105 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_getLastDequeueDuration);
106 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_getLastDequeueStartTime);
107 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_getLastQueueDuration);
108 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_getWidth);
109 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_lock);
110 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_query);
111 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_queryf);
112 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_queueBuffer);
113 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_release);
114 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setAutoPrerotation);
115 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setAutoRefresh);
116 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setBufferCount);
117 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setBuffersDataSpace);
118 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setBuffersDimensions);
119 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setBuffersFormat);
120 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setBuffersGeometry);
121 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setBuffersTimestamp);
122 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setBuffersTransform);
123 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setCancelBufferInterceptor);
124 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setDequeueBufferInterceptor);
125 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setDequeueTimeout);
126 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setFrameRate);
127 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setPerformInterceptor);
128 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setQueueBufferInterceptor);
129 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setSharedBufferMode);
130 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setSwapInterval);
131 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setUsage);
132 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_tryAllocateBuffers);
133 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_unlockAndPost);
134 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android32AHardwareBuffer_to_GraphicBufferEP15AHardwareBuffer);
135 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android32AHardwareBuffer_to_GraphicBufferEPK15AHardwareBuffer);
136 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android34AHardwareBuffer_from_GraphicBufferEPNS_13GraphicBufferE);
137 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android34AHardwareBuffer_isValidPixelFormatEj);
138 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android36AHardwareBuffer_convertToPixelFormatEj);
139 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android38AHardwareBuffer_convertFromPixelFormatEj);
140 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android38AHardwareBuffer_to_ANativeWindowBufferEP15AHardwareBuffer);
141 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android38AHardwareBuffer_to_ANativeWindowBufferEPK15AHardwareBuffer);
142 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android41AHardwareBuffer_convertToGrallocUsageBitsEm);
143 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android43AHardwareBuffer_convertFromGrallocUsageBitsEm);
144 }
145 // clang-format on
146