Merge branch 'develop' into feature/Autofill_Save

This commit is contained in:
J-Jamet
2020-10-05 19:31:11 +02:00
2 changed files with 12 additions and 6 deletions

View File

@@ -49,8 +49,7 @@ class KeeAutofillService : AutofillService() {
override fun onFillRequest(request: FillRequest,
cancellationSignal: CancellationSignal,
callback: FillCallback) {
val fillContexts = request.fillContexts
val latestStructure = fillContexts[fillContexts.size - 1].structure
val latestStructure = request.fillContexts.last().structure
cancellationSignal.setOnCancelListener { Log.w(TAG, "Cancel autofill.") }

View File

@@ -77,7 +77,9 @@ internal class StructureParser(private val structure: AssistStructure,
Log.d(TAG, "Autofill domain: $webDomain")
}
}
val domainNotEmpty = result?.domain?.isNotEmpty() == true
var returnValue = false
// Only parse visible nodes
if (node.visibility == View.VISIBLE) {
if (node.autofillId != null
@@ -86,19 +88,24 @@ internal class StructureParser(private val structure: AssistStructure,
val hints = node.autofillHints
if (hints != null && hints.isNotEmpty()) {
if (parseNodeByAutofillHint(node))
return true
returnValue = true
} else if (parseNodeByHtmlAttributes(node))
return true
returnValue = true
else if (parseNodeByAndroidInput(node))
return true
returnValue = true
}
// Optimized return but only if domain not empty
if (domainNotEmpty && returnValue)
return true
// Recursive method to process each node
for (i in 0 until node.childCount) {
if (parseViewNode(node.getChildAt(i)))
returnValue = true
if (domainNotEmpty && returnValue)
return true
}
}
return false
return returnValue
}
private fun parseNodeByAutofillHint(node: AssistStructure.ViewNode): Boolean {