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(AAudioStreamBuilder_delete);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_openStream);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setAllowedCapturePolicy);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setAttributionTag);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setBufferCapacityInFrames);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setChannelCount);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setChannelMask);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setContentType);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setDataCallback);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setDeviceId);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setDirection);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setErrorCallback);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setFormat);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setFramesPerDataCallback);
34 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setInputPreset);
35 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setIsContentSpatialized);
36 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setPackageName);
37 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setPerformanceMode);
38 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setPrivacySensitive);
39 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setSampleRate);
40 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setSamplesPerFrame);
41 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setSessionId);
42 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setSharingMode);
43 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setSpatializationBehavior);
44 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStreamBuilder_setUsage);
45 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_close);
46 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getAllowedCapturePolicy);
47 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getBufferCapacityInFrames);
48 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getBufferSizeInFrames);
49 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getChannelCount);
50 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getChannelMask);
51 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getContentType);
52 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getDeviceId);
53 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getDirection);
54 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getFormat);
55 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getFramesPerBurst);
56 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getFramesPerDataCallback);
57 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getFramesRead);
58 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getFramesWritten);
59 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getInputPreset);
60 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getPerformanceMode);
61 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getSampleRate);
62 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getSamplesPerFrame);
63 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getSessionId);
64 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getSharingMode);
65 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getSpatializationBehavior);
66 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getState);
67 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getTimestamp);
68 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getUsage);
69 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_getXRunCount);
70 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_isContentSpatialized);
71 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_isMMapUsed);
72 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_isPrivacySensitive);
73 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_read);
74 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_release);
75 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_requestFlush);
76 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_requestPause);
77 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_requestStart);
78 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_requestStop);
79 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_setBufferSizeInFrames);
80 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_waitForStateChange);
81 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudioStream_write);
82 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudio_convertResultToText);
83 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudio_convertStreamStateToText);
84 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudio_createStreamBuilder);
85 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudio_getMMapPolicy);
86 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AAudio_setMMapPolicy);
87
init_stub_library()88 static void __attribute__((constructor(0))) init_stub_library() {
89 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_delete);
90 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_openStream);
91 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setAllowedCapturePolicy);
92 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setAttributionTag);
93 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setBufferCapacityInFrames);
94 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setChannelCount);
95 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setChannelMask);
96 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setContentType);
97 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setDataCallback);
98 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setDeviceId);
99 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setDirection);
100 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setErrorCallback);
101 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setFormat);
102 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setFramesPerDataCallback);
103 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setInputPreset);
104 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setIsContentSpatialized);
105 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setPackageName);
106 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setPerformanceMode);
107 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setPrivacySensitive);
108 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setSampleRate);
109 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setSamplesPerFrame);
110 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setSessionId);
111 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setSharingMode);
112 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setSpatializationBehavior);
113 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStreamBuilder_setUsage);
114 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_close);
115 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getAllowedCapturePolicy);
116 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getBufferCapacityInFrames);
117 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getBufferSizeInFrames);
118 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getChannelCount);
119 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getChannelMask);
120 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getContentType);
121 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getDeviceId);
122 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getDirection);
123 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getFormat);
124 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getFramesPerBurst);
125 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getFramesPerDataCallback);
126 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getFramesRead);
127 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getFramesWritten);
128 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getInputPreset);
129 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getPerformanceMode);
130 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getSampleRate);
131 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getSamplesPerFrame);
132 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getSessionId);
133 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getSharingMode);
134 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getSpatializationBehavior);
135 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getState);
136 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getTimestamp);
137 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getUsage);
138 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_getXRunCount);
139 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_isContentSpatialized);
140 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_isMMapUsed);
141 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_isPrivacySensitive);
142 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_read);
143 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_release);
144 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_requestFlush);
145 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_requestPause);
146 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_requestStart);
147 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_requestStop);
148 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_setBufferSizeInFrames);
149 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_waitForStateChange);
150 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudioStream_write);
151 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudio_convertResultToText);
152 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudio_convertStreamStateToText);
153 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudio_createStreamBuilder);
154 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudio_getMMapPolicy);
155 INIT_INTERCEPTABLE_STUB_FUNCTION("libaaudio.so", AAudio_setMMapPolicy);
156 }
157 // clang-format on
158