1 /*
2  * Copyright (C) 2017 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 package art;
18 
19 // Binder class so the agent's C code has something that can be bound and exposed to tests.
20 // In a package to separate cleanly and work around CTS reference issues (though this class
21 // should be replaced in the CTS version).
22 public class Main {
23   // Load the given class with the given classloader, and bind all native methods to corresponding
24   // C methods in the agent. Will abort if any of the steps fail.
bindAgentJNI(String className, ClassLoader classLoader)25   public static native void bindAgentJNI(String className, ClassLoader classLoader);
26   // Same as above, giving the class directly.
bindAgentJNIForClass(Class<?> klass)27   public static native void bindAgentJNIForClass(Class<?> klass);
28 
29   // Common infrastructure.
setTag(Object o, long tag)30   public static native void setTag(Object o, long tag);
getTag(Object o)31   public static native long getTag(Object o);
32 }
33