Added hooks to execute just before and just after starting the monkey run.

Change-Id: I03baf59587709c20f8f4c8f5ed507c23f4660e9b
diff --git a/prod-tests/src/com/android/monkey/MonkeyBase.java b/prod-tests/src/com/android/monkey/MonkeyBase.java
index 12e34f7..a9fef9b 100644
--- a/prod-tests/src/com/android/monkey/MonkeyBase.java
+++ b/prod-tests/src/com/android/monkey/MonkeyBase.java
@@ -288,10 +288,12 @@
                 "for this test:\nadb shell %s\n\n", new Date().toString(), getUptime(), command));
 
         try {
+            onMonkeyStart();
             long start = System.currentTimeMillis();
             commandHelper.runCommand(mTestDevice, command, getMonkeyTimeoutMs());
             duration = System.currentTimeMillis() - start;
         } finally {
+            onMonkeyFinish();
             outputBuilder.append(commandHelper.getOutput());
 
             // Generate the monkey log suffix, which includes the device uptime.
@@ -318,6 +320,20 @@
     }
 
     /**
+     * A hook to allow subclasses to perform actions just before the monkey starts.
+     */
+    protected void onMonkeyStart() {
+       // empty
+    }
+
+    /**
+     * A hook to allow sublaccess to perform actions just after the monkey finished.
+     */
+    protected void onMonkeyFinish() {
+        // empty
+    }
+
+    /**
      * If enabled, capture a screenshot and send it to a listener.
      * @throws DeviceNotAvailableException
      */