blob: d5f9fb9a1ac3380adaeb6727cd10c5e0fc662ac4 [file] [log] [blame]
Bob Badour07562132020-05-20 13:18:00 +00001//
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
20DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_acquire);
21DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_allocate);
22DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_createFromHandle);
23DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_describe);
24DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_getNativeHandle);
25DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_isSupported);
26DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_lock);
27DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_lockAndGetInfo);
28DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_lockPlanes);
29DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_recvHandleFromUnixSocket);
30DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_release);
31DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_sendHandleToUnixSocket);
32DEFINE_INTERCEPTABLE_STUB_FUNCTION(AHardwareBuffer_unlock);
33DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindowBuffer_getHardwareBuffer);
34DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_OemStorageGet);
35DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_OemStorageSet);
36DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_acquire);
37DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_cancelBuffer);
38DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_dequeueBuffer);
39DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getBuffersDataSpace);
40DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getFormat);
41DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getHeight);
42DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getLastDequeueDuration);
43DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getLastDequeueStartTime);
44DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getLastQueueDuration);
45DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_getWidth);
46DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_lock);
47DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_query);
48DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_queryf);
49DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_queueBuffer);
50DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_release);
51DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setAutoPrerotation);
52DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setAutoRefresh);
53DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBufferCount);
54DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersDataSpace);
55DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersDimensions);
56DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersFormat);
57DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersGeometry);
58DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersTimestamp);
59DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setBuffersTransform);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020060DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setCancelBufferInterceptor);
61DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setDequeueBufferInterceptor);
Bob Badour07562132020-05-20 13:18:00 +000062DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setDequeueTimeout);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020063DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setFrameRate);
64DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setPerformInterceptor);
65DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setQueueBufferInterceptor);
Bob Badour07562132020-05-20 13:18:00 +000066DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setSharedBufferMode);
67DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setSwapInterval);
68DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_setUsage);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +020069DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_tryAllocateBuffers);
Bob Badour07562132020-05-20 13:18:00 +000070DEFINE_INTERCEPTABLE_STUB_FUNCTION(ANativeWindow_unlockAndPost);
71DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android32AHardwareBuffer_to_GraphicBufferEP15AHardwareBuffer);
72DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android32AHardwareBuffer_to_GraphicBufferEPK15AHardwareBuffer);
73DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android34AHardwareBuffer_from_GraphicBufferEPNS_13GraphicBufferE);
74DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android34AHardwareBuffer_isValidPixelFormatEj);
75DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android36AHardwareBuffer_convertToPixelFormatEj);
76DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android38AHardwareBuffer_convertFromPixelFormatEj);
77DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android38AHardwareBuffer_to_ANativeWindowBufferEP15AHardwareBuffer);
78DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android38AHardwareBuffer_to_ANativeWindowBufferEPK15AHardwareBuffer);
79DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android41AHardwareBuffer_convertToGrallocUsageBitsEy);
80DEFINE_INTERCEPTABLE_STUB_FUNCTION(_ZN7android43AHardwareBuffer_convertFromGrallocUsageBitsEy);
81
82static 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);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +0200123 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setCancelBufferInterceptor);
124 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setDequeueBufferInterceptor);
Bob Badour07562132020-05-20 13:18:00 +0000125 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_setDequeueTimeout);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +0200126 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);
Bob Badour07562132020-05-20 13:18:00 +0000129 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);
Evgeny Eltsin9c7d4622020-07-15 15:30:51 +0200132 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", ANativeWindow_tryAllocateBuffers);
Bob Badour07562132020-05-20 13:18:00 +0000133 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_convertToGrallocUsageBitsEy);
143 INIT_INTERCEPTABLE_STUB_FUNCTION("libnativewindow.so", _ZN7android43AHardwareBuffer_convertFromGrallocUsageBitsEy);
144}
145// clang-format on