Loading core/tests/InputMethodCoreTests/src/android/view/inputmethod/EditorInfoTest.java +7 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.LocaleList; import android.os.Parcel; import android.os.UserHandle; import android.platform.test.annotations.Presubmit; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.text.InputType; import android.text.Spannable; import android.text.SpannableString; Loading Loading @@ -87,6 +88,8 @@ public class EditorInfoTest { TEST_EDITOR_INFO.targetInputMethodUser = UserHandle.of(TEST_USER_ID); } private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); /** * Makes sure that {@code null} {@link EditorInfo#targetInputMethodUser} can be copied via * {@link Parcel}. Loading Loading @@ -522,7 +525,9 @@ public class EditorInfoTest { info.setSupportedHandwritingGestures(Arrays.asList(SelectGesture.class)); info.setSupportedHandwritingGesturePreviews( Stream.of(SelectGesture.class).collect(Collectors.toSet())); if (Flags.editorinfoHandwritingEnabled()) { final boolean isStylusHandwritingEnabled = mFlagsValueProvider.getBoolean(Flags.FLAG_EDITORINFO_HANDWRITING_ENABLED); if (isStylusHandwritingEnabled) { info.setStylusHandwritingEnabled(true); } info.packageName = "android.view.inputmethod"; Loading @@ -548,8 +553,7 @@ public class EditorInfoTest { + "prefix2: hintLocales=[en,es,zh]\n" + "prefix2: supportedHandwritingGestureTypes=SELECT\n" + "prefix2: supportedHandwritingGesturePreviewTypes=SELECT\n" + "prefix2: isStylusHandwritingEnabled=" + Flags.editorinfoHandwritingEnabled() + "\n" + "prefix2: isStylusHandwritingEnabled=" + isStylusHandwritingEnabled + "\n" + "prefix2: contentMimeTypes=[image/png]\n" + "prefix2: targetInputMethodUserId=10\n"); } Loading core/tests/InputMethodCoreTests/src/android/view/inputmethod/InputMethodInfoTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.Bundle; import android.os.Parcel; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.platform.test.flag.junit.SetFlagsRule; import androidx.test.ext.junit.runners.AndroidJUnit4; Loading @@ -43,8 +45,9 @@ import org.junit.runner.RunWith; public class InputMethodInfoTest { @Rule public SetFlagsRule mSetFlagsRule = new SetFlagsRule(SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT); public SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); @Test public void testEqualsAndHashCode() throws Exception { Loading @@ -70,7 +73,7 @@ public class InputMethodInfoTest { assertThat(imi.supportsInlineSuggestionsWithTouchExploration(), is(false)); assertThat(imi.supportsStylusHandwriting(), is(false)); assertThat(imi.createStylusHandwritingSettingsActivityIntent(), equalTo(null)); if (Flags.imeSwitcherRevampApi()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_IME_SWITCHER_REVAMP_API)) { assertThat(imi.createImeLanguageSettingsActivityIntent(), equalTo(null)); } } Loading Loading @@ -121,9 +124,8 @@ public class InputMethodInfoTest { } @Test @EnableFlags(android.companion.virtual.flags.Flags.FLAG_VDM_CUSTOM_IME) public void testIsVirtualDeviceOnly() throws Exception { mSetFlagsRule.enableFlags(android.companion.virtual.flags.Flags.FLAG_VDM_CUSTOM_IME); final InputMethodInfo imi = buildInputMethodForTest(R.xml.ime_meta_virtual_device_only); assertThat(imi.isVirtualDeviceOnly(), is(true)); Loading services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ public class InputMethodServiceTest { private static final String DISABLE_SHOW_IME_WITH_HARD_KEYBOARD_CMD = "settings put secure " + Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD + " 0"; private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); private Instrumentation mInstrumentation; private UiDevice mUiDevice; private Context mContext; Loading @@ -95,7 +97,7 @@ public class InputMethodServiceTest { private boolean mShowImeWithHardKeyboardEnabled; @Rule public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final CheckFlagsRule mCheckFlagsRule = new CheckFlagsRule(mFlagsValueProvider); @Before public void setUp() throws Exception { Loading Loading @@ -159,7 +161,7 @@ public class InputMethodServiceTest { // Press home key to hide soft keyboard. Log.i(TAG, "Press home"); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { assertThat(mUiDevice.pressHome()).isTrue(); // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. Loading Loading @@ -774,7 +776,7 @@ public class InputMethodServiceTest { backButtonUiObject.click(); mInstrumentation.waitForIdleSync(); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); Loading Loading @@ -812,7 +814,7 @@ public class InputMethodServiceTest { backButtonUiObject.longClick(); mInstrumentation.waitForIdleSync(); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); Loading Loading @@ -900,7 +902,7 @@ public class InputMethodServiceTest { assertWithMessage("Input Method Switcher Menu is shown") .that(isInputMethodPickerShown(imm)) .isTrue(); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/DefaultImeVisibilityApplierTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -76,8 +76,10 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTestBase { private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); @Rule public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final CheckFlagsRule mCheckFlagsRule = new CheckFlagsRule(mFlagsValueProvider); private DefaultImeVisibilityApplier mVisibilityApplier; @Before Loading Loading @@ -151,7 +153,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe mVisibilityApplier.applyImeVisibility(mWindowToken, ImeTracker.Token.empty(), STATE_HIDE_IME_EXPLICIT, eq(SoftInputShowHideReason.NOT_SET), mUserId); } if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, true /* invoked */); } else { Loading @@ -168,7 +170,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe mVisibilityApplier.applyImeVisibility(mWindowToken, ImeTracker.Token.empty(), STATE_HIDE_IME_NOT_ALWAYS, eq(SoftInputShowHideReason.NOT_SET), mUserId); } if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, true /* invoked */); } else { Loading @@ -182,7 +184,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe mVisibilityApplier.applyImeVisibility(mWindowToken, ImeTracker.Token.empty(), STATE_SHOW_IME_IMPLICIT, eq(SoftInputShowHideReason.NOT_SET), mUserId); } if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, true /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading Loading @@ -260,7 +262,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe verify(mVisibilityApplier).applyImeVisibility( eq(mWindowToken), any(), eq(STATE_HIDE_IME), eq(SoftInputShowHideReason.NOT_SET), eq(mUserId) /* userId */); if (!Flags.refactorInsetsController()) { if (!mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verify(mInputMethodManagerService.mWindowManagerInternal).hideIme(eq(mWindowToken), eq(displayIdToShowIme), and(not(eq(statsToken)), notNull())); } Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceWindowGainedFocusTest.java +13 −8 Original line number Diff line number Diff line Loading @@ -39,8 +39,10 @@ import static org.mockito.Mockito.when; import android.os.IBinder; import android.os.LocaleList; import android.os.RemoteException; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.Log; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.Flags; import android.window.ImeOnBackInvokedDispatcher; import com.android.internal.inputmethod.IInputMethodClient; Loading Loading @@ -89,6 +91,9 @@ public class InputMethodManagerServiceWindowGainedFocusTest }; private static final int DEFAULT_SOFT_INPUT_FLAG = StartInputFlags.VIEW_HAS_FOCUS | StartInputFlags.IS_TEXT_EDITOR; private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); @Mock VirtualDeviceManagerInternal mMockVdmInternal; Loading Loading @@ -125,7 +130,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest case SOFT_INPUT_STATE_UNSPECIFIED: boolean showSoftInput = (mSoftInputAdjustment == SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen; if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, showSoftInput /* invoked */); // A hide can only be triggered if there is no editorFocused, which this test // always sets. Loading @@ -141,7 +146,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest break; case SOFT_INPUT_STATE_VISIBLE: case SOFT_INPUT_STATE_ALWAYS_VISIBLE: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, true /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -150,7 +155,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest } break; case SOFT_INPUT_STATE_UNCHANGED: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -160,7 +165,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest break; case SOFT_INPUT_STATE_HIDDEN: case SOFT_INPUT_STATE_ALWAYS_HIDDEN: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); // In this case, we don't have to manipulate the requested visible types of // the WindowState, as they're already in the correct state Loading Loading @@ -192,7 +197,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest case SOFT_INPUT_STATE_UNSPECIFIED: boolean hideSoftInput = (mSoftInputAdjustment != SOFT_INPUT_ADJUST_RESIZE) && !mIsLargeScreen; if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // A show can only be triggered in forward navigation verifySetImeVisibility(false /* setVisible */, false /* invoked */); // A hide can only be triggered if there is no editorFocused, which this test Loading @@ -209,7 +214,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest case SOFT_INPUT_STATE_VISIBLE: case SOFT_INPUT_STATE_HIDDEN: case SOFT_INPUT_STATE_UNCHANGED: // Do nothing if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -218,7 +223,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest } break; case SOFT_INPUT_STATE_ALWAYS_VISIBLE: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, true /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -227,7 +232,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest } break; case SOFT_INPUT_STATE_ALWAYS_HIDDEN: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); // In this case, we don't have to manipulate the requested visible types of // the WindowState, as they're already in the correct state Loading Loading
core/tests/InputMethodCoreTests/src/android/view/inputmethod/EditorInfoTest.java +7 −3 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.os.LocaleList; import android.os.Parcel; import android.os.UserHandle; import android.platform.test.annotations.Presubmit; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.text.InputType; import android.text.Spannable; import android.text.SpannableString; Loading Loading @@ -87,6 +88,8 @@ public class EditorInfoTest { TEST_EDITOR_INFO.targetInputMethodUser = UserHandle.of(TEST_USER_ID); } private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); /** * Makes sure that {@code null} {@link EditorInfo#targetInputMethodUser} can be copied via * {@link Parcel}. Loading Loading @@ -522,7 +525,9 @@ public class EditorInfoTest { info.setSupportedHandwritingGestures(Arrays.asList(SelectGesture.class)); info.setSupportedHandwritingGesturePreviews( Stream.of(SelectGesture.class).collect(Collectors.toSet())); if (Flags.editorinfoHandwritingEnabled()) { final boolean isStylusHandwritingEnabled = mFlagsValueProvider.getBoolean(Flags.FLAG_EDITORINFO_HANDWRITING_ENABLED); if (isStylusHandwritingEnabled) { info.setStylusHandwritingEnabled(true); } info.packageName = "android.view.inputmethod"; Loading @@ -548,8 +553,7 @@ public class EditorInfoTest { + "prefix2: hintLocales=[en,es,zh]\n" + "prefix2: supportedHandwritingGestureTypes=SELECT\n" + "prefix2: supportedHandwritingGesturePreviewTypes=SELECT\n" + "prefix2: isStylusHandwritingEnabled=" + Flags.editorinfoHandwritingEnabled() + "\n" + "prefix2: isStylusHandwritingEnabled=" + isStylusHandwritingEnabled + "\n" + "prefix2: contentMimeTypes=[image/png]\n" + "prefix2: targetInputMethodUserId=10\n"); } Loading
core/tests/InputMethodCoreTests/src/android/view/inputmethod/InputMethodInfoTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.content.pm.ResolveInfo; import android.content.pm.ServiceInfo; import android.os.Bundle; import android.os.Parcel; import android.platform.test.annotations.EnableFlags; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.platform.test.flag.junit.SetFlagsRule; import androidx.test.ext.junit.runners.AndroidJUnit4; Loading @@ -43,8 +45,9 @@ import org.junit.runner.RunWith; public class InputMethodInfoTest { @Rule public SetFlagsRule mSetFlagsRule = new SetFlagsRule(SetFlagsRule.DefaultInitValueType.DEVICE_DEFAULT); public SetFlagsRule mSetFlagsRule = new SetFlagsRule(); private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); @Test public void testEqualsAndHashCode() throws Exception { Loading @@ -70,7 +73,7 @@ public class InputMethodInfoTest { assertThat(imi.supportsInlineSuggestionsWithTouchExploration(), is(false)); assertThat(imi.supportsStylusHandwriting(), is(false)); assertThat(imi.createStylusHandwritingSettingsActivityIntent(), equalTo(null)); if (Flags.imeSwitcherRevampApi()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_IME_SWITCHER_REVAMP_API)) { assertThat(imi.createImeLanguageSettingsActivityIntent(), equalTo(null)); } } Loading Loading @@ -121,9 +124,8 @@ public class InputMethodInfoTest { } @Test @EnableFlags(android.companion.virtual.flags.Flags.FLAG_VDM_CUSTOM_IME) public void testIsVirtualDeviceOnly() throws Exception { mSetFlagsRule.enableFlags(android.companion.virtual.flags.Flags.FLAG_VDM_CUSTOM_IME); final InputMethodInfo imi = buildInputMethodForTest(R.xml.ime_meta_virtual_device_only); assertThat(imi.isVirtualDeviceOnly(), is(true)); Loading
services/tests/InputMethodSystemServerTests/src/com/android/inputmethodservice/InputMethodServiceTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -85,6 +85,8 @@ public class InputMethodServiceTest { private static final String DISABLE_SHOW_IME_WITH_HARD_KEYBOARD_CMD = "settings put secure " + Settings.Secure.SHOW_IME_WITH_HARD_KEYBOARD + " 0"; private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); private Instrumentation mInstrumentation; private UiDevice mUiDevice; private Context mContext; Loading @@ -95,7 +97,7 @@ public class InputMethodServiceTest { private boolean mShowImeWithHardKeyboardEnabled; @Rule public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final CheckFlagsRule mCheckFlagsRule = new CheckFlagsRule(mFlagsValueProvider); @Before public void setUp() throws Exception { Loading Loading @@ -159,7 +161,7 @@ public class InputMethodServiceTest { // Press home key to hide soft keyboard. Log.i(TAG, "Press home"); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { assertThat(mUiDevice.pressHome()).isTrue(); // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. Loading Loading @@ -774,7 +776,7 @@ public class InputMethodServiceTest { backButtonUiObject.click(); mInstrumentation.waitForIdleSync(); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); Loading Loading @@ -812,7 +814,7 @@ public class InputMethodServiceTest { backButtonUiObject.longClick(); mInstrumentation.waitForIdleSync(); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); Loading Loading @@ -900,7 +902,7 @@ public class InputMethodServiceTest { assertWithMessage("Input Method Switcher Menu is shown") .that(isInputMethodPickerShown(imm)) .isTrue(); if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // The IME visibility is only sent at the end of the animation. Therefore, we have to // wait until the visibility was sent to the server and the IME window hidden. eventually(() -> assertThat(mInputMethodService.isInputViewShown()).isFalse()); Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/DefaultImeVisibilityApplierTest.java +7 −5 Original line number Diff line number Diff line Loading @@ -76,8 +76,10 @@ import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTestBase { private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); @Rule public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule(); public final CheckFlagsRule mCheckFlagsRule = new CheckFlagsRule(mFlagsValueProvider); private DefaultImeVisibilityApplier mVisibilityApplier; @Before Loading Loading @@ -151,7 +153,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe mVisibilityApplier.applyImeVisibility(mWindowToken, ImeTracker.Token.empty(), STATE_HIDE_IME_EXPLICIT, eq(SoftInputShowHideReason.NOT_SET), mUserId); } if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, true /* invoked */); } else { Loading @@ -168,7 +170,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe mVisibilityApplier.applyImeVisibility(mWindowToken, ImeTracker.Token.empty(), STATE_HIDE_IME_NOT_ALWAYS, eq(SoftInputShowHideReason.NOT_SET), mUserId); } if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, true /* invoked */); } else { Loading @@ -182,7 +184,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe mVisibilityApplier.applyImeVisibility(mWindowToken, ImeTracker.Token.empty(), STATE_SHOW_IME_IMPLICIT, eq(SoftInputShowHideReason.NOT_SET), mUserId); } if (Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, true /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading Loading @@ -260,7 +262,7 @@ public class DefaultImeVisibilityApplierTest extends InputMethodManagerServiceTe verify(mVisibilityApplier).applyImeVisibility( eq(mWindowToken), any(), eq(STATE_HIDE_IME), eq(SoftInputShowHideReason.NOT_SET), eq(mUserId) /* userId */); if (!Flags.refactorInsetsController()) { if (!mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verify(mInputMethodManagerService.mWindowManagerInternal).hideIme(eq(mWindowToken), eq(displayIdToShowIme), and(not(eq(statsToken)), notNull())); } Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceWindowGainedFocusTest.java +13 −8 Original line number Diff line number Diff line Loading @@ -39,8 +39,10 @@ import static org.mockito.Mockito.when; import android.os.IBinder; import android.os.LocaleList; import android.os.RemoteException; import android.platform.test.flag.junit.DeviceFlagsValueProvider; import android.util.Log; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.Flags; import android.window.ImeOnBackInvokedDispatcher; import com.android.internal.inputmethod.IInputMethodClient; Loading Loading @@ -89,6 +91,9 @@ public class InputMethodManagerServiceWindowGainedFocusTest }; private static final int DEFAULT_SOFT_INPUT_FLAG = StartInputFlags.VIEW_HAS_FOCUS | StartInputFlags.IS_TEXT_EDITOR; private final DeviceFlagsValueProvider mFlagsValueProvider = new DeviceFlagsValueProvider(); @Mock VirtualDeviceManagerInternal mMockVdmInternal; Loading Loading @@ -125,7 +130,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest case SOFT_INPUT_STATE_UNSPECIFIED: boolean showSoftInput = (mSoftInputAdjustment == SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen; if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, showSoftInput /* invoked */); // A hide can only be triggered if there is no editorFocused, which this test // always sets. Loading @@ -141,7 +146,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest break; case SOFT_INPUT_STATE_VISIBLE: case SOFT_INPUT_STATE_ALWAYS_VISIBLE: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, true /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -150,7 +155,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest } break; case SOFT_INPUT_STATE_UNCHANGED: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -160,7 +165,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest break; case SOFT_INPUT_STATE_HIDDEN: case SOFT_INPUT_STATE_ALWAYS_HIDDEN: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); // In this case, we don't have to manipulate the requested visible types of // the WindowState, as they're already in the correct state Loading Loading @@ -192,7 +197,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest case SOFT_INPUT_STATE_UNSPECIFIED: boolean hideSoftInput = (mSoftInputAdjustment != SOFT_INPUT_ADJUST_RESIZE) && !mIsLargeScreen; if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { // A show can only be triggered in forward navigation verifySetImeVisibility(false /* setVisible */, false /* invoked */); // A hide can only be triggered if there is no editorFocused, which this test Loading @@ -209,7 +214,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest case SOFT_INPUT_STATE_VISIBLE: case SOFT_INPUT_STATE_HIDDEN: case SOFT_INPUT_STATE_UNCHANGED: // Do nothing if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -218,7 +223,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest } break; case SOFT_INPUT_STATE_ALWAYS_VISIBLE: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, true /* invoked */); verifySetImeVisibility(false /* setVisible */, false /* invoked */); } else { Loading @@ -227,7 +232,7 @@ public class InputMethodManagerServiceWindowGainedFocusTest } break; case SOFT_INPUT_STATE_ALWAYS_HIDDEN: if (android.view.inputmethod.Flags.refactorInsetsController()) { if (mFlagsValueProvider.getBoolean(Flags.FLAG_REFACTOR_INSETS_CONTROLLER)) { verifySetImeVisibility(true /* setVisible */, false /* invoked */); // In this case, we don't have to manipulate the requested visible types of // the WindowState, as they're already in the correct state Loading