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

Commit bf1a4a81 authored by Christopher Tate's avatar Christopher Tate Committed by Christopher Tate
Browse files

Start using cancelFullBackup() when appropriate

The API was in place but the framework wasn't yet calling it.

Bug 16524520

Change-Id: Ie368758c830a7d0ad11e7dd3142a0ed896069944
parent 7f708ecc
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -589,6 +589,11 @@ public class BackupTransport {
            return BackupTransport.this.sendBackupData(numBytes);
        }

        @Override
        public void cancelFullBackup() throws RemoteException {
            BackupTransport.this.cancelFullBackup();
        }

        @Override
        public int getNextFullRestoreDataChunk(ParcelFileDescriptor socket) {
            return BackupTransport.this.getNextFullRestoreDataChunk(socket);
+1 −0
Original line number Diff line number Diff line
@@ -239,6 +239,7 @@ interface IBackupTransport {
    long requestFullBackupTime();
    int performFullBackup(in PackageInfo targetPackage, in ParcelFileDescriptor socket);
    int sendBackupData(int numBytes);
    void cancelFullBackup();

    // full restore stuff

+14 −17
Original line number Diff line number Diff line
@@ -3745,29 +3745,26 @@ public class BackupManagerService extends IBackupManager.Stub {
                            }
                        } while (nRead > 0 && result == BackupTransport.TRANSPORT_OK);

                        int finishResult;

                        // If we've lost our running criteria, tell the transport to cancel
                        // and roll back this (partial) backup payload; otherwise tell it
                        // that we've reached the clean finish state.
                        if (!mKeepRunning.get()) {
                            result = BackupTransport.TRANSPORT_ERROR;
                            // TODO: tell the transport to abort the backup
                            Slog.w(TAG, "TODO: tell transport to halt & roll back");
                        }

                        // In all cases we need to give the transport its finish callback
                        finishResult = transport.finishBackup();

                        if (MORE_DEBUG) {
                            Slog.i(TAG, "Done trying to send backup data: result="
                                    + result + " finishResult=" + finishResult);
                        }

                            transport.cancelFullBackup();
                        } else {
                            // If we were otherwise in a good state, now interpret the final
                        // result based on what finishBackup() returned.  If we're in a
                            // result based on what finishBackup() returns.  If we're in a
                            // failure case already, preserve that result and ignore whatever
                        // finishBackup() reported.
                            // finishBackup() reports.
                            final int finishResult = transport.finishBackup();
                            if (result == BackupTransport.TRANSPORT_OK) {
                                result = finishResult;
                            }
                        }

                        if (MORE_DEBUG) {
                            Slog.i(TAG, "Done trying to send backup data: result=" + result);
                        }

                        if (result != BackupTransport.TRANSPORT_OK) {
                            Slog.e(TAG, "Error " + result