Commits

Robert Craig committed 282761e

Correctly display current selinux/mmac states.

Allow the app to determine enforcement states based
off the direct JNI or SELlinuxMMAC calls.

Signed-off-by: Robert Craig <rpcraig@tycho.ncsc.mil>

Comments (0)

Files changed (2)

src/com/android/seandroid_admin/MMACFragment.java

 package com.android.seandroid_admin;
 
 import android.app.admin.DevicePolicyManager;
+import android.content.pm.SELinuxMMAC;
 import android.os.Bundle;
 import android.preference.CheckBoxPreference;
 import android.preference.Preference;
         
         if (mAdmin.isMMACadmin) {
             mMMACenforceCheckbox.setEnabled(true);
-            mMMACenforceCheckbox.setChecked(mAdmin.isEnforcingMMAC);
-            if (mAdmin.isEnforcingMMAC) {
+            boolean systemState = SELinuxMMAC.getEnforcingMode();
+            mMMACenforceCheckbox.setChecked(systemState);
+            if (systemState) {
                 mMMACenforceCheckbox.setSummary(mMMACenforceCheckboxSummaryChecked);
             } else {
                 mMMACenforceCheckbox.setSummary(mMMACenforceCheckboxSummaryUnchecked);

src/com/android/seandroid_admin/SELinuxEnforcingFragment.java

                     //XXX To do small text, will need to define own xml layout
                     CheckBoxPreference pref = new CheckBoxPreference(mActivity);
                     pref.setTitle(name);
-                    pref.setChecked(mAdmin.mDPM.getSELinuxBooleanValue(mAdmin.mDeviceAdmin, name));
+                    pref.setChecked(SELinux.getBooleanValue(name));
                     pref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
                         @Override
                         public boolean onPreferenceChange(Preference preference, Object newValue) {
 
         if (mAdmin.isSELinuxAdmin) {
             mSELinuxEnforceCheckbox.setEnabled(true);
-            mSELinuxEnforceCheckbox.setChecked(mAdmin.isEnforcingSELinux);
-            if (mAdmin.isEnforcingSELinux) {
+            boolean systemState = SELinux.isSELinuxEnforced();
+            mSELinuxEnforceCheckbox.setChecked(systemState);
+            if (systemState) {
                 mSELinuxEnforceCheckbox.setSummary(mSELinuxEnforceCheckboxSummaryChecked);
             } else {
                 mSELinuxEnforceCheckbox.setSummary(mSELinuxEnforceCheckboxSummaryUnchecked);