in facebook-core/src/main/java/com/facebook/appevents/aam/MetadataMatcher.kt [35:69]
fun getCurrentViewIndicators(view: View): List<String> {
val indicators: MutableList<String> = mutableListOf()
// Hint
indicators.add(ViewHierarchy.getHintOfView(view))
// tag
val tag = view.tag
if (tag != null) {
indicators.add(tag.toString())
}
// description
val description = view.contentDescription
if (description != null) {
indicators.add(description.toString())
}
// resource id name
try {
if (view.id != -1) {
// resource name format: {package_name}:id/{id_name}
val resourceName = view.resources.getResourceName(view.id)
val splitted = resourceName.split("/".toRegex()).toTypedArray()
if (splitted.size == 2) {
indicators.add(splitted[1])
}
}
} catch (_e: Resources.NotFoundException) {
/*no op*/
}
val validIndicators: MutableList<String> = mutableListOf()
for (indicator in indicators) {
if (indicator.isNotEmpty() && indicator.length <= MAX_INDICATOR_LENGTH) {
validIndicators.add(indicator.toLowerCase())
}
}
return validIndicators
}