Java Code Examples for android.view.accessibility.AccessibilityEvent#isPassword()
The following examples show how to use
android.view.accessibility.AccessibilityEvent#isPassword() .
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: TextEntryProvider.java From PrivacyStreams with Apache License 2.0 | 5 votes |
private void onViewTextChanged(AccessibilityEvent event) { List<CharSequence> text = event.getText(); if (text == null || text.size()==0 || text.get(0).length() == 0 || event.isPassword()) { this.mEvent = null; } else { onNewText(text.get(0), event); } }
Example 2
Source File: AccessibilityEventUtils.java From brailleback with Apache License 2.0 | 4 votes |
/** * @return If the <code>first</code> event is equal to the <code>second</code>. */ public static boolean eventEquals(AccessibilityEvent first, AccessibilityEvent second) { // TODO: The framework should implement AccessibilityEvent#equals() if (first == null || second == null) { return false; } if (first.getEventType() != second.getEventType()) { return false; } if (first.getPackageName() == null) { if (second.getPackageName() != null) { return false; } } else if (!first.getPackageName().equals(second.getPackageName())) { return false; } if (first.getClassName() == null) { if (second.getClassName() != null) { return false; } } else if (!first.getClassName().equals(second.getClassName())) { return false; } if (!first.getText().equals(second.getText())) { // The result of getText() is never null. return false; } if (first.getContentDescription() == null) { if (second.getContentDescription() != null) { return false; } } else if (!first.getContentDescription().equals(second.getContentDescription())) { return false; } if (first.getBeforeText() == null) { if (second.getBeforeText() != null) { return false; } } else if (!first.getBeforeText().equals(second.getBeforeText())) { return false; } if (first.getParcelableData() != null) { // Parcelable data may not implement equals() correctly. return false; } if (first.getAddedCount() != second.getAddedCount()) { return false; } if (first.isChecked() != second.isChecked()) { return false; } if (first.isEnabled() != second.isEnabled()) { return false; } if (first.getFromIndex() != second.getFromIndex()) { return false; } if (first.isFullScreen() != second.isFullScreen()) { return false; } if (first.getCurrentItemIndex() != second.getCurrentItemIndex()) { return false; } if (first.getItemCount() != second.getItemCount()) { return false; } if (first.isPassword() != second.isPassword()) { return false; } if (first.getRemovedCount() != second.getRemovedCount()) { return false; } if (first.getEventTime() != second.getEventTime()) { return false; } return true; }
Example 3
Source File: VolumeAccessibilityService.java From Noyze with Apache License 2.0 | 4 votes |
@Override public void onAccessibilityEvent(AccessibilityEvent event) { if (null == event) return; // WTF? if (event.isPassword()) return; // Nope, don't do it! LOGV(TAG, "onAccessibilityEvent(" + event.toString() + ')'); // Android SystemUI Package, has become focused. if (SYSTEMUI.equals(event.getPackageName()) || ANDROID.equals(event.getPackageName()) && (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)) { // NOTE: Android 5.0 introduces a Volume Panel that takes focus. In doing so, // it also pretends to be the top activity (but never tells us when it goes away). if (blacklist.contains(mCurrentActivityPackage)) return; if (null != mVolumePanel) { // Make sure we've waited several seconds before hiding. if ((System.currentTimeMillis() - mLastNotificationEventTime) > mVolumePanel.getAutoHideDuration()) { LOGI(TAG, "Hiding panel from package: " + event.getPackageName()); mVolumePanel.hide(); mLastNotificationEventTime = 0; } } } // Get and store information about the last event, current window, etc. switch (event.getEventType()) { // Window state changes, new window, app, dialog, etc. case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: final String mOldActivityPackage = mCurrentActivityPackage; final String mOldActivityClass = mCurrentActivityClass; mCurrentActivityClass = String.valueOf(event.getClassName()); mCurrentActivityPackage = String.valueOf(event.getPackageName()); if (event.getText().size() > 0) { mCurrentActivityName = String.valueOf(event.getText().get(0)); } else { mCurrentActivityName = null; } // Has the top package changed? if (!TextUtils.isEmpty(mCurrentActivityPackage) && !mCurrentActivityPackage.equals(mOldActivityPackage)) { Message.obtain(mHandler, MESSAGE_TOP_PACKAGE, mCurrentActivityPackage).sendToTarget(); } // Has the top activity changed? if (!TextUtils.isEmpty(mCurrentActivityClass) && !mCurrentActivityClass.equals(mOldActivityClass)) { Message.obtain(mHandler, MESSAGE_TOP_ACTIVITY, mCurrentActivityClass).sendToTarget(); } break; } }
Example 4
Source File: VolumeAccessibilityService.java From Noyze with Apache License 2.0 | 4 votes |
@Override public void onAccessibilityEvent(AccessibilityEvent event) { if (null == event) return; // WTF? if (event.isPassword()) return; // Nope, don't do it! LOGV(TAG, "onAccessibilityEvent(" + event.toString() + ')'); // Android SystemUI Package, has become focused. if (SYSTEMUI.equals(event.getPackageName()) || ANDROID.equals(event.getPackageName()) && (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)) { // NOTE: Android 5.0 introduces a Volume Panel that takes focus. In doing so, // it also pretends to be the top activity (but never tells us when it goes away). if (blacklist.contains(mCurrentActivityPackage)) return; if (null != mVolumePanel) { // Make sure we've waited several seconds before hiding. if ((System.currentTimeMillis() - mLastNotificationEventTime) > mVolumePanel.getAutoHideDuration()) { LOGI(TAG, "Hiding panel from package: " + event.getPackageName()); mVolumePanel.hide(); mLastNotificationEventTime = 0; } } } // Get and store information about the last event, current window, etc. switch (event.getEventType()) { // Window state changes, new window, app, dialog, etc. case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED: final String mOldActivityPackage = mCurrentActivityPackage; final String mOldActivityClass = mCurrentActivityClass; mCurrentActivityClass = String.valueOf(event.getClassName()); mCurrentActivityPackage = String.valueOf(event.getPackageName()); if (event.getText().size() > 0) { mCurrentActivityName = String.valueOf(event.getText().get(0)); } else { mCurrentActivityName = null; } // Has the top package changed? if (!TextUtils.isEmpty(mCurrentActivityPackage) && !mCurrentActivityPackage.equals(mOldActivityPackage)) { Message.obtain(mHandler, MESSAGE_TOP_PACKAGE, mCurrentActivityPackage).sendToTarget(); } // Has the top activity changed? if (!TextUtils.isEmpty(mCurrentActivityClass) && !mCurrentActivityClass.equals(mOldActivityClass)) { Message.obtain(mHandler, MESSAGE_TOP_ACTIVITY, mCurrentActivityClass).sendToTarget(); } break; } }