File tree Expand file tree Collapse file tree 1 file changed +20
-9
lines changed
java/ql/lib/semmle/code/xml Expand file tree Collapse file tree 1 file changed +20
-9
lines changed Original file line number Diff line number Diff line change @@ -261,19 +261,30 @@ class AndroidComponentXmlElement extends XmlElement {
261
261
)
262
262
}
263
263
264
+ /**
265
+ * Gets the value of an identifier attribute, and tries to resolve it into a fully qualified identifier.
266
+ */
267
+ string getResolvedIdentifier ( AndroidIdentifierXmlAttribute identifier ) {
268
+ exists ( string name | name = identifier .getValue ( ) |
269
+ if name .matches ( ".%" )
270
+ then
271
+ result =
272
+ this .getParent ( )
273
+ .( XmlElement )
274
+ .getParent ( )
275
+ .( AndroidManifestXmlElement )
276
+ .getPackageAttributeValue ( ) + name
277
+ else result = name
278
+ )
279
+ }
280
+
264
281
/**
265
282
* Gets the resolved value of the `android:name` attribute of this component element.
266
283
*/
267
284
string getResolvedComponentName ( ) {
268
- if this .getComponentName ( ) .matches ( ".%" )
269
- then
270
- result =
271
- this .getParent ( )
272
- .( XmlElement )
273
- .getParent ( )
274
- .( AndroidManifestXmlElement )
275
- .getPackageAttributeValue ( ) + this .getComponentName ( )
276
- else result = this .getComponentName ( )
285
+ exists ( AndroidXmlAttribute attr | attr = this .getAnAttribute ( ) and attr .getName ( ) = "name" |
286
+ result = getResolvedIdentifier ( attr )
287
+ )
277
288
}
278
289
279
290
/**
You can’t perform that action at this time.
0 commit comments