blob: f2e5980c0d0bf62bcd2d58b184a3393c95a9def0 [file] [log] [blame]
Sebastien Hertz477edf42015-08-11 15:39:02 +02001/*
2 * Copyright (C) 2015 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
17package com.android.cts.jdwpsecurity;
18
19public class JdwpTest {
20 private static final long LOOP_TIMEOUT_MS = 60 * 1000;
21
22 public static void main(String[] args) throws Exception {
23 // Print pid so the test knows who we are.
24 int pid = android.os.Process.myPid();
25 System.out.println(pid);
26
27 // Loop to keep alive so the host test has the time to check whether we have a JDWP
28 // connection.
29 // Note: we use a timeout to avoid indefinite loop in case something wrong happens
30 // with the test harness.
31 long start = System.currentTimeMillis();
32 while(getElapsedTime(start) < LOOP_TIMEOUT_MS) {
33 Thread.sleep(100);
34 }
35 }
36
37 private static long getElapsedTime(long start) {
38 return System.currentTimeMillis() - start;
39 }
40}