am 932cd04a: Merge "Start using cancelFullBackup() when appropriate" into lmp-dev

* commit '932cd04a891f342501ef26a572a84986feab47c5':
  Start using cancelFullBackup() when appropriate
This commit is contained in:
Christopher Tate
2014-08-10 19:41:11 +00:00
committed by Android Git Automerger
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) {