mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 23:25:45 +03:00
check if child is same as parent
This commit is contained in:
parent
64c301caeb
commit
7654bb7088
1 changed files with 13 additions and 3 deletions
|
@ -439,14 +439,23 @@ namespace Bit.Android
|
||||||
|
|
||||||
private NodeList GetWindowNodes(AccessibilityNodeInfo n, AccessibilityEvent e,
|
private NodeList GetWindowNodes(AccessibilityNodeInfo n, AccessibilityEvent e,
|
||||||
Func<AccessibilityNodeInfo, bool> condition, bool disposeIfUnused, NodeList nodes = null,
|
Func<AccessibilityNodeInfo, bool> condition, bool disposeIfUnused, NodeList nodes = null,
|
||||||
int recursiveIterations = 0)
|
int recursionDepth = 0, AccessibilityNodeInfo parentNode = null)
|
||||||
{
|
{
|
||||||
if(nodes == null)
|
if(nodes == null)
|
||||||
{
|
{
|
||||||
nodes = new NodeList();
|
nodes = new NodeList();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(n != null && recursiveIterations < 100)
|
//global::Android.Util.Log.Info("bw_access", "node: " + n.ToString());
|
||||||
|
//global::Android.Util.Log.Info("bw_access", "recursiveIterations = " + recursiveIterations);
|
||||||
|
|
||||||
|
var sameAsParent = n?.GetHashCode() == parentNode?.GetHashCode();
|
||||||
|
if(sameAsParent)
|
||||||
|
{
|
||||||
|
global::Android.Util.Log.Info("bw_access", "child is same as parent!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(n != null && recursionDepth < 50 && !sameAsParent)
|
||||||
{
|
{
|
||||||
var dispose = disposeIfUnused;
|
var dispose = disposeIfUnused;
|
||||||
if(n.WindowId == e.WindowId && !(n.ViewIdResourceName?.StartsWith(SystemUiPackage) ?? false) && condition(n))
|
if(n.WindowId == e.WindowId && !(n.ViewIdResourceName?.StartsWith(SystemUiPackage) ?? false) && condition(n))
|
||||||
|
@ -455,10 +464,11 @@ namespace Bit.Android
|
||||||
nodes.Add(n);
|
nodes.Add(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//global::Android.Util.Log.Info("bw_access", "ChildCount " + n.ChildCount);
|
||||||
for(var i = 0; i < n.ChildCount; i++)
|
for(var i = 0; i < n.ChildCount; i++)
|
||||||
{
|
{
|
||||||
var childNode = n.GetChild(i);
|
var childNode = n.GetChild(i);
|
||||||
GetWindowNodes(childNode, e, condition, true, nodes, recursiveIterations++);
|
GetWindowNodes(childNode, e, condition, true, nodes, recursionDepth++, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(dispose)
|
if(dispose)
|
||||||
|
|
Loading…
Reference in a new issue