use of android.app.backup.RestoreSet in project android_frameworks_base by AOSPA.
the class LocalTransport method getAvailableRestoreSets.
@Override
public RestoreSet[] getAvailableRestoreSets() {
long[] existing = new long[POSSIBLE_SETS.length + 1];
int num = 0;
// see which possible non-current sets exist...
for (long token : POSSIBLE_SETS) {
if ((new File(mDataDir, Long.toString(token))).exists()) {
existing[num++] = token;
}
}
// ...and always the currently-active set last
existing[num++] = CURRENT_SET_TOKEN;
RestoreSet[] available = new RestoreSet[num];
for (int i = 0; i < available.length; i++) {
available[i] = new RestoreSet("Local disk image", "flash", existing[i]);
}
return available;
}
use of android.app.backup.RestoreSet in project android_frameworks_base by crdroidandroid.
the class LocalTransport method getAvailableRestoreSets.
@Override
public RestoreSet[] getAvailableRestoreSets() {
long[] existing = new long[POSSIBLE_SETS.length + 1];
int num = 0;
// see which possible non-current sets exist...
for (long token : POSSIBLE_SETS) {
if ((new File(mDataDir, Long.toString(token))).exists()) {
existing[num++] = token;
}
}
// ...and always the currently-active set last
existing[num++] = CURRENT_SET_TOKEN;
RestoreSet[] available = new RestoreSet[num];
for (int i = 0; i < available.length; i++) {
available[i] = new RestoreSet("Local disk image", "flash", existing[i]);
}
return available;
}
use of android.app.backup.RestoreSet in project android_frameworks_base by crdroidandroid.
the class Bmgr method doRestoreAll.
private void doRestoreAll(long token, HashSet<String> filter) {
RestoreObserver observer = new RestoreObserver();
try {
boolean didRestore = false;
mRestore = mBmgr.beginRestoreSession(null, null);
if (mRestore == null) {
System.err.println(BMGR_NOT_RUNNING_ERR);
return;
}
RestoreSet[] sets = null;
int err = mRestore.getAvailableRestoreSets(observer);
if (err == 0) {
observer.waitForCompletion();
sets = observer.sets;
if (sets != null) {
for (RestoreSet s : sets) {
if (s.token == token) {
System.out.println("Scheduling restore: " + s.name);
if (filter == null) {
didRestore = (mRestore.restoreAll(token, observer) == 0);
} else {
String[] names = new String[filter.size()];
filter.toArray(names);
didRestore = (mRestore.restoreSome(token, observer, names) == 0);
}
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);
}
}
// to complete before we can shut down the restore session safely
if (didRestore) {
observer.waitForCompletion();
}
// once the restore has finished, close down the session and we're done
mRestore.endRestoreSession();
} catch (RemoteException e) {
System.err.println(e.toString());
System.err.println(BMGR_NOT_RUNNING_ERR);
}
}
use of android.app.backup.RestoreSet in project platform_frameworks_base by android.
the class LocalTransport method getAvailableRestoreSets.
@Override
public RestoreSet[] getAvailableRestoreSets() {
long[] existing = new long[POSSIBLE_SETS.length + 1];
int num = 0;
// see which possible non-current sets exist...
for (long token : POSSIBLE_SETS) {
if ((new File(mDataDir, Long.toString(token))).exists()) {
existing[num++] = token;
}
}
// ...and always the currently-active set last
existing[num++] = CURRENT_SET_TOKEN;
RestoreSet[] available = new RestoreSet[num];
for (int i = 0; i < available.length; i++) {
available[i] = new RestoreSet("Local disk image", "flash", existing[i]);
}
return available;
}
use of android.app.backup.RestoreSet in project android_frameworks_base by ParanoidAndroid.
the class LocalTransport method getAvailableRestoreSets.
// Restore handling
public RestoreSet[] getAvailableRestoreSets() throws android.os.RemoteException {
// one hardcoded restore set
RestoreSet set = new RestoreSet("Local disk image", "flash", RESTORE_TOKEN);
RestoreSet[] array = { set };
return array;
}
Aggregations