Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09ff08d0 authored by Ruslan Tkhakokhov's avatar Ruslan Tkhakokhov Committed by Android (Google) Code Review
Browse files

Merge "Add bmgr command to enable/disable auto restore"

parents 42e3357d 6baf03e1
Loading
Loading
Loading
Loading
+29 −0
Original line number Original line Diff line number Diff line
@@ -125,6 +125,11 @@ public class Bmgr {
            return;
            return;
        }
        }


        if ("autorestore".equals(op)) {
            doAutoRestore(userId);
            return;
        }

        if ("enabled".equals(op)) {
        if ("enabled".equals(op)) {
            doEnabled(userId);
            doEnabled(userId);
            return;
            return;
@@ -213,6 +218,26 @@ public class Bmgr {
        return true;
        return true;
    }
    }


    private void doAutoRestore(int userId) {
        String arg = nextArg();
        if (arg == null) {
            showUsage();
            return;
        }

        try {
            boolean enable = Boolean.parseBoolean(arg);
            mBmgr.setAutoRestore(enable);
            System.out.println(
                    "Auto restore is now "
                            + (enable ? "enabled" : "disabled")
                            + " for user "
                            + userId);
        } catch (RemoteException e) {
            handleRemoteException(e);
        }
    }

    private String activatedToString(boolean activated) {
    private String activatedToString(boolean activated) {
        return activated ? "activated" : "deactivated";
        return activated ? "activated" : "deactivated";
    }
    }
@@ -918,6 +943,7 @@ public class Bmgr {
        System.err.println("       bmgr init TRANSPORT...");
        System.err.println("       bmgr init TRANSPORT...");
        System.err.println("       bmgr activate BOOL");
        System.err.println("       bmgr activate BOOL");
        System.err.println("       bmgr activated");
        System.err.println("       bmgr activated");
        System.err.println("       bmgr autorestore BOOL");
        System.err.println("");
        System.err.println("");
        System.err.println("The '--user' option specifies the user on which the operation is run.");
        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.");
        System.err.println("It must be the first argument before the operation.");
@@ -992,6 +1018,9 @@ public class Bmgr {
        System.err.println("");
        System.err.println("");
        System.err.println("The 'activated' command reports the current activated/deactivated");
        System.err.println("The 'activated' command reports the current activated/deactivated");
        System.err.println("state of the backup mechanism.");
        System.err.println("state of the backup mechanism.");
        System.err.println("");
        System.err.println("The 'autorestore' command enables or disables automatic restore when");
        System.err.println("a new package is installed.");
    }
    }


    private static class BackupMonitor extends IBackupManagerMonitor.Stub {
    private static class BackupMonitor extends IBackupManagerMonitor.Stub {