getRootInActiveWindow throws an exception if it is unable to get root

This commit is contained in:
Mohamed 2017-05-29 11:48:35 +02:00
parent 9b646222ce
commit a45946988e

View file

@ -110,6 +110,7 @@ public class AutofillService extends AccessibilityService {
&& (event.getPackageName().equals("com.android.chrome") && (event.getPackageName().equals("com.android.chrome")
|| event.getPackageName().equals("com.android.browser")))) { || event.getPackageName().equals("com.android.browser")))) {
// there is a chance for getRootInActiveWindow() to return null at any time. save it. // there is a chance for getRootInActiveWindow() to return null at any time. save it.
try {
AccessibilityNodeInfo root = getRootInActiveWindow(); AccessibilityNodeInfo root = getRootInActiveWindow();
webViewTitle = searchWebView(root); webViewTitle = searchWebView(root);
webViewURL = null; webViewURL = null;
@ -132,6 +133,10 @@ public class AutofillService extends AccessibilityService {
} }
} }
} }
} catch (Exception e) {
// sadly we were unable to access the data we wanted
return;
}
} }
// nothing to do if not password field focus, field is keychain app // nothing to do if not password field focus, field is keychain app