List of usage examples for android.os SELinux isSELinuxEnforced
@UnsupportedAppUsage public static final native boolean isSELinuxEnforced();
From source file:com.android.tv.settings.about.AboutFragment.java
@Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.device_info_settings, null); final PreferenceScreen screen = getPreferenceScreen(); refreshDeviceName();//from ww w. ja va 2 s.com final Preference deviceNamePref = findPreference(KEY_DEVICE_NAME); PreferenceUtils.resolveSystemActivityOrRemove(getActivity(), screen, deviceNamePref, 0); final Preference firmwareVersionPref = findPreference(KEY_FIRMWARE_VERSION); firmwareVersionPref.setSummary(Build.VERSION.RELEASE); firmwareVersionPref.setEnabled(true); final Preference securityPatchPref = findPreference(KEY_SECURITY_PATCH); final String patch = DeviceInfoUtils.getSecurityPatch(); if (!TextUtils.isEmpty(patch)) { securityPatchPref.setSummary(patch); } else { removePreference(securityPatchPref); } final LongClickPreference restartPref = (LongClickPreference) findPreference(KEY_RESTART); restartPref.setLongClickListener(this); findPreference(KEY_BASEBAND_VERSION) .setSummary(getSystemPropertySummary(TelephonyProperties.PROPERTY_BASEBAND_VERSION)); findPreference(KEY_DEVICE_MODEL).setSummary(Build.MODEL + DeviceInfoUtils.getMsvSuffix()); findPreference(KEY_EQUIPMENT_ID).setSummary(getSystemPropertySummary(PROPERTY_EQUIPMENT_ID)); final Preference buildNumberPref = findPreference(KEY_BUILD_NUMBER); buildNumberPref.setSummary(Build.DISPLAY); buildNumberPref.setEnabled(true); findPreference(KEY_KERNEL_VERSION).setSummary(DeviceInfoUtils.getFormattedKernelVersion()); final Preference selinuxPref = findPreference(KEY_SELINUX_STATUS); if (!SELinux.isSELinuxEnabled()) { selinuxPref.setSummary(R.string.selinux_status_disabled); } else if (!SELinux.isSELinuxEnforced()) { selinuxPref.setSummary(R.string.selinux_status_permissive); } // Remove selinux information if property is not present if (TextUtils.isEmpty(SystemProperties.get(PROPERTY_SELINUX_STATUS))) { removePreference(selinuxPref); } // Remove Safety information preference if PROPERTY_URL_SAFETYLEGAL is not set if (TextUtils.isEmpty(SystemProperties.get(PROPERTY_URL_SAFETYLEGAL))) { removePreference(findPreference(KEY_SAFETY_LEGAL)); } // Remove Equipment id preference if FCC ID is not set by RIL if (TextUtils.isEmpty(SystemProperties.get(PROPERTY_EQUIPMENT_ID))) { removePreference(findPreference(KEY_EQUIPMENT_ID)); } // Remove Baseband version if wifi-only device if (isWifiOnly(getActivity())) { removePreference(findPreference(KEY_BASEBAND_VERSION)); } // Dont show feedback option if there is no reporter. if (TextUtils.isEmpty(DeviceInfoUtils.getFeedbackReporterPackage(getActivity()))) { removePreference(findPreference(KEY_DEVICE_FEEDBACK)); } final Preference updateSettingsPref = findPreference(KEY_SYSTEM_UPDATE_SETTINGS); if (mUm.isAdminUser()) { PreferenceUtils.resolveSystemActivityOrRemove(getActivity(), screen, updateSettingsPref, PreferenceUtils.FLAG_SET_TITLE); } else if (updateSettingsPref != null) { // Remove for secondary users removePreference(updateSettingsPref); } // Read platform settings for additional system update setting if (!getResources().getBoolean(R.bool.config_additional_system_update_setting_enable)) { removePreference(findPreference(KEY_UPDATE_SETTING)); } // Remove manual entry if none present. if (!getResources().getBoolean(R.bool.config_show_manual)) { removePreference(findPreference(KEY_MANUAL)); } // Remove regulatory information if none present. final Preference regulatoryPref = findPreference(KEY_REGULATORY_INFO); PreferenceUtils.resolveSystemActivityOrRemove(getActivity(), screen, regulatoryPref, 0); }