Introduce 'dataExtractionRules' manifest attribute
Introduce the attribute apps targeting Android S+ can use to point to an XML file that contains rules for copying app data during backup and transfer operations. If this attribute is specified, the config pointed to by the existing 'fullBackupContent' will be ignored. Bug: 174216309 Test: m -j Change-Id: I6ad57a24b40cf5b80b312c719747e8ba89aa0a93
This commit is contained in:
@@ -507,6 +507,7 @@ package android {
|
||||
field public static final int dashGap = 16843175; // 0x10101a7
|
||||
field public static final int dashWidth = 16843174; // 0x10101a6
|
||||
field public static final int data = 16842798; // 0x101002e
|
||||
field public static final int dataExtractionRules = 16844350; // 0x101063e
|
||||
field public static final int datePickerDialogTheme = 16843948; // 0x10104ac
|
||||
field public static final int datePickerMode = 16843955; // 0x10104b3
|
||||
field public static final int datePickerStyle = 16843612; // 0x101035c
|
||||
|
||||
@@ -135,6 +135,18 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
|
||||
public int fullBackupContent = 0;
|
||||
|
||||
/**
|
||||
* Applications can set this attribute to an xml resource within their app where they specified
|
||||
* the rules determining which files and directories can be copied from the device as part of
|
||||
* backup or transfer operations.
|
||||
*<p>
|
||||
* Set from the {@link android.R.styleable#AndroidManifestApplication_dataExtractionRules}
|
||||
* attribute in the manifest.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int dataExtractionRulesRes = 0;
|
||||
|
||||
/**
|
||||
* <code>true</code> if the package is capable of presenting a unified interface representing
|
||||
* multiple profiles.
|
||||
@@ -1520,6 +1532,9 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
pw.println(prefix + "fullBackupContent="
|
||||
+ (fullBackupContent < 0 ? "false" : "true"));
|
||||
}
|
||||
if (dataExtractionRulesRes != 0) {
|
||||
pw.println(prefix + "dataExtractionRules=@xml/" + dataExtractionRulesRes);
|
||||
}
|
||||
pw.println(prefix + "crossProfile=" + (crossProfile ? "true" : "false"));
|
||||
if (networkSecurityConfigRes != 0) {
|
||||
pw.println(prefix + "networkSecurityConfigRes=0x"
|
||||
@@ -1749,6 +1764,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
uiOptions = orig.uiOptions;
|
||||
backupAgentName = orig.backupAgentName;
|
||||
fullBackupContent = orig.fullBackupContent;
|
||||
dataExtractionRulesRes = orig.dataExtractionRulesRes;
|
||||
crossProfile = orig.crossProfile;
|
||||
networkSecurityConfigRes = orig.networkSecurityConfigRes;
|
||||
category = orig.category;
|
||||
@@ -1836,6 +1852,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
dest.writeInt(descriptionRes);
|
||||
dest.writeInt(uiOptions);
|
||||
dest.writeInt(fullBackupContent);
|
||||
dest.writeInt(dataExtractionRulesRes);
|
||||
dest.writeBoolean(crossProfile);
|
||||
dest.writeInt(networkSecurityConfigRes);
|
||||
dest.writeInt(category);
|
||||
@@ -1920,6 +1937,7 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
|
||||
descriptionRes = source.readInt();
|
||||
uiOptions = source.readInt();
|
||||
fullBackupContent = source.readInt();
|
||||
dataExtractionRulesRes = source.readInt();
|
||||
crossProfile = source.readBoolean();
|
||||
networkSecurityConfigRes = source.readInt();
|
||||
category = source.readInt();
|
||||
|
||||
@@ -260,6 +260,8 @@ public interface ParsingPackage extends ParsingPackageRead {
|
||||
|
||||
ParsingPackage setFullBackupContent(int fullBackupContent);
|
||||
|
||||
ParsingPackage setDataExtractionRules(int dataExtractionRules);
|
||||
|
||||
ParsingPackage setHasDomainUrls(boolean hasDomainUrls);
|
||||
|
||||
ParsingPackage setIconRes(int iconRes);
|
||||
|
||||
@@ -334,6 +334,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
private int descriptionRes;
|
||||
|
||||
private int fullBackupContent;
|
||||
private int dataExtractionRules;
|
||||
private int iconRes;
|
||||
private int installLocation = ParsingPackageUtils.PARSE_DEFAULT_INSTALL_LOCATION;
|
||||
private int labelRes;
|
||||
@@ -1015,6 +1016,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
appInfo.enabled = getBoolean(Booleans.ENABLED);
|
||||
// appInfo.enabledSetting
|
||||
appInfo.fullBackupContent = fullBackupContent;
|
||||
appInfo.dataExtractionRulesRes = dataExtractionRules;
|
||||
// TODO(b/135203078): See ParsingPackageImpl#getHiddenApiEnforcementPolicy
|
||||
// appInfo.mHiddenApiPolicy
|
||||
// appInfo.hiddenUntilInstalled
|
||||
@@ -1163,6 +1165,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
dest.writeInt(this.compatibleWidthLimitDp);
|
||||
dest.writeInt(this.descriptionRes);
|
||||
dest.writeInt(this.fullBackupContent);
|
||||
dest.writeInt(this.dataExtractionRules);
|
||||
dest.writeInt(this.iconRes);
|
||||
dest.writeInt(this.installLocation);
|
||||
dest.writeInt(this.labelRes);
|
||||
@@ -1284,6 +1287,7 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
this.compatibleWidthLimitDp = in.readInt();
|
||||
this.descriptionRes = in.readInt();
|
||||
this.fullBackupContent = in.readInt();
|
||||
this.dataExtractionRules = in.readInt();
|
||||
this.iconRes = in.readInt();
|
||||
this.installLocation = in.readInt();
|
||||
this.labelRes = in.readInt();
|
||||
@@ -1807,6 +1811,11 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return fullBackupContent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDataExtractionRules() {
|
||||
return dataExtractionRules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconRes() {
|
||||
return iconRes;
|
||||
@@ -2263,6 +2272,12 @@ public class ParsingPackageImpl implements ParsingPackage, Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setDataExtractionRules(int value) {
|
||||
dataExtractionRules = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ParsingPackageImpl setIconRes(int value) {
|
||||
iconRes = value;
|
||||
|
||||
@@ -587,6 +587,11 @@ public interface ParsingPackageRead extends Parcelable {
|
||||
*/
|
||||
int getFullBackupContent();
|
||||
|
||||
/**
|
||||
* @see R.styleable#AndroidManifestApplication_dataExtractionRules
|
||||
*/
|
||||
int getDataExtractionRules();
|
||||
|
||||
/** @see ApplicationInfo#PRIVATE_FLAG_HAS_DOMAIN_URLS */
|
||||
boolean isHasDomainUrls();
|
||||
|
||||
|
||||
@@ -2168,6 +2168,8 @@ public class ParsingPackageUtils {
|
||||
.setNetworkSecurityConfigRes(resId(R.styleable.AndroidManifestApplication_networkSecurityConfig, sa))
|
||||
.setRoundIconRes(resId(R.styleable.AndroidManifestApplication_roundIcon, sa))
|
||||
.setTheme(resId(R.styleable.AndroidManifestApplication_theme, sa))
|
||||
.setDataExtractionRules(
|
||||
resId(R.styleable.AndroidManifestApplication_dataExtractionRules, sa))
|
||||
// Strings
|
||||
.setClassLoaderName(string(R.styleable.AndroidManifestApplication_classLoader, sa))
|
||||
.setRequiredAccountType(string(R.styleable.AndroidManifestApplication_requiredAccountType, sa))
|
||||
|
||||
@@ -1893,6 +1893,11 @@
|
||||
<!-- User data will remain unchanged during rollback. -->
|
||||
<enum name="retain" value="2" />
|
||||
</attr>
|
||||
|
||||
<!-- Applications can set this attribute to an xml resource within their app where they
|
||||
specified the rules determining which files and directories can be copied from the device
|
||||
as part of backup or transfer operations. -->
|
||||
<attr name="dataExtractionRules" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<!-- An attribution is a logical part of an app and is identified by a tag.
|
||||
|
||||
@@ -3084,6 +3084,7 @@
|
||||
<public name="hand_minuteTintMode"/>
|
||||
<public name="hand_secondTint"/>
|
||||
<public name="hand_secondTintMode"/>
|
||||
<public name="dataExtractionRules"/>
|
||||
</public-group>
|
||||
|
||||
<public-group type="drawable" first-id="0x010800b5">
|
||||
|
||||
Reference in New Issue
Block a user