am 5cb400bd: Keep track of backup state independently for each transport

Merge commit '5cb400bd72726c22f641f334951b35ce2ddcfeef'

* commit '5cb400bd72726c22f641f334951b35ce2ddcfeef':
  Keep track of backup state independently for each transport
This commit is contained in:
Christopher Tate
2009-06-25 16:15:54 -07:00
committed by The Android Open Source Project
3 changed files with 57 additions and 37 deletions

View File

@@ -40,6 +40,20 @@ interface IBackupTransport {
- cloud: tear down connection etc
- adb: close the file
*/
/**
* Ask the transport where, on local device storage, to keep backup state blobs.
* This is per-transport so that mock transports used for testing can coexist with
* "live" backup services without interfering with the live bookkeeping. The
* returned string should be a name that is expected to be unambiguous among all
* available backup transports; the name of the class implementing the transport
* is a good choice.
*
* @return A unique name, suitable for use as a file or directory name, that the
* Backup Manager could use to disambiguate state files associated with
* different backup transports.
*/
String transportDirName();
/**
* Verify that this is a suitable time for a backup pass. This should return zero
* if a backup is reasonable right now, some positive value otherwise. This method

View File

@@ -30,6 +30,9 @@ public class LocalTransport extends IBackupTransport.Stub {
private static final String TAG = "LocalTransport";
private static final boolean DEBUG = true;
private static final String TRANSPORT_DIR_NAME
= "com.android.internal.backup.LocalTransport";
private Context mContext;
private PackageManager mPackageManager;
private File mDataDir = new File(Environment.getDownloadCacheDirectory(), "backup");
@@ -43,6 +46,11 @@ public class LocalTransport extends IBackupTransport.Stub {
mPackageManager = context.getPackageManager();
}
public String transportDirName() throws RemoteException {
return TRANSPORT_DIR_NAME;
}
public long requestBackupTime() throws RemoteException {
// any time is a good time for local backup
return 0;