Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support MIUI OS backup file #79

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/org/nick/abe/AndroidBackup.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class AndroidBackup {

private static final int BACKUP_MANIFEST_VERSION = 1;
private static final String BACKUP_FILE_HEADER_MAGIC = "ANDROID BACKUP\n";
private static final String MIUI_BACKUP_FILE_HEADER_MAGIC = "MIUI BACKUP";
private static final int BACKUP_FILE_V1 = 1;
private static final int BACKUP_FILE_V2 = 2;
private static final int BACKUP_FILE_V3 = 3;
Expand Down Expand Up @@ -61,6 +62,17 @@ public static void extractAsTar(String backupFilename, String filename,
CipherInputStream cipherStream = null;

String magic = readHeaderLine(rawInStream); // 1
if (MIUI_BACKUP_FILE_HEADER_MAGIC.equals(magic)) {
//if this is MIUI OS backup file,drop five line from file header
//MIUI OS insert five line in the file header
if (DEBUG){
System.out.println("Drop MIUI backup file header");
}
for (int i = 0; i < 4; i++) {
readHeaderLine(rawInStream);
}
magic = readHeaderLine(rawInStream);
}
if (DEBUG) {
System.err.println("Magic: " + magic);
}
Expand Down