Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb2ea431 authored by Christopher Tate's avatar Christopher Tate
Browse files

Fix full backup of shared storage

The manifest said android:allowBackup="false" for vestigal reasons;
originally, the incremental and full backup agents were separate, and
it was not possible to opt out of full backup.  When that got fixed,
unfortunately this one manifest was not corrected to the new regime.

Bug 5411789

Change-Id: Iafc8f1fdefc312dff59454485604b6c5c400f469
parent 7c3a1839
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@

    <application android:allowClearUserData="false"
                 android:permission="android.permission.CONFIRM_FULL_BACKUP"
                 android:backupAgent=".SharedStorageAgent"
                 android:allowBackup="false" >
                 android:backupAgent="SharedStorageAgent" >
    </application>
</manifest>
+2 −4
Original line number Diff line number Diff line
@@ -2,11 +2,8 @@ package com.android.sharedstoragebackup;

import android.app.backup.FullBackupAgent;
import android.app.backup.FullBackup;
import android.app.backup.BackupDataInput;
import android.app.backup.BackupDataOutput;
import android.app.backup.FullBackupDataOutput;
import android.content.Context;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.os.storage.StorageManager;
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
        // "primary" shared storage volume is first in the list.
        if (mVolumes != null) {
            if (DEBUG) Slog.i(TAG, "Backing up " + mVolumes.length + " shared volumes");
            for (int i = 0; i < mVolumes.length; i++) {
                StorageVolume v = mVolumes[i];
                // 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,
            int type, String domain, String relpath, long mode, long mtime)
            throws IOException {
        Slog.d(TAG, "Shared restore: [ " + domain + " : " + relpath + "]");
        if (DEBUG) Slog.d(TAG, "Shared restore: [ " + domain + " : " + relpath + "]");

        File outFile = null;