diff options
2 files changed, 8 insertions, 2 deletions
diff --git a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/AndroidTest.xml b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/AndroidTest.xml index 820628c98dee..8e6954b474cb 100644 --- a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/AndroidTest.xml +++ b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/AndroidTest.xml @@ -25,6 +25,12 @@ <option name="test-file-name" value="FrameworksImeTests.apk" /> </target_preparer> + <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer"> + <option name="run-command" value="input keyevent KEYCODE_WAKEUP" /> + <option name="run-command" value="wm dismiss-keyguard" /> + <option name="run-command" value="settings put secure immersive_mode_confirmations confirmed" /> + </target_preparer> + <option name="test-tag" value="FrameworksImeTests" /> <test class="com.android.tradefed.testtype.AndroidJUnitTest" > diff --git a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java index 1535298f74e3..2029b71034eb 100644 --- a/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java +++ b/services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java @@ -48,6 +48,7 @@ import androidx.test.platform.app.InstrumentationRegistry; import com.android.apps.inputmethod.simpleime.ims.InputMethodServiceWrapper; import com.android.apps.inputmethod.simpleime.testing.TestActivity; +import com.android.compatibility.common.util.SystemUtil; import com.android.internal.inputmethod.InputMethodNavButtonFlags; import org.junit.After; @@ -834,8 +835,7 @@ public class InputMethodServiceTest { private String executeShellCommand(String cmd) throws IOException { Log.i(TAG, "Run command: " + cmd); - return UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) - .executeShellCommand(cmd); + return SystemUtil.runShellCommandOrThrow(cmd); } private void clickOnEditorText() { |