blob: faf2dc259131a0bcd403e7c8b91a7251f706b7a5 [file] [log] [blame]
Alex Light49948e92016-08-11 15:35:28 -07001/*
2 * Copyright (C) 2011 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
17public class Main {
18 public static void main(String[] args) {
Andreas Gampef37e3022017-01-13 17:54:46 -080019 System.loadLibrary(args[1]);
20
Alex Light49948e92016-08-11 15:35:28 -070021 System.out.println("Hello, world!");
Andreas Gampef37e3022017-01-13 17:54:46 -080022
Andreas Gampe96eca782017-01-19 19:45:30 -080023 if (checkLivePhase()) {
24 System.out.println("Agent in live phase.");
25 }
26
Andreas Gampef37e3022017-01-13 17:54:46 -080027 set(0); // OTHER
28 set(1); // GC
29 set(2); // CLASS
30 set(4); // JNI
31 set(8); // Error.
Alex Light49948e92016-08-11 15:35:28 -070032 }
Andreas Gampef37e3022017-01-13 17:54:46 -080033
34 private static void set(int i) {
35 System.out.println(i);
36 try {
37 setVerboseFlag(i, true);
38 setVerboseFlag(i, false);
39 } catch (RuntimeException e) {
40 System.out.println(e.getMessage());
41 }
42 }
43
Andreas Gampe96eca782017-01-19 19:45:30 -080044 private static native boolean checkLivePhase();
Andreas Gampef37e3022017-01-13 17:54:46 -080045 private static native void setVerboseFlag(int flag, boolean value);
Alex Light49948e92016-08-11 15:35:28 -070046}