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:
Christopher Tate
2009-06-08 15:24:01 -07:00
parent b2df1699c9
commit 9b3905c4a2
8 changed files with 171 additions and 20 deletions

View File

@@ -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) {