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

Commit 4bc966c0 authored by Al Sutton's avatar Al Sutton
Browse files

Add "No New Data" flag for Key/Value Backups

Currently we have no method of telling transports that we have
attempted to make a Key/Value backup, but there was no data to
back up. This means that for apps with K/V backups their last
backup timestamp becomes older and older causing confusion for
users about whether the app data hasn't changed or whether the
app is failing to back up.

By introducing this flag we create a signal for the framework
to tell transports that, if there was any changed data, the
data would have been backed up, but the apps has not indicated
any changes have been made. This allows us to provide a UX
based on last non-erroring attempt rather than last data
change.

Bug: 147481066
Test: No code introduced in the CL.
Change-Id: Id832c7173da6341c6dc7b77fb72c289f2e1da624
parent 5c3c185a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1035,6 +1035,7 @@ package android.app.backup {
    field public static final int AGENT_ERROR = -1003; // 0xfffffc15
    field public static final int AGENT_UNKNOWN = -1004; // 0xfffffc14
    field public static final String EXTRA_TRANSPORT_REGISTRATION = "android.app.backup.extra.TRANSPORT_REGISTRATION";
    field public static final int FLAG_DATA_NOT_CHANGED = 8; // 0x8
    field public static final int FLAG_INCREMENTAL = 2; // 0x2
    field public static final int FLAG_NON_INCREMENTAL = 4; // 0x4
    field public static final int FLAG_USER_INITIATED = 1; // 0x1
+11 −1
Original line number Diff line number Diff line
@@ -84,6 +84,15 @@ public class BackupTransport {
     */
    public static final int FLAG_NON_INCREMENTAL = 1 << 2;

    /**
     * For key value backup, indicates that the backup contains no new data since the last backup
     * attempt completed without any errors. The transport should use this to record that
     * a successful backup attempt has been completed but no backup data has been changed.
     *
     * @see #performBackup(PackageInfo, ParcelFileDescriptor, int)
     */
    public static final int FLAG_DATA_NOT_CHANGED = 1 << 3;

    /**
     * Used as a boolean extra in the binding intent of transports. We pass {@code true} to
     * notify transports that the current connection is used for registering the transport.
@@ -302,7 +311,8 @@ public class BackupTransport {
     *   BackupService.doBackup() method.  This may be a pipe rather than a file on
     *   persistent media, so it may not be seekable.
     * @param flags a combination of {@link BackupTransport#FLAG_USER_INITIATED}, {@link
     *   BackupTransport#FLAG_NON_INCREMENTAL}, {@link BackupTransport#FLAG_INCREMENTAL}, or 0.
     *   BackupTransport#FLAG_NON_INCREMENTAL}, {@link BackupTransport#FLAG_INCREMENTAL},
     *   {@link BackupTransport#FLAG_DATA_NOT_CHANGED},or 0.
     * @return one of {@link BackupTransport#TRANSPORT_OK} (OK so far),
     *  {@link BackupTransport#TRANSPORT_PACKAGE_REJECTED} (to suppress backup of this
     *  specific package, but allow others to proceed),