Loading services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,12 @@ public class InputMethodServiceTest { InputMethodServiceWrapper.getInputMethodServiceWrapperForTesting(); assertThat(mInputMethodService).isNotNull(); // The activity gets focus. assertThat(mActivity.hasWindowFocus()).isTrue(); assertThat(mInputMethodService.getCurrentInputEditorInfo()).isNotNull(); assertThat(mInputMethodService.getCurrentInputEditorInfo().packageName) .isEqualTo(mTargetPackageName); // The editor won't bring up keyboard by default. assertThat(mInputMethodService.getCurrentInputStarted()).isTrue(); assertThat(mInputMethodService.getCurrentInputViewStarted()).isFalse(); Loading services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/ims/InputMethodServiceWrapper.java +13 −2 Original line number Diff line number Diff line Loading @@ -53,13 +53,14 @@ public class InputMethodServiceWrapper extends InputMethodService { @Override public void onStartInput(EditorInfo info, boolean restarting) { Log.i(TAG, "onStartInput() editor=" + info + ", restarting=" + restarting); Log.i(TAG, "onStartInput() editor=" + dumpEditorInfo(info) + ", restarting=" + restarting); super.onStartInput(info, restarting); } @Override public void onStartInputView(EditorInfo info, boolean restarting) { Log.i(TAG, "onStartInputView() editor=" + info + ", restarting=" + restarting); Log.i(TAG, "onStartInputView() editor=" + dumpEditorInfo(info) + ", restarting=" + restarting); super.onStartInputView(info, restarting); mInputViewStarted = true; if (mCountDownLatchForTesting != null) { Loading Loading @@ -99,4 +100,14 @@ public class InputMethodServiceWrapper extends InputMethodService { mCountDownLatchForTesting.countDown(); } } private String dumpEditorInfo(EditorInfo info) { var sb = new StringBuilder(); sb.append("EditorInfo{packageName=").append(info.packageName); sb.append(" fieldId=").append(info.fieldId); sb.append(" hintText=").append(info.hintText); sb.append(" privateImeOptions=").append(info.privateImeOptions); sb.append("}"); return sb.toString(); } } Loading
services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java +6 −0 Original line number Diff line number Diff line Loading @@ -99,6 +99,12 @@ public class InputMethodServiceTest { InputMethodServiceWrapper.getInputMethodServiceWrapperForTesting(); assertThat(mInputMethodService).isNotNull(); // The activity gets focus. assertThat(mActivity.hasWindowFocus()).isTrue(); assertThat(mInputMethodService.getCurrentInputEditorInfo()).isNotNull(); assertThat(mInputMethodService.getCurrentInputEditorInfo().packageName) .isEqualTo(mTargetPackageName); // The editor won't bring up keyboard by default. assertThat(mInputMethodService.getCurrentInputStarted()).isTrue(); assertThat(mInputMethodService.getCurrentInputViewStarted()).isFalse(); Loading
services/tests/InputMethodSystemServerTests/test-apps/SimpleTestIme/src/com/android/apps/inputmethod/simpleime/ims/InputMethodServiceWrapper.java +13 −2 Original line number Diff line number Diff line Loading @@ -53,13 +53,14 @@ public class InputMethodServiceWrapper extends InputMethodService { @Override public void onStartInput(EditorInfo info, boolean restarting) { Log.i(TAG, "onStartInput() editor=" + info + ", restarting=" + restarting); Log.i(TAG, "onStartInput() editor=" + dumpEditorInfo(info) + ", restarting=" + restarting); super.onStartInput(info, restarting); } @Override public void onStartInputView(EditorInfo info, boolean restarting) { Log.i(TAG, "onStartInputView() editor=" + info + ", restarting=" + restarting); Log.i(TAG, "onStartInputView() editor=" + dumpEditorInfo(info) + ", restarting=" + restarting); super.onStartInputView(info, restarting); mInputViewStarted = true; if (mCountDownLatchForTesting != null) { Loading Loading @@ -99,4 +100,14 @@ public class InputMethodServiceWrapper extends InputMethodService { mCountDownLatchForTesting.countDown(); } } private String dumpEditorInfo(EditorInfo info) { var sb = new StringBuilder(); sb.append("EditorInfo{packageName=").append(info.packageName); sb.append(" fieldId=").append(info.fieldId); sb.append(" hintText=").append(info.hintText); sb.append(" privateImeOptions=").append(info.privateImeOptions); sb.append("}"); return sb.toString(); } }