From 48f0d8993b5e871dd2695e983266aa655801769e Mon Sep 17 00:00:00 2001 From: Ying Wang Date: Wed, 30 Dec 2009 14:37:04 -0800 Subject: [PATCH] Annouce that Monkey is running. http://b/issue?id=1681101 --- .../monkey/src/com/android/commands/monkey/Monkey.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cmds/monkey/src/com/android/commands/monkey/Monkey.java b/cmds/monkey/src/com/android/commands/monkey/Monkey.java index 521de16d6..a3d6d5d20 100644 --- a/cmds/monkey/src/com/android/commands/monkey/Monkey.java +++ b/cmds/monkey/src/com/android/commands/monkey/Monkey.java @@ -28,6 +28,7 @@ import android.os.Debug; import android.os.Process; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemProperties; import android.server.data.CrashData; import android.view.IWindowManager; @@ -300,6 +301,15 @@ public class Monkey { * @param args The command-line arguments */ public static void main(String[] args) { + // Tell the system that Monkey is running. + SystemProperties.set("monkey.running", "true"); + // Add a hook to tell the system that Monkey has finished running. + Runtime.getRuntime().addShutdownHook(new Thread() { + public void run() { + SystemProperties.set("monkey.running", null); + } + }); + int resultCode = (new Monkey()).run(args); System.exit(resultCode); }