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

Commit df4144f4 authored by Geremy Condra's avatar Geremy Condra Committed by Android Git Automerger
Browse files

am 9fa57b74: am 2aee33c1: Merge "BackupManagerService files need new security labeling."

* commit '9fa57b74':
  BackupManagerService files need new security labeling.
parents 172fc865 9fa57b74
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.SELinux;
import android.util.Log;

import com.android.org.bouncycastle.util.encoders.Base64;
@@ -64,6 +65,10 @@ public class LocalTransport extends IBackupTransport.Stub {

    public LocalTransport(Context context) {
        mContext = context;
        mDataDir.mkdirs();
        if (!SELinux.restorecon(mDataDir)) {
            Log.e(TAG, "SELinux restorecon failed for " + mDataDir);
        }
    }

    public Intent configurationIntent() {
+12 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ import android.os.ParcelFileDescriptor;
import android.os.PowerManager;
import android.os.Process;
import android.os.RemoteException;
import android.os.SELinux;
import android.os.ServiceManager;
import android.os.SystemClock;
import android.os.UserHandle;
@@ -746,6 +747,9 @@ class BackupManagerService extends IBackupManager.Stub {
        // correct directory.
        mBaseStateDir = new File(Environment.getSecureDataDirectory(), "backup");
        mBaseStateDir.mkdirs();
        if (!SELinux.restorecon(mBaseStateDir)) {
            Slog.e(TAG, "SELinux restorecon failed on " + mBaseStateDir);
        }
        mDataDir = Environment.getDownloadCacheDirectory();

        mPasswordHashFile = new File(mBaseStateDir, "pwhash");
@@ -2136,6 +2140,10 @@ class BackupManagerService extends IBackupManager.Stub {
                        ParcelFileDescriptor.MODE_CREATE |
                        ParcelFileDescriptor.MODE_TRUNCATE);

                if (!SELinux.restorecon(mBackupDataName)) {
                    Slog.e(TAG, "SELinux restorecon failed on " + mBackupDataName);
                }

                mNewState = ParcelFileDescriptor.open(mNewStateName,
                        ParcelFileDescriptor.MODE_READ_WRITE |
                        ParcelFileDescriptor.MODE_CREATE |
@@ -4697,6 +4705,10 @@ class BackupManagerService extends IBackupManager.Stub {
                            ParcelFileDescriptor.MODE_CREATE |
                            ParcelFileDescriptor.MODE_TRUNCATE);

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

                if (mTransport.getRestoreData(mBackupData) != BackupConstants.TRANSPORT_OK) {
                    // Transport-level failure, so we wind everything up and
                    // terminate the restore operation.