Commits

Stephen Smalley  committed 511a075 Merge

Merge from rpcraig into intent_mac

  • Participants
  • Parent commits 3a16f83, 8939803
  • Branches intent_mac

Comments (0)

Files changed (2)

File 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;
                 public boolean onPreferenceClick(Preference preference) {
                     Log.v(TAG, "Reload of Intent policy requested");
                     try {
-                        byte[] policy = FileUtils.readFileToByteArray(mIntentPolicyFile);
+                        byte[] policy = Files.toByteArray(mIntentPolicyFile);
                         if (!mAdmin.mDPM.setCustomPolicyFile(mAdmin.mDeviceAdmin,
                                 DevicePolicyManager.INTENT_POLICY_FILE, policy)) {
                             Toast.makeText(mActivity, "Unable to set policy", Toast.LENGTH_SHORT).show();
                 public boolean onPreferenceClick(Preference preference) {
                     Log.v(TAG, "Reload of MMAC types requested");
                     try {
-                        byte[] policy = FileUtils.readFileToByteArray(mTypesPolicyFile);
+                        byte[] policy = Files.toByteArray(mTypesPolicyFile);
                         if (!mAdmin.mDPM.setCustomPolicyFile(mAdmin.mDeviceAdmin,
                                 DevicePolicyManager.MMAC_TYPES_FILE, policy)) {
                             Toast.makeText(mActivity, "Unable to set policy", Toast.LENGTH_SHORT).show();
         
         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);

File 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);