added predicates in the AndroidManifest library and adjusted tests

This commit is contained in:
Jami Cogswell
2022-08-03 08:58:16 -04:00
parent 229324fde0
commit 6e10fcf519
8 changed files with 94 additions and 13 deletions

View File

@@ -18,6 +18,16 @@ class AndroidManifestXmlFile extends XMLFile {
* Gets the top-level `<manifest>` element in this Android manifest file.
*/
AndroidManifestXmlElement getManifestElement() { result = this.getAChild() }
/**
* Holds if this Android manifest file is located in a build directory.
*/
predicate isInBuildDirectory() {
exists(AndroidManifestXmlFile file |
file = this.getFile() and
file.getRelativePath().matches("%build%")
)
}
}
/**
@@ -51,6 +61,23 @@ class AndroidApplicationXmlElement extends XMLElement {
* Gets a component child element of this `<application>` element.
*/
AndroidComponentXmlElement getAComponentElement() { result = this.getAChild() }
/**
* Holds if this application element has the attribute `android:debuggable` set to `true`.
*/
predicate isDebuggable() {
exists(AndroidXmlAttribute attr |
this.getAnAttribute() = attr and
attr.getName() = "debuggable" and
attr.getValue() = "true"
)
}
/**
* Overrides the getFile() predicate of the XMLElement class to get the
* AndroidManifest.xml file itself.
*/
override AndroidManifestXmlFile getFile() { result = super.getFile() }
}
/**