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

Commit 4fff321f authored by Chris Tate's avatar Chris Tate Committed by Android (Google) Code Review
Browse files

Merge "Stage backup/restore data in a cache subdir rather than root"

parents 86cfe518 e5f51c21
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -101,9 +101,6 @@ public class LocalTransport extends BackupTransport {

    private void makeDataDirs() {
        mCurrentSetDir.mkdirs();
        if (!SELinux.restorecon(mCurrentSetDir)) {
            Log.e(TAG, "SELinux restorecon failed for " + mCurrentSetDir);
        }
        mCurrentSetFullDir.mkdir();
        mCurrentSetIncrementalDir.mkdir();
    }
+27 −23
Original line number Diff line number Diff line
@@ -1049,7 +1049,9 @@ public class BackupManagerService {
        if (!SELinux.restorecon(mBaseStateDir)) {
            Slog.e(TAG, "SELinux restorecon failed on " + mBaseStateDir);
        }
        mDataDir = Environment.getDownloadCacheDirectory();

        // This dir on /cache is managed directly in init.rc
        mDataDir = new File(Environment.getDownloadCacheDirectory(), "backup_stage");

        mPasswordVersion = 1;       // unless we hear otherwise
        mPasswordVersionFile = new File(mBaseStateDir, "pwversion");
@@ -8112,10 +8114,6 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
                        ParcelFileDescriptor.MODE_CREATE |
                        ParcelFileDescriptor.MODE_TRUNCATE);

                if (!SELinux.restorecon(mBackupDataName)) {
                    if (MORE_DEBUG) Slog.e(TAG, "SElinux restorecon failed for " + downloadFile);
                }

                if (mTransport.getRestoreData(stage) != BackupTransport.TRANSPORT_OK) {
                    // Transport-level failure, so we wind everything up and
                    // terminate the restore operation.
@@ -8169,6 +8167,7 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF

                // Okay, we have the data.  Now have the agent do the restore.
                stage.close();

                mBackupData = ParcelFileDescriptor.open(mBackupDataName,
                        ParcelFileDescriptor.MODE_READ_ONLY);

@@ -9056,9 +9055,11 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
                Slog.d(TAG, "fullTransportBackup()");
            }

            final long oldId = Binder.clearCallingIdentity();
            try {
                CountDownLatch latch = new CountDownLatch(1);
            PerformFullTransportBackupTask task = new PerformFullTransportBackupTask(null, pkgNames,
                    false, null, latch, null, false /* userInitiated */);
                PerformFullTransportBackupTask task = new PerformFullTransportBackupTask(null,
                        pkgNames, false, null, latch, null, false /* userInitiated */);
                // Acquiring wakelock for PerformFullTransportBackupTask before its start.
                mWakelock.acquire();
                (new Thread(task, "full-transport-master")).start();
@@ -9076,6 +9077,9 @@ if (MORE_DEBUG) Slog.v(TAG, " + got " + nRead + "; now wanting " + (size - soF
                for (String pkg : pkgNames) {
                    enqueueFullBackup(pkg, now);
                }
            } finally {
                Binder.restoreCallingIdentity(oldId);
            }
        }

        if (DEBUG) {