API CHANGE: expose backup/restore to the SDK

The core backup/restore classes [BackupManager, BackupAgent, RestoreSession, and
RestoreObserver] are now published for 3rd party developers, as well as the suite
of helper classes that exist so far to aid authorship of backup/restore agents.

In conjunction with the API change, the restore-time automatic data wipe has now
been removed:  applications are responsible for managing the logic of wipe vs
merge themselves.  If the app's agent onRestore() callback throws, the data
is presumed to be incoherent and a wipe is issued via the Activity Manager;
otherwise, no automatic action is ever taken.

Change-Id: I0b3418b829d4689b58b88be3d9c4ace37a8583a9
This commit is contained in:
Christopher Tate
2010-02-16 15:22:26 -08:00
parent bb9a51768d
commit e28290e21f
16 changed files with 864 additions and 49 deletions

View File

@ -1083,15 +1083,11 @@ class BackupManagerService extends IBackupManager.Stub {
synchronized(mClearDataLock) {
mClearingData = true;
/* This is causing some critical processes to be killed during setup.
Temporarily revert this change until we find a better solution.
try {
mActivityManager.clearApplicationUserData(packageName, observer);
} catch (RemoteException e) {
// can't happen because the activity manager is in this process
}
*/
mPackageManager.clearApplicationUserData(packageName, observer);
// only wait 10 seconds for the clear data to happen
long timeoutMark = System.currentTimeMillis() + TIMEOUT_INTERVAL;
@ -1660,10 +1656,6 @@ class BackupManagerService extends IBackupManager.Stub {
+ "] is compatible with installed version ["
+ packageInfo.versionCode + "]");
// Now perform the actual restore: first clear the app's data
// if appropriate
clearApplicationDataSynchronous(packageName);
// Then set up and bind the agent (with a restricted Application object
// unless the application says otherwise)
boolean useRealApp = (packageInfo.applicationInfo.flags