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

Commit 3b728f5f authored by Christopher Tate's avatar Christopher Tate Committed by Android (Google) Code Review
Browse files

Merge "Refactor restore to deal with heterogeneous datasets"

parents a0985d37 51fea57e
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -250,6 +250,14 @@ public class BackupTransport {
     * <p>If this method returns {@code null}, it means that a transport-level error has
     * occurred and the entire restore operation should be abandoned.
     *
     * <p class="note">The OS may call {@link #nextRestorePackage()} multiple times
     * before calling either {@link #getRestoreData(ParcelFileDescriptor) getRestoreData()}
     * or {@link #getNextFullRestoreDataChunk(ParcelFileDescriptor) getNextFullRestoreDataChunk()}.
     * It does this when it has determined that it needs to skip restore of one or more
     * packages.  The transport should not actually transfer any restore data for
     * the given package in response to {@link #nextRestorePackage()}, but rather wait
     * for an explicit request before doing so.
     *
     * @return A RestoreDescription object containing the name of one of the packages
     *   supplied to {@link #startRestore} plus an indicator of the data type of that
     *   restore data; or {@link RestoreDescription#NO_MORE_PACKAGES} to indicate that
+7 −0
Original line number Diff line number Diff line
@@ -50,6 +50,13 @@ public class RestoreDescription implements Parcelable {
    /** This package's restore data is a tarball-type full data stream */
    public static final int TYPE_FULL_STREAM = 2;

    @Override
    public String toString() {
        return "RestoreDescription{" + mPackageName + " : "
                + ((mDataType == TYPE_KEY_VALUE) ? "KEY_VALUE" : "STREAM")
                + '}';
    }

    // ---------------------------------------
    // API

+5 −3
Original line number Diff line number Diff line
@@ -384,7 +384,8 @@ public class LocalTransport extends BackupTransport {

    @Override
    public int startRestore(long token, PackageInfo[] packages) {
        if (DEBUG) Log.v(TAG, "start restore " + token);
        if (DEBUG) Log.v(TAG, "start restore " + token + " : " + packages.length
                + " matching packages");
        mRestorePackages = packages;
        mRestorePackage = -1;
        mRestoreToken = token;
@@ -438,7 +439,8 @@ public class LocalTransport extends BackupTransport {
        if (mRestoreType != RestoreDescription.TYPE_KEY_VALUE) {
            throw new IllegalStateException("getRestoreData(fd) for non-key/value dataset");
        }
        File packageDir = new File(mRestoreSetDir, mRestorePackages[mRestorePackage].packageName);
        File packageDir = new File(mRestoreSetIncrementalDir,
                mRestorePackages[mRestorePackage].packageName);

        // The restore set is the concatenation of the individual record blobs,
        // each of which is a file in the package's directory.  We return the
+2109 −491

File changed.

Preview size limit exceeded, changes collapsed.

+230 −40

File changed.

Preview size limit exceeded, changes collapsed.