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