summaryrefslogtreecommitdiff
path: root/cmds/bmgr
diff options
context:
space:
mode:
authorShreyas Basarge <snb@google.com>2017-01-28 16:50:09 +0000
committerShreyas Basarge <snb@google.com>2017-02-14 13:51:59 +0000
commitc3704427c9a34397fd90bf5438adae2eebcc97f6 (patch)
tree8b72d3ecfea34539e7b35ed942d2b30b2aafdd0f /cmds/bmgr
parentf49f3482de64b44c9c6d3132521c5ed54b64a2f1 (diff)
BackupManager#cancelBackups() API
Introduces a cancelBackups() API for BackupManager. When this function returns, it is guaranteed that currently running backup operations won't interact with the active transport. Bug: 34760860 Ref: https://docs.google.com/document/d/18MnfwkDfKNtXQBPRmL8vpVgfLgSWJsDja1Nm1QV5hOw/edit#heading=h.9p6yo0wx44k3 Test: GTS tests at ag/1893365 Change-Id: I67f78699bbe763ea71c85937fbc01a5b48694eed
Diffstat (limited to 'cmds/bmgr')
-rw-r--r--cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
index a67e47f92017..bfcad1bb5f96 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -127,6 +127,11 @@ public final class Bmgr {
return;
}
+ if ("cancel".equals(op)) {
+ doCancel();
+ return;
+ }
+
if ("whitelist".equals(op)) {
doPrintWhitelist();
return;
@@ -270,6 +275,8 @@ public final class Bmgr {
return "Agent error";
case BackupManager.ERROR_TRANSPORT_QUOTA_EXCEEDED:
return "Size quota exceeded";
+ case BackupManager.ERROR_BACKUP_CANCELLED:
+ return "Backup Cancelled";
default:
return "Unknown error";
}
@@ -361,6 +368,21 @@ public final class Bmgr {
}
}
+ private void doCancel() {
+ String arg = nextArg();
+ if ("backups".equals(arg)) {
+ try {
+ mBmgr.cancelBackups();
+ } catch (RemoteException e) {
+ System.err.println(e.toString());
+ System.err.println(BMGR_NOT_RUNNING_ERR);
+ }
+ return;
+ }
+
+ System.err.println("Unknown command.");
+ }
+
private void doTransport() {
try {
String which = nextArg();
@@ -721,6 +743,7 @@ public final class Bmgr {
System.err.println(" bmgr wipe TRANSPORT PACKAGE");
System.err.println(" bmgr fullbackup PACKAGE...");
System.err.println(" bmgr backupnow --all|PACKAGE...");
+ System.err.println(" bmgr cancel backups");
System.err.println("");
System.err.println("The 'backup' command schedules a backup pass for the named package.");
System.err.println("Note that the backup pass will effectively be a no-op if the package");
@@ -780,5 +803,6 @@ public final class Bmgr {
System.err.println("For each package it will run key/value or full data backup ");
System.err.println("depending on the package's manifest declarations.");
System.err.println("The data is sent via the currently active transport.");
+ System.err.println("The 'cancel backups' command cancels all running backups.");
}
}