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