11< meta charset ="utf-8 ">
2- (#) AllowBackup/FullBackupContent Problems
2+ (#) AllowBackup
33
4- !!! WARNING: AllowBackup/FullBackupContent Problems
5- This is a warning .
4+ The issue for this id has been deleted or marked obsolete and can now be
5+ ignored .
66
7- Id
8- : `AllowBackup`
9- Summary
10- : AllowBackup/FullBackupContent Problems
11- Severity
12- : Warning
13- Category
14- : Security
15- Platform
16- : Android
17- Vendor
18- : Android Open Source Project
19- Feedback
20- : https://issuetracker.google.com/issues/new?component=192708
21- Affects
22- : Manifest files
23- Editing
24- : This check runs on the fly in the IDE editor
25- See
26- : https://developer.android.com/guide/topics/data/autobackup
27- See
28- : https://developer.android.com/reference/android/R.attr.html#allowBackup
29- Implementation
30- : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-master-dev:lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/ManifestDetector.kt)
31- Tests
32- : [Source Code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-master-dev:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/ManifestDetectorTest.kt)
33-
34- The `allowBackup` attribute determines if an application's data can be
35- backed up and restored. It is documented at
36- https://developer.android.com/reference/android/R.attr.html#allowBackup
37-
38- By default, this flag is set to `true` which means application data can
39- be backed up and restored by the OS. Setting `allowBackup="false"` opts
40- the application out of being backed up and so users can't restore data
41- related to it when they go through the device setup wizard.
42-
43- Allowing backups may have security consequences for an application.
44- Currently `adb backup` allows users who have enabled USB debugging to
45- copy application data off of the device. Once backed up, all application
46- data can be read by the user. `adb restore` allows creation of
47- application data from a source specified by the user. Following a
48- restore, applications should not assume that the data, file permissions,
49- and directory permissions were created by the application itself.
50-
51- To fix this warning, decide whether your application should support
52- backup, and explicitly set `android:allowBackup=(true|false)"`.
53-
54- If not set to false, and if targeting API 23 or later, lint will also
55- warn that you should set `android:fullBackupContent` or
56- `android:fullBackupOnly` to configure auto backup.
57-
58- !!! Tip
59- This lint check has an associated quickfix available in the IDE.
60-
61- (##) Example
62-
63- Here is an example of lint warnings produced by this check:
64- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~text
65- AndroidManifest.xml:8:Warning: Should explicitly set android:allowBackup
66- to true or false (it's true by default, and that can have some security
67- implications for the application's data) [AllowBackup]
68-
69- <application
70- -----------
71-
72-
73- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
74-
75- Here is the source file referenced above:
76-
77- `AndroidManifest.xml`:
78- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~xml linenumbers
79- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
80- package="test.bytecode"
81- android:versionCode="1"
82- android:versionName="1.0" >
83-
84- <uses-sdk android:minSdkVersion="14" />
85-
86- <application
87- android:icon="@drawable/ic_launcher"
88- android:label="@string/app_name" >
89- </application>
90-
91- </manifest>
92- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
93-
94- You can also visit the
95- [source code](https://cs.android.com/android-studio/platform/tools/base/+/mirror-goog-studio-master-dev:lint/libs/lint-tests/src/test/java/com/android/tools/lint/checks/ManifestDetectorTest.kt)
96- for the unit tests for this check to see additional scenarios.
97-
98- The above example was automatically extracted from the first unit test
99- found for this lint check, `ManifestDetector.testAllowBackup`.
100- To report a problem with this extracted sample, visit
101- https://issuetracker.google.com/issues/new?component=192708.
102-
103- (##) Suppressing
104-
105- You can suppress false positives using one of the following mechanisms:
106-
107- * Adding the suppression attribute `tools:ignore="AllowBackup"` on the
108- problematic XML element (or one of its enclosing elements). You may
109- also need to add the following namespace declaration on the root
110- element in the XML file if it's not already there:
111- `xmlns:tools="http://schemas.android.com/tools"`.
112-
113- ```xml
114- <?xml version="1.0" encoding="UTF-8"?>
115- <manifest xmlns:tools="http://schemas.android.com/tools">
116- ...
117- <application tools:ignore="AllowBackup" .../>
118- ...
119- </manifest>
120- ```
121-
122- * Using a special `lint.xml` file in the source tree which turns off
123- the check in that folder and any sub folder. A simple file might look
124- like this:
125- ```xml
126- <?xml version="1.0" encoding="UTF-8"?>
127- <lint>
128- <issue id="AllowBackup" severity="ignore" />
129- </lint>
130- ```
131- Instead of `ignore` you can also change the severity here, for
132- example from `error` to `warning`. You can find additional
133- documentation on how to filter issues by path, regular expression and
134- so on
135- [here](https://googlesamples.github.io/android-custom-lint-rules/usage/lintxml.md.html).
136-
137- * In Gradle projects, using the DSL syntax to configure lint. For
138- example, you can use something like
139- ```gradle
140- lintOptions {
141- disable 'AllowBackup'
142- }
143- ```
144- In Android projects this should be nested inside an `android { }`
145- block.
146-
147- * For manual invocations of `lint`, using the `--ignore` flag:
148- ```
149- $ lint --ignore AllowBackup ...`
150- ```
151-
152- * Last, but not least, using baselines, as discussed
153- [here](https://googlesamples.github.io/android-custom-lint-rules/usage/baselines.md.html).
154-
155- <!-- Markdeep: --> < style class ="fallback "> body {visibility : hidden;white-space : pre;font-family : monospace}</ style > < script src ="markdeep.min.js " charset ="utf-8 "> </ script > < script src ="https://morgan3d.github.io/markdeep/latest/markdeep.min.js " charset ="utf-8 "> </ script > < script > window . alreadyProcessedMarkdeep || ( document . body . style . visibility = "visible" ) </ script >
7+ (Additional metadata not available.)<!-- Markdeep: --> < style class ="fallback "> body {visibility : hidden;white-space : pre;font-family : monospace}</ style > < script src ="markdeep.min.js " charset ="utf-8 "> </ script > < script src ="https://morgan3d.github.io/markdeep/latest/markdeep.min.js " charset ="utf-8 "> </ script > < script > window . alreadyProcessedMarkdeep || ( document . body . style . visibility = "visible" ) </ script >
0 commit comments