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

Commit 12566be4 authored by repo sync's avatar repo sync
Browse files

Set persistent property for SELinux enforcement on update.

Bug: 8702843
Change-Id: I41c0084a71160061b297d57d995261e238ea555c
parent 78cfd3cc
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -122,9 +122,16 @@ public class SELinuxPolicyInstallReceiver extends ConfigUpdateInstallReceiver {
    }

    private void setEnforcingMode(Context context) {
        boolean mode = Settings.Global.getInt(context.getContentResolver(),
            Settings.Global.SELINUX_STATUS, 0) == 1;
        SELinux.setSELinuxEnforce(mode);
        String mode = Settings.Global.getString(context.getContentResolver(),
            Settings.Global.SELINUX_STATUS);
        if (mode.equals("1")) {
            Slog.i(TAG, "Setting enforcing mode");
            SystemProperties.set("persist.selinux.enforcing", mode);
        } else if (mode.equals("0")) {
            Slog.i(TAG, "Tried to set permissive mode, ignoring");
        } else {
            Slog.e(TAG, "Got invalid enforcing mode: " + mode);
        }
    }

    @Override