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