Merge "Fix full backup of shared storage"

This commit is contained in:
Christopher Tate
2011-10-18 16:19:37 -07:00
committed by Android (Google) Code Review
2 changed files with 3 additions and 6 deletions

View File

@@ -23,7 +23,6 @@
<application android:allowClearUserData="false" <application android:allowClearUserData="false"
android:permission="android.permission.CONFIRM_FULL_BACKUP" android:permission="android.permission.CONFIRM_FULL_BACKUP"
android:backupAgent=".SharedStorageAgent" android:backupAgent="SharedStorageAgent" >
android:allowBackup="false" >
</application> </application>
</manifest> </manifest>

View File

@@ -2,11 +2,8 @@ package com.android.sharedstoragebackup;
import android.app.backup.FullBackupAgent; import android.app.backup.FullBackupAgent;
import android.app.backup.FullBackup; import android.app.backup.FullBackup;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.app.backup.FullBackupDataOutput; import android.app.backup.FullBackupDataOutput;
import android.content.Context; import android.content.Context;
import android.os.Environment;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import android.os.storage.StorageManager; import android.os.storage.StorageManager;
import android.os.storage.StorageVolume; import android.os.storage.StorageVolume;
@@ -40,6 +37,7 @@ public class SharedStorageAgent extends FullBackupAgent {
// hierarchy backup process on them. By convention in the Storage Manager, the // hierarchy backup process on them. By convention in the Storage Manager, the
// "primary" shared storage volume is first in the list. // "primary" shared storage volume is first in the list.
if (mVolumes != null) { if (mVolumes != null) {
if (DEBUG) Slog.i(TAG, "Backing up " + mVolumes.length + " shared volumes");
for (int i = 0; i < mVolumes.length; i++) { for (int i = 0; i < mVolumes.length; i++) {
StorageVolume v = mVolumes[i]; StorageVolume v = mVolumes[i];
// Express the contents of volume N this way in the tar stream: // Express the contents of volume N this way in the tar stream:
@@ -58,7 +56,7 @@ public class SharedStorageAgent extends FullBackupAgent {
public void onRestoreFile(ParcelFileDescriptor data, long size, public void onRestoreFile(ParcelFileDescriptor data, long size,
int type, String domain, String relpath, long mode, long mtime) int type, String domain, String relpath, long mode, long mtime)
throws IOException { throws IOException {
Slog.d(TAG, "Shared restore: [ " + domain + " : " + relpath + "]"); if (DEBUG) Slog.d(TAG, "Shared restore: [ " + domain + " : " + relpath + "]");
File outFile = null; File outFile = null;