expose waitForDeviceShell in ITestDevice

IDeviceStateMonitor already has an implementation, exposing it
in ITestDevice so that it can be used to wait for shell.

Use case:
Certain devices exposes normal adb mode while it's still in
recovery. This causes device to be online, but no `adb shell`
command can be executed (if it were in recovery mode, it won't
be considered "online").

Change-Id: I9a111e20e97464c36df18db5efea0b787647d006
diff --git a/src/com/android/tradefed/device/ITestDevice.java b/src/com/android/tradefed/device/ITestDevice.java
index f656b17..867c6cd 100644
--- a/src/com/android/tradefed/device/ITestDevice.java
+++ b/src/com/android/tradefed/device/ITestDevice.java
@@ -911,6 +911,14 @@
     public boolean waitForDeviceNotAvailable(final long waitTime);
 
     /**
+     * Waits for device to be responsive to a basic adb shell command.
+     *
+     * @param waitTime the time in ms to wait
+     * @return <code>true</code> if device becomes responsive before <var>waitTime</var> elapses.
+     */
+    public boolean waitForDeviceShell(final long waitTime);
+
+    /**
      * Blocks for the device to be in the 'adb recovery' state (note this is distinct from
      * {@link IDeviceRecovery}).
      *
diff --git a/src/com/android/tradefed/device/TestDevice.java b/src/com/android/tradefed/device/TestDevice.java
index 894a7cd..6f5da18 100644
--- a/src/com/android/tradefed/device/TestDevice.java
+++ b/src/com/android/tradefed/device/TestDevice.java
@@ -2644,4 +2644,12 @@
         }
         return apiLevel;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean waitForDeviceShell(long waitTime) {
+        return mMonitor.waitForDeviceShell(waitTime);
+    }
 }
diff --git a/tests/src/com/android/tradefed/device/StubTestDevice.java b/tests/src/com/android/tradefed/device/StubTestDevice.java
index 3441221..fab5dbc 100644
--- a/tests/src/com/android/tradefed/device/StubTestDevice.java
+++ b/tests/src/com/android/tradefed/device/StubTestDevice.java
@@ -782,4 +782,12 @@
     public int getApiLevel() throws DeviceNotAvailableException {
         return UNKNOWN_API_LEVEL;
     }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean waitForDeviceShell(long waitTime) {
+        return false;
+    }
 }