summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Tate <ctate@google.com>2009-05-06 12:38:21 -0700
committerChristopher Tate <ctate@google.com>2009-05-06 12:38:21 -0700
commitb1d790b63e2115be558d451efbc914d1f8dfa846 (patch)
tree9f322b0eeab2171d6d2af0be67dcb816d190fc52
parent9a6f25033c51390cbcc4eec38f27e0ac35e97f1c (diff)
downloadframeworks_base-b1d790b63e2115be558d451efbc914d1f8dfa846.zip
frameworks_base-b1d790b63e2115be558d451efbc914d1f8dfa846.tar.gz
frameworks_base-b1d790b63e2115be558d451efbc914d1f8dfa846.tar.bz2
Pass null as savedState to indicate a full backup is required
-rw-r--r--core/java/android/backup/BackupService.java15
-rw-r--r--services/java/com/android/server/BackupManagerService.java11
2 files changed, 11 insertions, 15 deletions
diff --git a/core/java/android/backup/BackupService.java b/core/java/android/backup/BackupService.java
index 879b544..5a6886d 100644
--- a/core/java/android/backup/BackupService.java
+++ b/core/java/android/backup/BackupService.java
@@ -39,7 +39,7 @@ import android.util.Log;
* &lt;!-- Use the class "MyBackupService" to perform backups for my app --&gt;
* &lt;service android:name=".MyBackupService"&gt;
* &lt;intent-filter&gt;
- * &lt;action android:name="android.service.action.BACKUP" /&gt;
+ * &lt;action android:name="android.backup.BackupService.SERVICE" /&gt;
* &lt;/intent-filter&gt;
* &lt;/service&gt;</pre>
*
@@ -54,19 +54,18 @@ public abstract class BackupService extends Service {
* IntentFilter} that accepts this action.
*/
@SdkConstant(SdkConstantType.SERVICE_ACTION)
- public static final String SERVICE_ACTION = "android.backup.BackupService";
+ public static final String SERVICE_ACTION = "android.backup.BackupService.SERVICE";
/**
* The application is being asked to write any data changed since the
* last time it performed a backup operation. The state data recorded
- * during the last backup pass is provided in the oldStateFd file descriptor.
- * If oldState.getStatSize() is zero or negative, no old state is available
- * and the application should perform a full backup. In both cases, a representation
- * of the final backup state after this pass should be written to the file pointed
- * to by the newStateFd file descriptor.
+ * during the last backup pass is provided in the oldState file descriptor.
+ * If oldState is null, no old state is available and the application should perform
+ * a full backup. In both cases, a representation of the final backup state after
+ * this pass should be written to the file pointed to by the newStateFd file descriptor.
*
* @param oldState An open, read-only ParcelFileDescriptor pointing to the last backup
- * state provided by the application. May be empty or invalid, in which
+ * state provided by the application. May be null, in which
* case no prior state is being provided and the application should
* perform a full backup.
* @param data An open, read/write ParcelFileDescriptor pointing to the backup data
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 64b7f91..56caeea 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -119,18 +119,15 @@ class BackupManagerService extends IBackupManager.Stub {
// one backup service per package
File savedStateName = new File(mStateDir,
request.service.packageName);
- File dummyName = new File(mStateDir, "#####");
File backupDataName = new File(mDataDir,
request.service.packageName + ".data");
File newStateName = new File(mStateDir,
request.service.packageName + ".new");
- // In a full backup, we pass a file that is never writeable, hence
- // is always zero-sized, as a sentinel to the callee that they must
- // write all of their data.
- ParcelFileDescriptor savedState =
- ParcelFileDescriptor.open(
- (request.fullBackup) ? savedStateName : dummyName,
+ // In a full backup, we pass a null ParcelFileDescriptor as
+ // the saved-state "file"
+ ParcelFileDescriptor savedState = (request.fullBackup) ? null
+ : ParcelFileDescriptor.open(savedStateName,
ParcelFileDescriptor.MODE_READ_ONLY |
ParcelFileDescriptor.MODE_CREATE);