Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43fbc5f8 authored by Christopher Tate's avatar Christopher Tate Committed by Chris Tate
Browse files

Add android:backupInForeground

An app can now declare that it really needs to be backed up
whenever possible even if it is currently engaged in foreground-
equivalent work.  Only applies to full-data backup clients: key/value
backups are not intrusive on normal lifecycle so they can already
happen in such circumstances.

Bug 26790411

Change-Id: Ia0ebcc7a53da888ae9ae4d63cd4bcab6e3a2e866
parent 24f62ea6
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -300,6 +300,7 @@ package android {
    field public static final int backgroundTint = 16843883; // 0x101046b
    field public static final int backgroundTintMode = 16843884; // 0x101046c
    field public static final int backupAgent = 16843391; // 0x101027f
    field public static final int backupInForeground = 16844059; // 0x101051b
    field public static final int banner = 16843762; // 0x10103f2
    field public static final int baseline = 16843548; // 0x101031c
    field public static final int baselineAlignBottom = 16843042; // 0x1010122
+1 −0
Original line number Diff line number Diff line
@@ -395,6 +395,7 @@ package android {
    field public static final int backgroundTint = 16843883; // 0x101046b
    field public static final int backgroundTintMode = 16843884; // 0x101046c
    field public static final int backupAgent = 16843391; // 0x101027f
    field public static final int backupInForeground = 16844059; // 0x101051b
    field public static final int banner = 16843762; // 0x10103f2
    field public static final int baseline = 16843548; // 0x101031c
    field public static final int baselineAlignBottom = 16843042; // 0x1010122
+1 −0
Original line number Diff line number Diff line
@@ -300,6 +300,7 @@ package android {
    field public static final int backgroundTint = 16843883; // 0x101046b
    field public static final int backgroundTintMode = 16843884; // 0x101046c
    field public static final int backupAgent = 16843391; // 0x101027f
    field public static final int backupInForeground = 16844059; // 0x101051b
    field public static final int banner = 16843762; // 0x10103f2
    field public static final int baseline = 16843548; // 0x101031c
    field public static final int baselineAlignBottom = 16843042; // 0x1010122
+8 −0
Original line number Diff line number Diff line
@@ -522,6 +522,14 @@ public class ApplicationInfo extends PackageItemInfo implements Parcelable {
     */
    public static final int PRIVATE_FLAG_RESIZEABLE_ACTIVITIES = 1 << 11;

    /**
     * Value for {@link #privateFlags}: {@code true} means the OS should go ahead and
     * run full-data backup operations for the app even when it is in a
     * foreground-equivalent run state.  Defaults to {@code false} if unspecified.
     * @hide
     */
    public static final int PRIVATE_FLAG_BACKUP_IN_FOREGROUND = 1 << 12;

    /**
     * Private/hidden flags. See {@code PRIVATE_FLAG_...} constants.
     * {@hide}
+8 −2
Original line number Diff line number Diff line
@@ -2669,8 +2669,9 @@ public class PackageParser {
        if (allowBackup) {
            ai.flags |= ApplicationInfo.FLAG_ALLOW_BACKUP;

            // backupAgent, killAfterRestore, fullBackupContent and restoreAnyVersion are only
            // relevant if backup is possible for the given application.
            // backupAgent, killAfterRestore, fullBackupContent, backupInForeground,
            // and restoreAnyVersion are only relevant if backup is possible for the
            // given application.
            String backupAgent = sa.getNonConfigurationString(
                    com.android.internal.R.styleable.AndroidManifestApplication_backupAgent,
                    Configuration.NATIVE_CONFIG_VERSION);
@@ -2696,6 +2697,11 @@ public class PackageParser {
                        false)) {
                    ai.flags |= ApplicationInfo.FLAG_FULL_BACKUP_ONLY;
                }
                if (sa.getBoolean(
                        com.android.internal.R.styleable.AndroidManifestApplication_backupInForeground,
                        false)) {
                    ai.privateFlags |= ApplicationInfo.PRIVATE_FLAG_BACKUP_IN_FOREGROUND;
                }
            }

            TypedValue v = sa.peekValue(
Loading