Revamp IRestoreSession a bit
We now supply an array of RestoreSet objects instead of wacky Bundle shenanigans. Also, pushed beginRestoreSession() out to the BackupManager concrete interface class so that SetupWizard can use it. (beginRestoreSession() is @hide, non-privileged apps cannot use it. It's also guarded by android.permission.BACKUP enforcement.)
This commit is contained in:
@@ -44,6 +44,7 @@ import android.util.SparseArray;
|
||||
import android.backup.IBackupManager;
|
||||
import android.backup.IRestoreSession;
|
||||
import android.backup.BackupManager;
|
||||
import android.backup.RestoreSet;
|
||||
|
||||
import com.android.internal.backup.AdbTransport;
|
||||
import com.android.internal.backup.GoogleTransport;
|
||||
@@ -617,6 +618,36 @@ class BackupManagerService extends IBackupManager.Stub {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ----- Restore session -----
|
||||
|
||||
class RestoreSession extends IRestoreSession.Stub {
|
||||
private IBackupTransport mRestoreTransport = null;
|
||||
RestoreSet[] mRestoreSets = null;
|
||||
|
||||
RestoreSession(int transportID) {
|
||||
mRestoreTransport = createTransport(transportID);
|
||||
}
|
||||
|
||||
// --- Binder interface ---
|
||||
public RestoreSet[] getAvailableRestoreSets() throws android.os.RemoteException {
|
||||
synchronized(this) {
|
||||
if (mRestoreSets == null) {
|
||||
mRestoreSets = mRestoreTransport.getAvailableRestoreSets();
|
||||
}
|
||||
return mRestoreSets;
|
||||
}
|
||||
}
|
||||
|
||||
public int performRestore(int token) throws android.os.RemoteException {
|
||||
return -1;
|
||||
}
|
||||
|
||||
public void endRestoreSession() throws android.os.RemoteException {
|
||||
mRestoreTransport.endSession();
|
||||
mRestoreTransport = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
|
||||
Reference in New Issue
Block a user