File tree Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Expand file tree Collapse file tree 3 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -74,13 +74,17 @@ class AndroidApplicationXmlElement extends XmlElement {
74
74
predicate requiresPermissions ( ) { this .getAnAttribute ( ) .( AndroidPermissionXmlAttribute ) .isFull ( ) }
75
75
76
76
/**
77
- * Holds if this application element has the attribute `android:allowBackup` set to `true`.
77
+ * Holds if this application element enables the `android:allowBackup` attribute.
78
+ *
79
+ * https://developer.android.com/guide/topics/data/autobackup
78
80
*/
79
81
predicate allowsBackup ( ) {
80
- exists ( AndroidXmlAttribute attr |
82
+ // The default value for the attribute `android:allowBackup` is `true`.
83
+ // Therefore we also check if it is not present.
84
+ not exists ( AndroidXmlAttribute attr |
81
85
this .getAnAttribute ( ) = attr and
82
86
attr .getName ( ) = "allowBackup" and
83
- attr .getValue ( ) = "true "
87
+ attr .getValue ( ) = "false "
84
88
)
85
89
}
86
90
}
Original file line number Diff line number Diff line change @@ -17,4 +17,4 @@ from AndroidApplicationXmlElement androidAppElem
17
17
where
18
18
androidAppElem .allowsBackup ( ) and
19
19
androidAppElem .getFile ( ) .( AndroidManifestXmlFile ) .isInBuildDirectory ( )
20
- select androidAppElem . getAttribute ( "allowBackup" ) , "The 'android:allowBackup' attribute is enabled."
20
+ select androidAppElem , "The 'android:allowBackup' attribute is enabled."
Original file line number Diff line number Diff line change
1
+ <manifest ... >
2
+ <!-- BAD: no 'android:allowBackup' set, defaults to 'true' -->
3
+ <application >
4
+ <activity ... >
5
+ </activity >
6
+ </application >
7
+ </manifest >
You can’t perform that action at this time.
0 commit comments