Loading services/core/java/com/android/server/policy/PhoneWindowManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -3409,7 +3409,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { case KeyEvent.KEYCODE_SPACE: if (down && repeatCount == 0) { // Handle keyboard layout switching. (CTRL + SPACE) if (KeyEvent.metaStateHasModifiers(metaState, KeyEvent.META_CTRL_ON)) { if (KeyEvent.metaStateHasModifiers(metaState & ~KeyEvent.META_SHIFT_MASK, KeyEvent.META_CTRL_ON)) { int direction = (metaState & KeyEvent.META_SHIFT_MASK) != 0 ? -1 : 1; mWindowManagerFuncs.switchKeyboardLayout(event.getDeviceId(), direction); return true; Loading services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java +26 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.KeyEvent.KEYCODE_META_LEFT; import static android.view.KeyEvent.KEYCODE_N; import static android.view.KeyEvent.KEYCODE_P; import static android.view.KeyEvent.KEYCODE_S; import static android.view.KeyEvent.KEYCODE_SHIFT_LEFT; import static android.view.KeyEvent.KEYCODE_SLASH; import static android.view.KeyEvent.KEYCODE_SPACE; import static android.view.KeyEvent.KEYCODE_TAB; Loading @@ -35,10 +36,15 @@ import static android.view.KeyEvent.KEYCODE_Z; import android.content.Intent; import android.os.RemoteException; import android.platform.test.annotations.Presubmit; import android.util.SparseArray; import androidx.test.filters.SmallTest; import org.junit.Test; @Presubmit @SmallTest public class ModifierShortcutTests extends ShortcutKeyTestBase { private static final SparseArray<String> META_SHORTCUTS = new SparseArray<>(); static { Loading Loading @@ -82,7 +88,16 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase { @Test public void testCtrlSpace() { sendKeyCombination(new int[]{KEYCODE_CTRL_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(); mPhoneWindowManager.assertSwitchKeyboardLayout(1); } /** * CTRL + SHIFT + SPACE to switch keyboard layout backwards. */ @Test public void testCtrlShiftSpace() { sendKeyCombination(new int[]{KEYCODE_CTRL_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(-1); } /** Loading @@ -91,7 +106,16 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase { @Test public void testMetaSpace() { sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(); mPhoneWindowManager.assertSwitchKeyboardLayout(1); } /** * META + SHIFT + SPACE to switch keyboard layout backwards. */ @Test public void testMetaShiftSpace() { sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(-1); } /** Loading services/tests/wmtests/src/com/android/server/policy/TestPhoneWindowManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -415,9 +415,9 @@ class TestPhoneWindowManager { verify(mStatusBarManagerInternal).showRecentApps(anyBoolean()); } void assertSwitchKeyboardLayout() { void assertSwitchKeyboardLayout(int direction) { waitForIdle(); verify(mWindowManagerFuncsImpl).switchKeyboardLayout(anyInt(), anyInt()); verify(mWindowManagerFuncsImpl).switchKeyboardLayout(anyInt(), eq(direction)); } void assertTakeBugreport() { Loading Loading
services/core/java/com/android/server/policy/PhoneWindowManager.java +2 −1 Original line number Diff line number Diff line Loading @@ -3409,7 +3409,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { case KeyEvent.KEYCODE_SPACE: if (down && repeatCount == 0) { // Handle keyboard layout switching. (CTRL + SPACE) if (KeyEvent.metaStateHasModifiers(metaState, KeyEvent.META_CTRL_ON)) { if (KeyEvent.metaStateHasModifiers(metaState & ~KeyEvent.META_SHIFT_MASK, KeyEvent.META_CTRL_ON)) { int direction = (metaState & KeyEvent.META_SHIFT_MASK) != 0 ? -1 : 1; mWindowManagerFuncs.switchKeyboardLayout(event.getDeviceId(), direction); return true; Loading
services/tests/wmtests/src/com/android/server/policy/ModifierShortcutTests.java +26 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import static android.view.KeyEvent.KEYCODE_META_LEFT; import static android.view.KeyEvent.KEYCODE_N; import static android.view.KeyEvent.KEYCODE_P; import static android.view.KeyEvent.KEYCODE_S; import static android.view.KeyEvent.KEYCODE_SHIFT_LEFT; import static android.view.KeyEvent.KEYCODE_SLASH; import static android.view.KeyEvent.KEYCODE_SPACE; import static android.view.KeyEvent.KEYCODE_TAB; Loading @@ -35,10 +36,15 @@ import static android.view.KeyEvent.KEYCODE_Z; import android.content.Intent; import android.os.RemoteException; import android.platform.test.annotations.Presubmit; import android.util.SparseArray; import androidx.test.filters.SmallTest; import org.junit.Test; @Presubmit @SmallTest public class ModifierShortcutTests extends ShortcutKeyTestBase { private static final SparseArray<String> META_SHORTCUTS = new SparseArray<>(); static { Loading Loading @@ -82,7 +88,16 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase { @Test public void testCtrlSpace() { sendKeyCombination(new int[]{KEYCODE_CTRL_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(); mPhoneWindowManager.assertSwitchKeyboardLayout(1); } /** * CTRL + SHIFT + SPACE to switch keyboard layout backwards. */ @Test public void testCtrlShiftSpace() { sendKeyCombination(new int[]{KEYCODE_CTRL_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(-1); } /** Loading @@ -91,7 +106,16 @@ public class ModifierShortcutTests extends ShortcutKeyTestBase { @Test public void testMetaSpace() { sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(); mPhoneWindowManager.assertSwitchKeyboardLayout(1); } /** * META + SHIFT + SPACE to switch keyboard layout backwards. */ @Test public void testMetaShiftSpace() { sendKeyCombination(new int[]{KEYCODE_META_LEFT, KEYCODE_SHIFT_LEFT, KEYCODE_SPACE}, 0); mPhoneWindowManager.assertSwitchKeyboardLayout(-1); } /** Loading
services/tests/wmtests/src/com/android/server/policy/TestPhoneWindowManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -415,9 +415,9 @@ class TestPhoneWindowManager { verify(mStatusBarManagerInternal).showRecentApps(anyBoolean()); } void assertSwitchKeyboardLayout() { void assertSwitchKeyboardLayout(int direction) { waitForIdle(); verify(mWindowManagerFuncsImpl).switchKeyboardLayout(anyInt(), anyInt()); verify(mWindowManagerFuncsImpl).switchKeyboardLayout(anyInt(), eq(direction)); } void assertTakeBugreport() { Loading