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
This commit is contained in:
Christopher Tate
2014-06-17 17:12:35 -07:00
parent 16b414f46f
commit d1de2567c6
5 changed files with 26 additions and 0 deletions

View File

@@ -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

View File

@@ -324,6 +324,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.

View File

@@ -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;
}
}
}

View File

@@ -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" />

View File

@@ -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" />