Start using cancelFullBackup() when appropriate

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

Bug 16524520

Change-Id: Ie368758c830a7d0ad11e7dd3142a0ed896069944
This commit is contained in:
Christopher Tate
2014-08-08 15:05:48 -07:00
committed by Christopher Tate
parent 7f708ecc2f
commit bf1a4a81eb
3 changed files with 20 additions and 17 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -3745,28 +3745,25 @@ 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");
transport.cancelFullBackup();
} else {
// If we were otherwise in a good state, now interpret the final
// result based on what finishBackup() returns. If we're in a
// failure case already, preserve that result and ignore whatever
// finishBackup() reports.
final int finishResult = transport.finishBackup();
if (result == BackupTransport.TRANSPORT_OK) {
result = finishResult;
}
}
// 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);
}
// If we were otherwise in a good state, now interpret the final
// result based on what finishBackup() returned. If we're in a
// failure case already, preserve that result and ignore whatever
// finishBackup() reported.
if (result == BackupTransport.TRANSPORT_OK) {
result = finishResult;
Slog.i(TAG, "Done trying to send backup data: result=" + result);
}
if (result != BackupTransport.TRANSPORT_OK) {