summaryrefslogtreecommitdiffstats
path: root/util/com/android
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2013-10-04 11:29:36 -0400
committerChris Wren <cwren@android.com>2013-10-07 14:43:22 +0000
commit92aa423826b9e4e83d5d32e364930399785b3e84 (patch)
tree96e4708f1416480bdca41257299aa4f48eb2d86d /util/com/android
parentd4507eefa37245c012a68d148aa5f14d4638f96d (diff)
downloadandroid_packages_apps_Trebuchet-92aa423826b9e4e83d5d32e364930399785b3e84.tar.gz
android_packages_apps_Trebuchet-92aa423826b9e4e83d5d32e364930399785b3e84.tar.bz2
android_packages_apps_Trebuchet-92aa423826b9e4e83d5d32e364930399785b3e84.zip
move to backup helper architecture
add journals to DecoderRing, for backup debugging Bug: 10778984 Change-Id: I38e93853c05f72468b3800c172b96effc70a63e0
Diffstat (limited to 'util/com/android')
-rw-r--r--util/com/android/launcher3/DecoderRing.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/util/com/android/launcher3/DecoderRing.java b/util/com/android/launcher3/DecoderRing.java
index b7349fef7..1d9e0defb 100644
--- a/util/com/android/launcher3/DecoderRing.java
+++ b/util/com/android/launcher3/DecoderRing.java
@@ -18,6 +18,7 @@ package com.android.launcher3;
import com.android.launcher3.backup.BackupProtos.CheckedMessage;
import com.android.launcher3.backup.BackupProtos.Favorite;
import com.android.launcher3.backup.BackupProtos.Key;
+import com.android.launcher3.backup.BackupProtos.Journal;
import com.android.launcher3.backup.BackupProtos.Resource;
import com.android.launcher3.backup.BackupProtos.Screen;
import com.android.launcher3.backup.BackupProtos.Widget;
@@ -49,17 +50,27 @@ class DecoderRing {
throws Exception {
File source = null;
Class type = Key.class;
+ int skip = 0;
+
for (int i = 0; i < args.length; i++) {
if ("-k".equals(args[i])) {
type = Key.class;
} else if ("-f".equals(args[i])) {
type = Favorite.class;
+ } else if ("-j".equals(args[i])) {
+ type = Journal.class;
} else if ("-i".equals(args[i])) {
type = Resource.class;
} else if ("-s".equals(args[i])) {
type = Screen.class;
} else if ("-w".equals(args[i])) {
type = Widget.class;
+ } else if ("-S".equals(args[i])) {
+ if ((i + 1) < args.length) {
+ skip = Integer.valueOf(args[++i]);
+ } else {
+ usage(args);
+ }
} else if (args[i] != null && !args[i].startsWith("-")) {
source = new File(args[i]);
} else {
@@ -86,8 +97,14 @@ class DecoderRing {
try {
while (input.available() > 0) {
int n = input.read(buffer);
+ int offset = 0;
+ if (skip > 0) {
+ offset = Math.min(skip, n);
+ n -= offset;
+ skip -= offset;
+ }
if (n > 0) {
- byteStream.write(buffer, 0, n);
+ byteStream.write(buffer, offset, n);
}
}
} catch (IOException e) {
@@ -190,6 +207,7 @@ class DecoderRing {
System.err.println("\t-i\tdecode a icon");
System.err.println("\t-s\tdecode a screen");
System.err.println("\t-w\tdecode a widget");
+ System.err.println("\t-s b\tskip b bytes");
System.err.println("\tfilename\tread from filename, not stdin");
System.exit(1);
}