Fix recursive filter; don't act twice on focus+click event

This commit is contained in:
Matthew Wong 2015-08-09 22:46:08 -04:00
parent 1ceb41acb6
commit 3523a0497b
2 changed files with 8 additions and 3 deletions

View file

@ -83,8 +83,13 @@ public class AutofillService extends AccessibilityService {
return; return;
} }
// if past this point, a new dialog will be created, so dismiss the existing
if (dialog != null && dialog.isShowing()) { if (dialog != null && dialog.isShowing()) {
// if the view was clicked, the click event follows the focus event
// since the focus event was already handled, ignore click event
if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_CLICKED) {
return;
}
// if past this point, a new dialog will be created, so dismiss the existing
dialog.dismiss(); dialog.dismiss();
} }
@ -145,7 +150,7 @@ public class AutofillService extends AccessibilityService {
PasswordRepository.getPasswords(dir); PasswordRepository.getPasswords(dir);
for (PasswordItem item : passwordItems) { for (PasswordItem item : passwordItems) {
if (item.getType() == PasswordItem.TYPE_CATEGORY) { if (item.getType() == PasswordItem.TYPE_CATEGORY) {
recursiveFilter(filter, item.getFile()); items.addAll(recursiveFilter(filter, item.getFile()));
} }
if (item.toString().toLowerCase().contains(filter.toLowerCase())) { if (item.toString().toLowerCase().contains(filter.toLowerCase())) {
items.add(item); items.add(item);

View file

@ -1,6 +1,6 @@
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android" <accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
android:description="@string/autofill_description" android:description="@string/autofill_description"
android:accessibilityEventTypes="typeViewFocused|typeWindowStateChanged|typeViewClicked" android:accessibilityEventTypes="typeViewFocused|typeViewClicked|typeWindowStateChanged"
android:accessibilityFlags="flagDefault" android:accessibilityFlags="flagDefault"
android:accessibilityFeedbackType="feedbackGeneric" android:accessibilityFeedbackType="feedbackGeneric"
android:notificationTimeout="100" android:notificationTimeout="100"