List of usage examples for android.view.accessibility AccessibilityWindowInfo getType
public int getType()
From source file:com.android.utils.WindowManager.java
private static AccessibilityWindowInfo getDefaultWindow(List<AccessibilityWindowInfo> windows) { if (windows.size() == 0) { return null; }//from www . j a va 2 s .co m for (AccessibilityWindowInfo window : windows) { if (window != null && window.getType() == AccessibilityWindowInfo.TYPE_APPLICATION) { return window; } } return windows.get(0); }
From source file:com.android.screenspeak.eventprocessor.ProcessorVolumeStream.java
private AccessibilityNodeInfoCompat findInputFocus() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { List<AccessibilityWindowInfo> awis = mService.getWindows(); for (AccessibilityWindowInfo awi : awis) { if (awi.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) continue; AccessibilityNodeInfo info = awi.getRoot(); if (info == null) continue; AccessibilityNodeInfoCompat root = new AccessibilityNodeInfoCompat(awi.getRoot()); AccessibilityNodeInfoCompat focus = root.findFocus(AccessibilityNodeInfo.FOCUS_INPUT); if (focus != null) { if (!root.equals(focus)) root.recycle();/*from w ww . j av a 2 s.c om*/ return focus; } else { root.recycle(); } } return null; } else { AccessibilityNodeInfo info = mService.getRootInActiveWindow(); if (info == null) return null; AccessibilityNodeInfoCompat root = new AccessibilityNodeInfoCompat(info); AccessibilityNodeInfoCompat focus = root.findFocus(AccessibilityNodeInfoCompat.FOCUS_INPUT); if (focus != null && !focus.equals(root)) root.recycle(); return focus; } }
From source file:com.android.utils.WindowManager.java
public boolean isInputWindowOnScreen() { if (mWindows == null) { return false; }//from w w w . j a va 2s.com for (AccessibilityWindowInfo window : mWindows) { if (window != null && window.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { return true; } } return false; }
From source file:com.android.utils.WindowManager.java
/** * returns true if there is no window with windowType before baseWindow *//*w ww .j a va2 s .c o m*/ public boolean isFirstWindow(AccessibilityWindowInfo baseWindow, int windowType) { int index = getWindowIndex(baseWindow); if (index <= 0) { return true; } for (int i = index - 1; i > 0; i--) { AccessibilityWindowInfo window = mWindows.get(i); if (window != null && window.getType() == windowType) { return false; } } return true; }
From source file:com.android.utils.WindowManager.java
/** * returns true if there is no window with windowType after baseWindow *//*from w w w. j a va 2 s .c om*/ public boolean isLastWindow(AccessibilityWindowInfo baseWindow, int windowType) { int index = getWindowIndex(baseWindow); if (index == WRONG_INDEX) { return true; } int count = mWindows.size(); for (int i = index + 1; i < count; i++) { AccessibilityWindowInfo window = mWindows.get(i); if (window != null && window.getType() == windowType) { return false; } } return true; }
From source file:com.android.utils.WindowManager.java
private boolean isFocusedWindowType(int windowType) { AccessibilityWindowInfo info = getCurrentWindow(false /* useInputFocus */); return info != null && info.getType() == windowType; }
From source file:com.android.utils.WindowManager.java
public int getWindowType(int windowId) { if (mWindows != null) { for (AccessibilityWindowInfo window : mWindows) { if (window != null && window.getId() == windowId) { return window.getType(); }/*w w w . jav a 2 s . c o m*/ } } return WRONG_WINDOW_TYPE; }
From source file:com.android.screenspeak.eventprocessor.ProcessorVolumeStream.java
private boolean attemptNavigation(int button) { AccessibilityNodeInfoCompat node = mCursorController.getCursor(); // Clear focus if it is on an IME if (node != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { for (AccessibilityWindowInfo awi : mService.getWindows()) { if (awi.getId() == node.getWindowId()) { if (awi.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { node.recycle();//w w w. ja va 2 s. c o m node = null; } break; } } } } if (node == null) { node = findInputFocus(); } if (node == null) return false; try { if (AccessibilityNodeInfoUtils.nodeMatchesClassByType(node, SeekBar.class)) { navigateSlider(button); return true; } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { if (((AccessibilityNodeInfo) node.getInfo()).isEditable()) { navigateEditText(button, node); return true; } } else { if (AccessibilityNodeInfoUtils.nodeMatchesClassByType(node, EditText.class) || AccessibilityNodeInfoUtils.nodeMatchesClassByName(node, "com.google.android.search.searchplate.SimpleSearchText")) { navigateEditText(button, node); return true; } } return false; } finally { AccessibilityNodeInfoUtils.recycleNodes(node); } }
From source file:com.android.talkback.eventprocessor.ProcessorVolumeStream.java
private boolean attemptNavigation(int button) { AccessibilityNodeInfoCompat node = mCursorController.getCursorOrInputCursor(); // Clear focus if it is on an IME if (node != null) { if (API_LEVEL_SUPPORTS_WINDOW_NAVIGATION) { for (AccessibilityWindowInfo awi : mService.getWindows()) { if (awi.getId() == node.getWindowId()) { if (awi.getType() == AccessibilityWindowInfo.TYPE_INPUT_METHOD) { node.recycle();/*ww w . j ava2s . c o m*/ node = null; } break; } } } } // If we cleared the focus before it is on an IME, try to get the current node again. if (node == null) { node = mCursorController.getCursorOrInputCursor(); } if (node == null) return false; try { if (Role.getRole(node) == Role.ROLE_SEEK_CONTROL) { navigateSlider(button, node); return true; } // In general, do not allow volume key navigation when the a11y focus is placed but // it is not on the edit field that the keyboard is currently editing. // // Example 1: // EditText1 has input focus and EditText2 has accessibility focus. // getCursorOrInputCursor() will return EditText2 based on its priority order. // EditText2.isFocused() = false, so we should not allow volume keys to control text. // // Example 2: // EditText1 in Window1 has input focus. EditText2 in Window2 has input focus as well. // If Window1 is input-focused but Window2 has the accessibility focus, don't allow // the volume keys to control the text. boolean nodeWindowFocused; if (API_LEVEL_SUPPORTS_WINDOW_NAVIGATION) { nodeWindowFocused = node.getWindow() != null && node.getWindow().isFocused(); } else { nodeWindowFocused = true; } if (node.isFocused() && nodeWindowFocused && AccessibilityNodeInfoUtils.isEditable(node)) { navigateEditText(button, node); return true; } return false; } finally { AccessibilityNodeInfoUtils.recycleNodes(node); } }
From source file:com.android.talkback.eventprocessor.ProcessorScreen.java
private boolean isSystemWindow(int windowId) { if (mSystemWindowIdsSet.contains(windowId)) { return true; }/*from ww w . j a va 2s . co m*/ if (!mIsSplitScreenModeAvailable) { return false; } for (AccessibilityWindowInfo window : mService.getWindows()) { if (window.getId() == windowId && window.getType() == AccessibilityWindowInfo.TYPE_SYSTEM) { return true; } } return false; }