@@ -79,10 +79,20 @@ class AndroidApplicationXmlElement extends XmlElement {
7979 * https://developer.android.com/guide/topics/data/autobackup
8080 */
8181 predicate allowsBackup ( ) {
82- not exists ( AndroidXmlAttribute attr |
83- this .getAnAttribute ( ) = attr and
84- attr .getName ( ) = "allowBackup" and
85- attr .getValue ( ) = "false"
82+ not this .getFile ( ) .( AndroidManifestXmlFile ) .isInBuildDirectory ( ) and
83+ (
84+ // explicitly sets android:allowBackup="true"
85+ this .allowsBackupExplicitly ( )
86+ or
87+ // Manifest providing the main intent for an application, and does not explicitly
88+ // disallow the allowBackup attribute
89+ this .providesMainIntent ( ) and
90+ // Check that android:allowBackup="false" is not present
91+ not exists ( AndroidXmlAttribute attr |
92+ this .getAnAttribute ( ) = attr and
93+ attr .getName ( ) = "allowBackup" and
94+ attr .getValue ( ) = "false"
95+ )
8696 )
8797 }
8898
@@ -91,7 +101,7 @@ class AndroidApplicationXmlElement extends XmlElement {
91101 *
92102 * https://developer.android.com/guide/topics/data/autobackup
93103 */
94- predicate allowsBackupExplicitly ( ) {
104+ private predicate allowsBackupExplicitly ( ) {
95105 exists ( AndroidXmlAttribute attr |
96106 this .getAnAttribute ( ) = attr and
97107 attr .getName ( ) = "allowBackup" and
@@ -103,7 +113,7 @@ class AndroidApplicationXmlElement extends XmlElement {
103113 * Holds if the application element contains a child element which provides the
104114 * `android.intent.action.MAIN` intent.
105115 */
106- predicate providesMainIntent ( ) {
116+ private predicate providesMainIntent ( ) {
107117 exists ( AndroidActivityXmlElement activity |
108118 activity = this .getAChild ( ) and
109119 exists ( AndroidIntentFilterXmlElement intentFilter |
0 commit comments