Java Code Examples for android.view.accessibility.AccessibilityWindowInfo#TYPE_INPUT_METHOD
The following examples show how to use
android.view.accessibility.AccessibilityWindowInfo#TYPE_INPUT_METHOD .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WindowEventInterpreter.java From talkback with Apache License 2.0 | 6 votes |
private static String windowTypeToString(int type) { switch (type) { case AccessibilityWindowInfo.TYPE_APPLICATION: return "TYPE_APPLICATION"; case AccessibilityWindowInfo.TYPE_INPUT_METHOD: return "TYPE_INPUT_METHOD"; case AccessibilityWindowInfo.TYPE_SYSTEM: return "TYPE_SYSTEM"; case AccessibilityWindowInfo.TYPE_ACCESSIBILITY_OVERLAY: return "TYPE_ACCESSIBILITY_OVERLAY"; case AccessibilityWindowInfo.TYPE_SPLIT_SCREEN_DIVIDER: return "TYPE_SPLIT_SCREEN_DIVIDER"; default: return "UNKNOWN"; } }
Example 2
Source File: ScreenState.java From talkback with Apache License 2.0 | 6 votes |
/** * Returns title of window with given window ID. * * <p><strong>Note: </strong> This method returns null if the window has no title, or the window * is not visible, or the window is IME or system window. */ @Nullable public CharSequence getWindowTitle(int windowId) { AccessibilityWindowInfo window = idToWindowInfoMap.get(windowId); if ((window == null) || (window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) || (window.getType() == AccessibilityWindowInfo.TYPE_SYSTEM) || (window.getType() == AccessibilityWindowInfo.TYPE_SPLIT_SCREEN_DIVIDER)) { // Only return title for application or accessibility windows. return null; } CharSequence eventTitle = overriddenWindowTitles.get(windowId); if (!TextUtils.isEmpty(eventTitle)) { return eventTitle; } if (BuildVersionUtils.isAtLeastN()) { // AccessibilityWindowInfo.getTitle() is available since API 24. CharSequence infoTitle = window.getTitle(); if (!TextUtils.isEmpty(infoTitle)) { return infoTitle; } } return null; }
Example 3
Source File: ProcessorPhoneticLetters.java From talkback with Apache License 2.0 | 6 votes |
private boolean isKeyboardEvent(AccessibilityEvent event) { if (event.getEventType() != AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED) { return false; } // For platform since lollipop, check that the current window is an // Input Method. final AccessibilityNodeInfo source = event.getSource(); if (source == null) { return false; } int windowId = source.getWindowId(); source.recycle(); WindowManager manager = new WindowManager(service); return manager.getWindowType(windowId) == AccessibilityWindowInfo.TYPE_INPUT_METHOD; }
Example 4
Source File: OversecAccessibilityService.java From oversec with GNU General Public License v3.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private AccessibilityWindowInfo getWindowOfTypeIme() { try { List<AccessibilityWindowInfo> ww = getWindows(); for (AccessibilityWindowInfo w : ww) { if (w.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { return w; } } } catch (java.lang.SecurityException ex) { //This can only happen when switching users! Ln.e(ex, "failed to getWindows!"); } return null; }
Example 5
Source File: MainActivityTest.java From quickstart-android with Apache License 2.0 | 5 votes |
private void closeKeyboard() { for (AccessibilityWindowInfo w : getInstrumentation().getUiAutomation().getWindows()) { if (w.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { device.pressBack(); return; } } }
Example 6
Source File: WindowManager.java From talkback with Apache License 2.0 | 5 votes |
public boolean isInputWindowOnScreen() { if (mWindows == null) { return false; } for (AccessibilityWindowInfo window : mWindows) { if (window != null && window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { return true; } } return false; }
Example 7
Source File: MainTreeBuilder.java From talkback with Apache License 2.0 | 4 votes |
/** * Adds view hierarchies from several windows to the tree. * * @param windowList The windows whose hierarchies should be added to the tree * @param treeToBuildOn The tree to which the hierarchies from windowList should be added * @param shouldPlaceTreeFirst Whether the treeToBuildOn should be placed first in the tree; if it * should not be placed first, it will be placed last * @return An updated tree that includes {@code treeToBuildOn} */ public TreeScanNode addWindowListToTree( List<SwitchAccessWindowInfo> windowList, TreeScanNode treeToBuildOn, boolean shouldPlaceTreeFirst) { if (windowList != null) { List<SwitchAccessWindowInfo> wList = new ArrayList<>(windowList); sortWindowListForTraversalOrder(wList); removeStatusBarButtonsFromWindowList(wList); if (SwitchAccessPreferenceUtils.isGroupSelectionEnabled(service)) { return orderNTreeBuilder.addWindowListToTree( wList, treeToBuildOn, SwitchAccessPreferenceUtils.shouldScanNonActionableItems(service)); } // Make sure that if the user doesn't perform an explicit selection, focus is cleared. TreeScanNode newTree = new ClearFocusNode(); if (!shouldPlaceTreeFirst) { if (treeToBuildOn != null) { newTree = new TreeScanSelectionNode(treeToBuildOn, new ClearFocusNode()); } } else if (treeToBuildOn == null) { shouldPlaceTreeFirst = false; } for (SwitchAccessWindowInfo window : wList) { SwitchAccessNodeCompat windowRoot = window.getRoot(); if (windowRoot != null) { if (!SwitchAccessPreferenceUtils.isLinearScanningEnabled(service) && window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { newTree = rowColumnTreeBuilder.addViewHierarchyToTree( windowRoot, newTree, SwitchAccessPreferenceUtils.shouldScanNonActionableItems(service)); } else { newTree = addViewHierarchyToTree( windowRoot, newTree, SwitchAccessPreferenceUtils.shouldScanNonActionableItems(service)); } windowRoot.recycle(); } } if (shouldPlaceTreeFirst) { newTree = new TreeScanSelectionNode(treeToBuildOn, newTree); } return newTree; } return treeToBuildOn; }
Example 8
Source File: ShowActionsMenuNode.java From talkback with Apache License 2.0 | 4 votes |
/** Returns whether this node corresponds to an item on the IME. */ public boolean isImeWindowType() { return AccessibilityNodeInfoUtils.getWindowType(nodeCompats.get(0)) == AccessibilityWindowInfo.TYPE_INPUT_METHOD; }
Example 9
Source File: WindowTransitionInfo.java From talkback with Apache License 2.0 | 4 votes |
private static boolean isSystemOrImeWindow(AccessibilityWindowInfo window) { return (window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) || (window.getType() == AccessibilityWindowInfo.TYPE_SYSTEM); }