Loading core/java/android/backup/BackupService.java +7 −8 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ import android.util.Log; * <!-- 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> * Loading @@ -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 Loading services/java/com/android/server/BackupManagerService.java +4 −7 Original line number Diff line number Diff line Loading @@ -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); Loading Loading
core/java/android/backup/BackupService.java +7 −8 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ import android.util.Log; * <!-- 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> * Loading @@ -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 Loading
services/java/com/android/server/BackupManagerService.java +4 −7 Original line number Diff line number Diff line Loading @@ -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); Loading