diff options
author | David T.H. Kao <dthkao@gmail.com> | 2018-05-09 15:52:11 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-09 15:52:11 -0700 |
commit | 770ccb9262f4b38db60c9157678331ea6c41e831 (patch) | |
tree | 4990e9bd5137fa948f4906e94df236fa7168b3bf /src/main/java/com/google/android/mobly/snippet/bundled/SmsSnippet.java | |
parent | f4244d6c0e47faafce25478af652386eb0c45e25 (diff) | |
download | mobly-bundled-snippets-770ccb9262f4b38db60c9157678331ea6c41e831.tar.gz |
Add functionality to specify timeout for waitForSms. (#95)
Diffstat (limited to 'src/main/java/com/google/android/mobly/snippet/bundled/SmsSnippet.java')
-rw-r--r-- | src/main/java/com/google/android/mobly/snippet/bundled/SmsSnippet.java | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main/java/com/google/android/mobly/snippet/bundled/SmsSnippet.java b/src/main/java/com/google/android/mobly/snippet/bundled/SmsSnippet.java index 4a38798..ec6d470 100644 --- a/src/main/java/com/google/android/mobly/snippet/bundled/SmsSnippet.java +++ b/src/main/java/com/google/android/mobly/snippet/bundled/SmsSnippet.java @@ -115,12 +115,11 @@ public class SmsSnippet implements Snippet { @TargetApi(Build.VERSION_CODES.KITKAT) @Rpc(description = "Wait for incoming SMS message.") - public JSONObject waitForSms() throws Throwable { + public JSONObject waitForSms(int timeoutMillis) throws Throwable { String callbackId = SMS_CALLBACK_ID_PREFIX + (++mCallbackCounter); SmsReceiver receiver = new SmsReceiver(mContext, callbackId); mContext.registerReceiver(receiver, new IntentFilter(Intents.SMS_RECEIVED_ACTION)); - return Utils.waitForSnippetEvent( - callbackId, SMS_RECEIVED_EVENT_NAME, DEFAULT_TIMEOUT_MILLISECOND) + return Utils.waitForSnippetEvent(callbackId, SMS_RECEIVED_EVENT_NAME, timeoutMillis) .toJson(); } |