Move towards a formal public API for backup and restore

This commit makes a few changes towards establishing a formal application
interface for interacting with the backup/restore mechanism:

1. Introduce public wrapper classes around the various binder interfaces; 3rd
party code will never see the binders directly.

2. Progress update callbacks during a restore sequence now occur on the main
thread, not in a binder thread [and not with system-process permissions!].

3. Rename the BackupManagerService's inner "RestoreSession" class to avoid
ambiguity with the new public "RestoreSession" class.
This commit is contained in:
Christopher Tate
2010-01-25 19:37:47 -08:00
parent da77d0a6e7
commit 80202c8cb8
4 changed files with 242 additions and 8 deletions

View File

@ -161,7 +161,7 @@ class BackupManagerService extends IBackupManager.Stub {
= new HashMap<String,IBackupTransport>();
String mCurrentTransport;
IBackupTransport mLocalTransport, mGoogleTransport;
RestoreSession mActiveRestoreSession;
ActiveRestoreSession mActiveRestoreSession;
class RestoreParams {
public IBackupTransport transport;
@ -2068,20 +2068,20 @@ class BackupManagerService extends IBackupManager.Stub {
Log.d(TAG, "Restore session requested but one already active");
return null;
}
mActiveRestoreSession = new RestoreSession(transport);
mActiveRestoreSession = new ActiveRestoreSession(transport);
}
return mActiveRestoreSession;
}
// ----- Restore session -----
class RestoreSession extends IRestoreSession.Stub {
class ActiveRestoreSession extends IRestoreSession.Stub {
private static final String TAG = "RestoreSession";
private IBackupTransport mRestoreTransport = null;
RestoreSet[] mRestoreSets = null;
RestoreSession(String transport) {
ActiveRestoreSession(String transport) {
mRestoreTransport = getTransport(transport);
}