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(AMidiDevice_fromJava);
21 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiDevice_getDefaultProtocol);
22 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiDevice_getNumInputPorts);
23 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiDevice_getNumOutputPorts);
24 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiDevice_getType);
25 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiDevice_release);
26 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiInputPort_close);
27 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiInputPort_open);
28 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiInputPort_send);
29 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiInputPort_sendFlush);
30 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiInputPort_sendWithTimestamp);
31 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiOutputPort_close);
32 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiOutputPort_open);
33 DEFINE_INTERCEPTABLE_STUB_FUNCTION(AMidiOutputPort_receive);
34
init_stub_library()35 static void __attribute__((constructor(0))) init_stub_library() {
36 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiDevice_fromJava);
37 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiDevice_getDefaultProtocol);
38 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiDevice_getNumInputPorts);
39 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiDevice_getNumOutputPorts);
40 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiDevice_getType);
41 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiDevice_release);
42 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiInputPort_close);
43 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiInputPort_open);
44 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiInputPort_send);
45 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiInputPort_sendFlush);
46 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiInputPort_sendWithTimestamp);
47 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiOutputPort_close);
48 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiOutputPort_open);
49 INIT_INTERCEPTABLE_STUB_FUNCTION("libamidi.so", AMidiOutputPort_receive);
50 }
51 // clang-format on
52