diff options
| author | 2014-06-17 17:12:35 -0700 | |
|---|---|---|
| committer | 2014-06-17 18:02:48 -0700 | |
| commit | d1de2567c6758e81a87c0f5eff9ff53ffebab134 (patch) | |
| tree | 8702c88af3cfaff9909ddeb1e5bce5bcb9be5b3d | |
| parent | 16b414f46f04ba868856f7b8e65b3bdf084218f6 (diff) | |
Introduce <application> attribute android:fullBackupOnly={boolean}
It is quite possible for an application to be happy with having the OS
save full-data archives of its data, but still need to selectively
filter the set of saved files or otherwise participate in full-data
backup and restore. In general we assume that any app which provides
a backup agent implementation will be directly participating via the
incremental key/value backup API; this new attribute allows an app
to tell the OS "perform full-data backup/restore for me even though
I am supplying my own agent implementation to participate."
Change-Id: I810c50d44aa683b1f23604b7d1f3e96a1722103a
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | core/java/android/content/pm/ApplicationInfo.java | 9 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageParser.java | 5 | ||||
| -rw-r--r-- | core/res/res/values/attrs_manifest.xml | 9 | ||||
| -rw-r--r-- | core/res/res/values/public.xml | 1 |
5 files changed, 26 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt index fd546f1cfb63..aef48c1130b9 100644 --- a/api/current.txt +++ b/api/current.txt @@ -580,6 +580,7 @@ package android { field public static final int fromXScale = 16843202; // 0x10101c2 field public static final int fromYDelta = 16843208; // 0x10101c8 field public static final int fromYScale = 16843204; // 0x10101c4 + field public static final int fullBackupOnly = 16843893; // 0x1010475 field public static final int fullBright = 16842954; // 0x10100ca field public static final int fullDark = 16842950; // 0x10100c6 field public static final int functionalTest = 16842787; // 0x1010023 @@ -8125,6 +8126,7 @@ package android.content.pm { field public static final int FLAG_DEBUGGABLE = 2; // 0x2 field public static final int FLAG_EXTERNAL_STORAGE = 262144; // 0x40000 field public static final int FLAG_FACTORY_TEST = 16; // 0x10 + field public static final int FLAG_FULL_BACKUP_ONLY = 67108864; // 0x4000000 field public static final int FLAG_HAS_CODE = 4; // 0x4 field public static final int FLAG_INSTALLED = 8388608; // 0x800000 field public static final int FLAG_IS_DATA_ONLY = 16777216; // 0x1000000 diff --git a/core/java/android/content/pm/ApplicationInfo.java b/core/java/android/content/pm/ApplicationInfo.java index 06f4019df06d..be4e86441755 100644 --- a/core/java/android/content/pm/ApplicationInfo.java +++ b/core/java/android/content/pm/ApplicationInfo.java @@ -325,6 +325,15 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable { public static final int FLAG_IS_GAME = 1<<25; /** + * Value for {@link #flags}: {@code true} if the application asks that only + * full-data streaming backups of its data be performed even though it defines + * a {@link android.app.backup.BackupAgent BackupAgent}, which normally + * indicates that the app will manage its backed-up data via incremental + * key/value updates. + */ + public static final int FLAG_FULL_BACKUP_ONLY = 1<<26; + + /** * Value for {@link #flags}: set to {@code true} if the application * is permitted to hold privileged permissions. * diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java index 91895ff5d68e..b25725ee2d2e 100644 --- a/core/java/android/content/pm/PackageParser.java +++ b/core/java/android/content/pm/PackageParser.java @@ -2088,6 +2088,11 @@ public class PackageParser { false)) { ai.flags |= ApplicationInfo.FLAG_RESTORE_ANY_VERSION; } + if (sa.getBoolean( + com.android.internal.R.styleable.AndroidManifestApplication_fullBackupOnly, + false)) { + ai.flags |= ApplicationInfo.FLAG_FULL_BACKUP_ONLY; + } } } diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml index 814d8fc0c800..48b931123a9a 100644 --- a/core/res/res/values/attrs_manifest.xml +++ b/core/res/res/values/attrs_manifest.xml @@ -814,6 +814,14 @@ via adb. The default value of this attribute is <code>true</code>. --> <attr name="allowBackup" format="boolean" /> + <!-- Indicates that even though the application provides a <code>BackupAgent</code>, + only full-data streaming backup operations are to be performed to save the app's + data. This lets the app rely on full-data backups while still participating in + the backup and restore process via the BackupAgent's full-data backup APIs. + When this attribute is <code>true</code> the app's BackupAgent overrides of + the onBackup() and onRestore() callbacks can be empty stubs. --> + <attr name="fullBackupOnly" format="boolean" /> + <!-- Whether the application in question should be terminated after its settings have been restored during a full-system restore operation. Single-package restore operations will never cause the application to @@ -1044,6 +1052,7 @@ <attr name="testOnly" /> <attr name="backupAgent" /> <attr name="allowBackup" /> + <attr name="fullBackupOnly" /> <attr name="killAfterRestore" /> <attr name="restoreNeedsApplication" /> <attr name="restoreAnyVersion" /> diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 1580d690f630..1bdb3cfc007b 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -2206,6 +2206,7 @@ <public type="attr" name="buttonTintMode" /> <public type="attr" name="thumbTint" /> <public type="attr" name="thumbTintMode" /> + <public type="attr" name="fullBackupOnly" /> <public-padding type="dimen" name="l_resource_pad" end="0x01050010" /> |