summaryrefslogtreecommitdiff
path: root/cmds/bmgr
diff options
context:
space:
mode:
authorChandan Nath <nathch@google.com>2019-03-29 13:18:35 +0000
committerChandan Nath <nathch@google.com>2019-04-03 13:36:55 +0100
commit7053e28b596ed7bdf3180cd5069001c37880e32c (patch)
treeade3a14384387a88afda0424dd56eab62cdb0f17 /cmds/bmgr
parentbe8b2e8583583997f96bdbe7132f62dba5889182 (diff)
[Multi-user] Clean up user state stored in the system user directory
when user is removed. For non system users, backup state is stored in both the user's own dir and the system dir. When the user is removed, the user's own dir gets removed by the OS. This code change ensures that the part of the user backup state which is in the system dir also gets removed. Bug: 127650374 Test: atest -v CtsBackupHostTestCases:android.cts.backup.MultiUserBackupStateTest Change-Id: I4ea252e8e6da608e36ec3ac335666923d88a8748
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 98ab6665958c..680ccfc57ddf 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -112,6 +112,11 @@ public class Bmgr {
return;
}
+ if ("activated".equals(op)) {
+ doActivated(userId);
+ return;
+ }
+
if (!isBackupActive(userId)) {
return;
}
@@ -200,6 +205,21 @@ public class Bmgr {
return true;
}
+ private String activatedToString(boolean activated) {
+ return activated ? "activated" : "deactivated";
+ }
+
+ private void doActivated(@UserIdInt int userId) {
+ try {
+ System.out.println("Backup Manager currently "
+ + activatedToString(mBmgr.isBackupServiceActive(userId)));
+ } catch (RemoteException e) {
+ System.err.println(e.toString());
+ System.err.println(BMGR_NOT_RUNNING_ERR);
+ }
+
+ }
+
private String enableToString(boolean enabled) {
return enabled ? "enabled" : "disabled";
}
@@ -907,6 +927,7 @@ public class Bmgr {
System.err.println(" bmgr cancel backups");
System.err.println(" bmgr init TRANSPORT...");
System.err.println(" bmgr activate BOOL");
+ System.err.println(" bmgr activated");
System.err.println("");
System.err.println("The '--user' option specifies the user on which the operation is run.");
System.err.println("It must be the first argument before the operation.");
@@ -978,6 +999,9 @@ public class Bmgr {
System.err.println("If the argument is 'true' it will be activated, otherwise it will be");
System.err.println("deactivated. When deactivated, the service will not be running and no");
System.err.println("operations can be performed until activation.");
+ System.err.println("");
+ System.err.println("The 'activated' command reports the current activated/deactivated");
+ System.err.println("state of the backup mechanism.");
}
private static class BackupMonitor extends IBackupManagerMonitor.Stub {