Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import static org.mockito.Mockito.when; import android.app.ActivityManagerInternal; import android.content.Context; import android.content.pm.PackageManagerInternal; import android.content.res.Configuration; import android.hardware.display.DisplayManagerInternal; import android.hardware.input.IInputManager; import android.hardware.input.InputManagerGlobal; Loading Loading @@ -121,6 +122,7 @@ public class InputMethodManagerServiceTestBase { protected IInputMethodInvoker mMockInputMethodInvoker; protected InputMethodManagerService mInputMethodManagerService; protected ServiceThread mServiceThread; protected boolean mIsLargeScreen; @BeforeClass public static void setupClass() { Loading @@ -145,6 +147,8 @@ public class InputMethodManagerServiceTestBase { spyOn(mContext); mTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; mIsLargeScreen = mContext.getResources().getConfiguration() .isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE); mCallingUserId = UserHandle.getCallingUserId(); mEditorInfo = new EditorInfo(); mEditorInfo.packageName = TEST_EDITOR_PKG_NAME; Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceWindowGainedFocusTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -124,7 +124,8 @@ public class InputMethodManagerServiceWindowGainedFocusTest switch (mSoftInputState) { case SOFT_INPUT_STATE_UNSPECIFIED: boolean showSoftInput = mSoftInputAdjustment == SOFT_INPUT_ADJUST_RESIZE; boolean showSoftInput = (mSoftInputAdjustment == SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen; verifyShowSoftInput( showSoftInput /* setVisible */, showSoftInput /* showSoftInput */); // Soft input was hidden by default, so it doesn't need to call Loading Loading @@ -165,7 +166,8 @@ public class InputMethodManagerServiceWindowGainedFocusTest switch (mSoftInputState) { case SOFT_INPUT_STATE_UNSPECIFIED: boolean hideSoftInput = mSoftInputAdjustment != SOFT_INPUT_ADJUST_RESIZE; boolean hideSoftInput = (mSoftInputAdjustment != SOFT_INPUT_ADJUST_RESIZE) && !mIsLargeScreen; verifyShowSoftInput(false /* setVisible */, false /* showSoftInput */); // Soft input was hidden by default, so it doesn't need to call // {@code IMS#hideSoftInput()}. Loading tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/AutoShowTest.java +14 −13 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static com.google.common.truth.Truth.assertThat; import android.app.Instrumentation; import android.content.Intent; import android.content.res.Configuration; import android.os.SystemClock; import android.platform.test.annotations.RootPermissionTest; import android.platform.test.rule.UnlockScreenRule; Loading Loading @@ -69,8 +70,6 @@ public final class AutoShowTest { new PressHomeBeforeTestRule(); @Rule(order = 4) public ScreenCaptureRule mScreenCaptureRule = new ScreenCaptureRule("/sdcard/InputMethodStressTest"); // TODO(b/240359838): add test case {@code Configuration.SCREENLAYOUT_SIZE_LARGE}. @Parameterized.Parameters( name = "windowFocusFlags={0}, softInputVisibility={1}, softInputAdjustment={2}") public static List<Object[]> windowAndSoftInputFlagParameters() { Loading @@ -80,11 +79,14 @@ public final class AutoShowTest { private final int mSoftInputFlags; private final int mWindowFocusFlags; private final Instrumentation mInstrumentation; private final boolean mIsLargeScreen; public AutoShowTest(int windowFocusFlags, int softInputVisibility, int softInputAdjustment) { mSoftInputFlags = softInputVisibility | softInputAdjustment; mWindowFocusFlags = windowFocusFlags; mInstrumentation = InstrumentationRegistry.getInstrumentation(); mIsLargeScreen = mInstrumentation.getContext().getResources() .getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE); } /** Loading Loading @@ -322,8 +324,7 @@ public final class AutoShowTest { verifyClickBehavior(activity); } public static void verifyAutoShowBehavior_forwardWithKeyboardOff(TestActivity activity) { // public: also used by ImeOpenCloseStressTest private void verifyAutoShowBehavior_forwardWithKeyboardOff(TestActivity activity) { if (hasUnfocusableWindowFlags(activity)) { verifyImeAlwaysHiddenWithWindowFlagSet(activity); return; Loading Loading @@ -353,12 +354,12 @@ public final class AutoShowTest { break; } case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED: { if (softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { if ((softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen) { // The current system behavior will choose to show IME automatically when // navigating forward to an app that has no visibility state specified // (i.e. SOFT_INPUT_STATE_UNSPECIFIED) with set SOFT_INPUT_ADJUST_RESIZE // flag. // flag or running on a large screen device. waitOnMainUntilImeIsShown(editText); } else { verifyImeIsAlwaysHidden(editText); Loading @@ -370,7 +371,7 @@ public final class AutoShowTest { } } private static void verifyAutoShowBehavior_forwardWithKeyboardOn(TestActivity activity) { private void verifyAutoShowBehavior_forwardWithKeyboardOn(TestActivity activity) { int windowFlags = activity.getWindow().getAttributes().flags; int softInputMode = activity.getWindow().getAttributes().softInputMode; int softInputVisibility = softInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_STATE; Loading Loading @@ -414,12 +415,12 @@ public final class AutoShowTest { break; } case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED: { if (softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { if ((softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen) { // The current system behavior will choose to show IME automatically when // navigating // forward to an app that has no visibility state specified (i.e. // SOFT_INPUT_STATE_UNSPECIFIED) with set SOFT_INPUT_ADJUST_RESIZE flag. // navigating forward to an app that has no visibility state specified (i.e. // SOFT_INPUT_STATE_UNSPECIFIED) with set SOFT_INPUT_ADJUST_RESIZE flag or // running on a large screen device. waitOnMainUntilImeIsShown(editText); } else { verifyImeIsAlwaysHidden(editText); Loading Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceTestBase.java +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import static org.mockito.Mockito.when; import android.app.ActivityManagerInternal; import android.content.Context; import android.content.pm.PackageManagerInternal; import android.content.res.Configuration; import android.hardware.display.DisplayManagerInternal; import android.hardware.input.IInputManager; import android.hardware.input.InputManagerGlobal; Loading Loading @@ -121,6 +122,7 @@ public class InputMethodManagerServiceTestBase { protected IInputMethodInvoker mMockInputMethodInvoker; protected InputMethodManagerService mInputMethodManagerService; protected ServiceThread mServiceThread; protected boolean mIsLargeScreen; @BeforeClass public static void setupClass() { Loading @@ -145,6 +147,8 @@ public class InputMethodManagerServiceTestBase { spyOn(mContext); mTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; mIsLargeScreen = mContext.getResources().getConfiguration() .isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE); mCallingUserId = UserHandle.getCallingUserId(); mEditorInfo = new EditorInfo(); mEditorInfo.packageName = TEST_EDITOR_PKG_NAME; Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodManagerServiceWindowGainedFocusTest.java +4 −2 Original line number Diff line number Diff line Loading @@ -124,7 +124,8 @@ public class InputMethodManagerServiceWindowGainedFocusTest switch (mSoftInputState) { case SOFT_INPUT_STATE_UNSPECIFIED: boolean showSoftInput = mSoftInputAdjustment == SOFT_INPUT_ADJUST_RESIZE; boolean showSoftInput = (mSoftInputAdjustment == SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen; verifyShowSoftInput( showSoftInput /* setVisible */, showSoftInput /* showSoftInput */); // Soft input was hidden by default, so it doesn't need to call Loading Loading @@ -165,7 +166,8 @@ public class InputMethodManagerServiceWindowGainedFocusTest switch (mSoftInputState) { case SOFT_INPUT_STATE_UNSPECIFIED: boolean hideSoftInput = mSoftInputAdjustment != SOFT_INPUT_ADJUST_RESIZE; boolean hideSoftInput = (mSoftInputAdjustment != SOFT_INPUT_ADJUST_RESIZE) && !mIsLargeScreen; verifyShowSoftInput(false /* setVisible */, false /* showSoftInput */); // Soft input was hidden by default, so it doesn't need to call // {@code IMS#hideSoftInput()}. Loading
tests/InputMethodStressTest/src/com/android/inputmethod/stresstest/AutoShowTest.java +14 −13 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import static com.google.common.truth.Truth.assertThat; import android.app.Instrumentation; import android.content.Intent; import android.content.res.Configuration; import android.os.SystemClock; import android.platform.test.annotations.RootPermissionTest; import android.platform.test.rule.UnlockScreenRule; Loading Loading @@ -69,8 +70,6 @@ public final class AutoShowTest { new PressHomeBeforeTestRule(); @Rule(order = 4) public ScreenCaptureRule mScreenCaptureRule = new ScreenCaptureRule("/sdcard/InputMethodStressTest"); // TODO(b/240359838): add test case {@code Configuration.SCREENLAYOUT_SIZE_LARGE}. @Parameterized.Parameters( name = "windowFocusFlags={0}, softInputVisibility={1}, softInputAdjustment={2}") public static List<Object[]> windowAndSoftInputFlagParameters() { Loading @@ -80,11 +79,14 @@ public final class AutoShowTest { private final int mSoftInputFlags; private final int mWindowFocusFlags; private final Instrumentation mInstrumentation; private final boolean mIsLargeScreen; public AutoShowTest(int windowFocusFlags, int softInputVisibility, int softInputAdjustment) { mSoftInputFlags = softInputVisibility | softInputAdjustment; mWindowFocusFlags = windowFocusFlags; mInstrumentation = InstrumentationRegistry.getInstrumentation(); mIsLargeScreen = mInstrumentation.getContext().getResources() .getConfiguration().isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE); } /** Loading Loading @@ -322,8 +324,7 @@ public final class AutoShowTest { verifyClickBehavior(activity); } public static void verifyAutoShowBehavior_forwardWithKeyboardOff(TestActivity activity) { // public: also used by ImeOpenCloseStressTest private void verifyAutoShowBehavior_forwardWithKeyboardOff(TestActivity activity) { if (hasUnfocusableWindowFlags(activity)) { verifyImeAlwaysHiddenWithWindowFlagSet(activity); return; Loading Loading @@ -353,12 +354,12 @@ public final class AutoShowTest { break; } case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED: { if (softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { if ((softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen) { // The current system behavior will choose to show IME automatically when // navigating forward to an app that has no visibility state specified // (i.e. SOFT_INPUT_STATE_UNSPECIFIED) with set SOFT_INPUT_ADJUST_RESIZE // flag. // flag or running on a large screen device. waitOnMainUntilImeIsShown(editText); } else { verifyImeIsAlwaysHidden(editText); Loading @@ -370,7 +371,7 @@ public final class AutoShowTest { } } private static void verifyAutoShowBehavior_forwardWithKeyboardOn(TestActivity activity) { private void verifyAutoShowBehavior_forwardWithKeyboardOn(TestActivity activity) { int windowFlags = activity.getWindow().getAttributes().flags; int softInputMode = activity.getWindow().getAttributes().softInputMode; int softInputVisibility = softInputMode & WindowManager.LayoutParams.SOFT_INPUT_MASK_STATE; Loading Loading @@ -414,12 +415,12 @@ public final class AutoShowTest { break; } case WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED: { if (softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) { if ((softInputAdjustment == WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE) || mIsLargeScreen) { // The current system behavior will choose to show IME automatically when // navigating // forward to an app that has no visibility state specified (i.e. // SOFT_INPUT_STATE_UNSPECIFIED) with set SOFT_INPUT_ADJUST_RESIZE flag. // navigating forward to an app that has no visibility state specified (i.e. // SOFT_INPUT_STATE_UNSPECIFIED) with set SOFT_INPUT_ADJUST_RESIZE flag or // running on a large screen device. waitOnMainUntilImeIsShown(editText); } else { verifyImeIsAlwaysHidden(editText); Loading