File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
java/ql/lib/semmle/code/xml Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -131,6 +131,35 @@ class AndroidActivityXmlElement extends AndroidComponentXmlElement {
131131 AndroidActivityXmlElement ( ) { this .getName ( ) = "activity" }
132132}
133133
134+ /**
135+ * An `<activity-alias>` element in an Android manifest file.
136+ */
137+ class AndroidActivityAliasXmlElement extends AndroidComponentXmlElement {
138+ AndroidActivityAliasXmlElement ( ) { this .getName ( ) = "activity-alias" }
139+
140+ /**
141+ * Get and resolve the name of the target activity from the `android:targetActivity` attribute.
142+ */
143+ string getResolvedTargetActivityName ( ) {
144+ exists ( AndroidXmlAttribute attr |
145+ attr = this .getAnAttribute ( ) and attr .getName ( ) = "targetActivity"
146+ |
147+ result = getResolvedIdentifier ( attr )
148+ )
149+ }
150+
151+ /**
152+ * Gets the `<activity>` element referenced by the `android:targetActivity` attribute.
153+ */
154+ AndroidActivityXmlElement getTarget ( ) {
155+ exists ( AndroidActivityXmlElement activity |
156+ activity .getResolvedComponentName ( ) = this .getResolvedTargetActivityName ( )
157+ |
158+ result = activity
159+ )
160+ }
161+ }
162+
134163/**
135164 * A `<service>` element in an Android manifest file.
136165 */
@@ -235,7 +264,7 @@ class AndroidPathPermissionXmlElement extends XmlElement {
235264class AndroidComponentXmlElement extends XmlElement {
236265 AndroidComponentXmlElement ( ) {
237266 this .getParent ( ) instanceof AndroidApplicationXmlElement and
238- this .getName ( ) .regexpMatch ( "(activity|service|receiver|provider)" )
267+ this .getName ( ) .regexpMatch ( "(activity|activity-alias| service|receiver|provider)" )
239268 }
240269
241270 /**
You can’t perform that action at this time.
0 commit comments