Pass null as savedState to indicate a full backup is required
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 @@
* <!-- Use the class "MyBackupService" to perform backups for my app -->
* <service android:name=".MyBackupService">
* <intent-filter>
- * <action android:name="android.service.action.BACKUP" />
+ * <action android:name="android.backup.BackupService.SERVICE" />
* </intent-filter>
* </service></pre>
*
@@ -54,19 +54,18 @@
* 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 @@
// 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);