@@ -3745,28 +3745,25 @@ public void run() {
37453745 }
37463746 } while (nRead > 0 && result == BackupTransport .TRANSPORT_OK );
37473747
3748- int finishResult ;
3749-
3748+ // If we've lost our running criteria, tell the transport to cancel
3749+ // and roll back this (partial) backup payload; otherwise tell it
3750+ // that we've reached the clean finish state.
37503751 if (!mKeepRunning .get ()) {
37513752 result = BackupTransport .TRANSPORT_ERROR ;
3752- // TODO: tell the transport to abort the backup
3753- Slog .w (TAG , "TODO: tell transport to halt & roll back" );
3753+ transport .cancelFullBackup ();
3754+ } else {
3755+ // If we were otherwise in a good state, now interpret the final
3756+ // result based on what finishBackup() returns. If we're in a
3757+ // failure case already, preserve that result and ignore whatever
3758+ // finishBackup() reports.
3759+ final int finishResult = transport .finishBackup ();
3760+ if (result == BackupTransport .TRANSPORT_OK ) {
3761+ result = finishResult ;
3762+ }
37543763 }
37553764
3756- // In all cases we need to give the transport its finish callback
3757- finishResult = transport .finishBackup ();
3758-
37593765 if (MORE_DEBUG ) {
3760- Slog .i (TAG , "Done trying to send backup data: result="
3761- + result + " finishResult=" + finishResult );
3762- }
3763-
3764- // If we were otherwise in a good state, now interpret the final
3765- // result based on what finishBackup() returned. If we're in a
3766- // failure case already, preserve that result and ignore whatever
3767- // finishBackup() reported.
3768- if (result == BackupTransport .TRANSPORT_OK ) {
3769- result = finishResult ;
3766+ Slog .i (TAG , "Done trying to send backup data: result=" + result );
37703767 }
37713768
37723769 if (result != BackupTransport .TRANSPORT_OK ) {
0 commit comments