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

Commit c73a218c authored by Christopher Tate's avatar Christopher Tate
Browse files

Add some error reporting & info to bmgr's output

parent 56bc7156
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -171,9 +171,7 @@ public final class Bmgr {
            if (sets == null || sets.length == 0) {
                System.out.println("No restore sets available");
            } else {
                for (RestoreSet s : sets) {
                    System.out.println("  " + s.token + " : " + s.name);
                }
                printRestoreSets(sets);
            }
        } catch (RemoteException e) {
            System.err.println(e.toString());
@@ -181,6 +179,12 @@ public final class Bmgr {
        }
    }

    private void printRestoreSets(RestoreSet[] sets) {
        for (RestoreSet s : sets) {
            System.out.println("  " + s.token + " : " + s.name);
        }
    }

    class RestoreObserver extends IRestoreObserver.Stub {
        boolean done;
        public void restoreStarting(int numPackages) {
@@ -212,6 +216,7 @@ public final class Bmgr {
        RestoreObserver observer = new RestoreObserver();

        try {
            boolean didRestore = false;
            int curTransport = mBmgr.getCurrentTransport();
            mRestore = mBmgr.beginRestoreSession(curTransport);
            if (mRestore == null) {
@@ -223,9 +228,18 @@ public final class Bmgr {
                if (s.token == token) {
                    System.out.println("Scheduling restore: " + s.name);
                    mRestore.performRestore(token, observer);
                    didRestore = true;
                    break;
                }
            }
            if (!didRestore) {
                if (sets == null || sets.length == 0) {
                    System.out.println("No available restore sets; no restore performed");
                } else {
                    System.out.println("No matching restore set token.  Available sets:");
                    printRestoreSets(sets);
                }
            }
            mRestore.endRestoreSession();
        } catch (RemoteException e) {
            System.err.println(e.toString());