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

Commit 70cf6e8b authored by Annie Meng's avatar Annie Meng Committed by Android (Google) Code Review
Browse files

Merge "[Multi-user] Remove dir management for non-system users"

parents e11e621d fcdfa01f
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -494,20 +494,18 @@ public class UserBackupManagerService {
                mUserId);

        mBaseStateDir = checkNotNull(baseStateDir, "baseStateDir cannot be null");
        // TODO (b/120424138): Remove once the system user is migrated to use the per-user CE
        // directory. Per-user CE directories are managed by vold.
        if (userId == UserHandle.USER_SYSTEM) {
            mBaseStateDir.mkdirs();
        if (!SELinux.restoreconRecursive(mBaseStateDir)) {
            if (!SELinux.restorecon(mBaseStateDir)) {
                Slog.w(TAG, "SELinux restorecon failed on " + mBaseStateDir);
            }
        }

        // TODO (b/120424138): The system user currently uses the cache which is managed by init.rc
        // Initialization and restorecon is managed by vold for per-user CE directories.
        mDataDir = checkNotNull(dataDir, "dataDir cannot be null");
        // TODO(b/120424138): Remove when the system user moves out of the cache dir. The cache dir
        // is managed by init.rc so we don't have to create it below.
        if (userId != UserHandle.USER_SYSTEM) {
            mDataDir.mkdirs();
            if (!SELinux.restoreconRecursive(mDataDir)) {
                Slog.w(TAG, "SELinux restorecon failed on " + mDataDir);
            }
        }
        mBackupPasswordManager = new BackupPasswordManager(mContext, mBaseStateDir, mRng);

        // Receivers for scheduled backups and transport initialization operations.
+7 −2
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteException;
import android.os.SELinux;
import android.os.UserHandle;
import android.os.WorkSource;

import com.android.internal.annotations.GuardedBy;
@@ -686,9 +687,13 @@ public class KeyValueBackupTask implements BackupRestoreTask, Runnable {
                    ParcelFileDescriptor.open(
                            mNewStateFile, MODE_READ_WRITE | MODE_CREATE | MODE_TRUNCATE);

            // TODO (b/120424138): Remove once the system user is migrated to use the per-user CE
            // directory. Per-user CE directories are managed by vold.
            if (mUserId == UserHandle.USER_SYSTEM) {
                if (!SELinux.restorecon(mBackupDataFile)) {
                    mReporter.onRestoreconFailed(mBackupDataFile);
                }
            }

            IBackupTransport transport = mTransportClient.connectOrThrow("KVBT.extractAgentData()");
            long quota = transport.getBackupQuota(packageName, /* isFullBackup */ false);