Retrieve application id and domain

This commit is contained in:
J-Jamet
2020-04-06 11:41:16 +02:00
parent cac1d576c8
commit 3b3583a416

View File

@@ -42,12 +42,9 @@ internal class StructureParser(private val structure: AssistStructure) {
usernameCandidate = null
mainLoop@ for (i in 0 until structure.windowNodeCount) {
val windowNode = structure.getWindowNodeAt(i)
/*
title.add(windowNode.title)
windowNode.rootViewNode.webDomain?.let {
webDomain.add(it)
}
*/
applicationId = windowNode.title.toString().split("/")[0]
Log.d(TAG, "Autofill applicationId: $applicationId")
if (parseViewNode(windowNode.rootViewNode))
break@mainLoop
}
@@ -65,6 +62,12 @@ internal class StructureParser(private val structure: AssistStructure) {
}
private fun parseViewNode(node: AssistStructure.ViewNode): Boolean {
// Get the domain of a web app
node.webDomain?.let {
result?.domain = it
Log.d(TAG, "Autofill domain: $it")
}
// Only parse visible nodes
if (node.visibility == View.VISIBLE) {
if (node.autofillId != null
@@ -192,6 +195,13 @@ internal class StructureParser(private val structure: AssistStructure) {
@RequiresApi(api = Build.VERSION_CODES.O)
internal class Result {
var applicationId: String? = null
var domain: String? = null
set(value) {
if (field == null)
field = value
}
var usernameId: AutofillId? = null
set(value) {
if (field == null)