summaryrefslogtreecommitdiffstats
path: root/cmds
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2009-06-26 11:41:26 -0700
committerChristopher Tate <ctate@google.com>2009-06-26 12:20:10 -0700
commitc73a218c2663e6ae3ec8a9ab8b9524f95702ade9 (patch)
treeded996c56eae0df093d1d36857d38fef4870bf10 /cmds
parent56bc71565ecd72bf7a3e45b5c871b0407ed9f781 (diff)
downloadframeworks_base-c73a218c2663e6ae3ec8a9ab8b9524f95702ade9.zip
frameworks_base-c73a218c2663e6ae3ec8a9ab8b9524f95702ade9.tar.gz
frameworks_base-c73a218c2663e6ae3ec8a9ab8b9524f95702ade9.tar.bz2
Add some error reporting & info to bmgr's output
Diffstat (limited to 'cmds')
-rw-r--r--cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java20
1 files changed, 17 insertions, 3 deletions
diff --git a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
index 01083f1..68caa26 100644
--- a/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
+++ b/cmds/bmgr/src/com/android/commands/bmgr/Bmgr.java
@@ -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());