fix stackoverflow case by limiting the depth of search to 10

This commit is contained in:
Mohamed 2017-06-19 13:04:16 +02:00
parent 72e441aafe
commit 2a3b82eb8a

View File

@ -221,8 +221,11 @@ public class AutofillService extends AccessibilityService {
} }
showDialog(packageName, appName, isWeb); showDialog(packageName, appName, isWeb);
} }
private String searchWebView(AccessibilityNodeInfo source) { private String searchWebView(AccessibilityNodeInfo source) {
return searchWebView(source, 10);
}
private String searchWebView(AccessibilityNodeInfo source, int depth) {
if (source == null) { if (source == null) {
return null; return null;
} }
@ -237,8 +240,9 @@ public class AutofillService extends AccessibilityService {
} }
return ""; return "";
} }
if (searchWebView(u) != null) { String webView = searchWebView(u, depth - 1);
return searchWebView(u); if (webView != null) {
return webView;
} }
u.recycle(); u.recycle();
} }