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

Commit a235f7e4 authored by Sergey Poromov's avatar Sergey Poromov
Browse files

Don't call BackupTransport#checkFullBackupSize when preflight timeouted.

mResult in SinglePackageBackupPreflight could be set
to a negative value if preflight timeouted.
Together with ag/863259 this change will better handle this case.

Bug: 26818914
Change-Id: I171bf95f146552b3b50f044964c2b041f6303d90
parent b6522408
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -3494,7 +3494,7 @@ public class BackupManagerService {
         */
         */
        int preflightFullBackup(PackageInfo pkg, IBackupAgent agent);
        int preflightFullBackup(PackageInfo pkg, IBackupAgent agent);


        long expectedSize();
        long getExpectedSizeOrErrorCode();
    };
    };


    class FullBackupEngine {
    class FullBackupEngine {
@@ -4555,6 +4555,10 @@ public class BackupManagerService {
                    // now wait to get our result back
                    // now wait to get our result back
                    mLatch.await();
                    mLatch.await();
                    int totalSize = mResult.get();
                    int totalSize = mResult.get();
                    // If preflight timeouted, mResult will contain error code.
                    if (totalSize < 0) {
                        return totalSize;
                    }
                    if (MORE_DEBUG) {
                    if (MORE_DEBUG) {
                        Slog.v(TAG, "Got preflight response; size=" + totalSize);
                        Slog.v(TAG, "Got preflight response; size=" + totalSize);
                    }
                    }
@@ -4600,7 +4604,7 @@ public class BackupManagerService {
            }
            }


            @Override
            @Override
            public long expectedSize() {
            public long getExpectedSizeOrErrorCode() {
                try {
                try {
                    mLatch.await();
                    mLatch.await();
                    return mResult.get();
                    return mResult.get();
@@ -4649,7 +4653,7 @@ public class BackupManagerService {
            }
            }


            long expectedSize() {
            long expectedSize() {
                return mPreflight.expectedSize();
                return mPreflight.getExpectedSizeOrErrorCode();
            }
            }
        }
        }
    }
    }