android:fragment="com.android.settings.TetherSettings"
android:key="tether_settings"
android:title="@string/tether_settings_title_all"
+ settings:userRestriction="no_config_tethering"
settings:useAdminDisabledSummary="true" />
<com.android.settingslib.RestrictedPreference
android:fragment="com.android.settings.vpn2.VpnSettings"
android:key="vpn_settings"
android:title="@string/vpn_settings_title"
+ settings:userRestriction="no_config_vpn"
settings:useAdminDisabledSummary="true" />
- <PreferenceScreen
+ <com.android.settingslib.RestrictedPreference
android:key="mobile_network_settings"
android:title="@string/network_settings_title"
settings:keywords="@string/keywords_more_mobile_networks"
+ settings:userRestriction="no_config_mobile_networks"
+ settings:useAdminDisabledSummary="true"
android:dependency="toggle_airplane">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.phone"
android:targetClass="com.android.phone.MobileNetworkSettings" />
- </PreferenceScreen>
+ </com.android.settingslib.RestrictedPreference>
- <Preference
+ <com.android.settingslib.RestrictedPreference
android:key="manage_mobile_plan"
android:title="@string/manage_mobile_plan_title"
- android:persistent="false" />
+ android:persistent="false"
+ settings:userRestriction="no_config_mobile_networks"
+ settings:useAdminDisabledSummary="true" />
- <PreferenceScreen
+ <com.android.settingslib.RestrictedPreference
android:key="wimax_settings"
- android:title="@string/wimax_settings" >
+ android:title="@string/wimax_settings"
+ settings:userRestriction="no_config_mobile_networks"
+ settings:useAdminDisabledSummary="true">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings.wimax"
android:targetClass="com.android.settings.wimax.WimaxSettings" />
- </PreferenceScreen>
+ </com.android.settingslib.RestrictedPreference>
<PreferenceScreen
android:fragment="com.android.settings.ProxySelector"
import com.android.settings.nfc.NfcEnabler;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.search.Indexable;
+import com.android.settingslib.RestrictedLockUtils;
import com.android.settingslib.RestrictedPreference;
import java.util.ArrayList;
//enable/disable wimax depending on the value in config.xml
final boolean isWimaxEnabled = isAdmin && this.getResources().getBoolean(
com.android.internal.R.bool.config_wimaxEnabled);
- if (!isWimaxEnabled
- || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
+ if (!isWimaxEnabled) {
PreferenceScreen root = getPreferenceScreen();
Preference ps = findPreference(KEY_WIMAX_SETTINGS);
if (ps != null) root.removePreference(ps);
}
// Remove Mobile Network Settings and Manage Mobile Plan for secondary users,
- // if it's a wifi-only device, or if the settings are restricted.
- if (!isAdmin || Utils.isWifiOnly(getActivity())
- || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
+ // if it's a wifi-only device.
+ if (!isAdmin || Utils.isWifiOnly(getActivity())) {
removePreference(KEY_MOBILE_NETWORK_SETTINGS);
removePreference(KEY_MANAGE_MOBILE_PLAN);
}
final ConnectivityManager cm =
(ConnectivityManager) activity.getSystemService(Context.CONNECTIVITY_SERVICE);
- if (!isAdmin || !cm.isTetheringSupported()) {
+ final boolean adminDisallowedTetherConfig = mUm.hasUserRestriction(
+ UserManager.DISALLOW_CONFIG_TETHERING);
+ if (!isAdmin || (!cm.isTetheringSupported() && !adminDisallowedTetherConfig)) {
getPreferenceScreen().removePreference(findPreference(KEY_TETHER_SETTINGS));
- } else if (!mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_TETHERING)) {
+ } else if (!adminDisallowedTetherConfig) {
Preference p = findPreference(KEY_TETHER_SETTINGS);
p.setTitle(com.android.settingslib.Utils.getTetheringLabel(cm));
} else {
removePreference(KEY_WFC_SETTINGS);
}
-
- RestrictedPreference tetherSettingsPref = (RestrictedPreference) findPreference(
- KEY_TETHER_SETTINGS);
- if (tetherSettingsPref != null) {
- tetherSettingsPref.checkRestrictionAndSetDisabled(
- UserManager.DISALLOW_CONFIG_TETHERING);
- }
-
- RestrictedPreference vpnSettingsPref = (RestrictedPreference) findPreference(
- KEY_VPN_SETTINGS);
- if (vpnSettingsPref != null) {
- vpnSettingsPref.checkRestrictionAndSetDisabled(UserManager.DISALLOW_CONFIG_VPN);
- }
}
@Override
final boolean isWimaxEnabled = !isSecondaryUser
&& context.getResources().getBoolean(
com.android.internal.R.bool.config_wimaxEnabled);
- if (!isWimaxEnabled
- || um.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
+ if (!isWimaxEnabled) {
result.add(KEY_WIMAX_SETTINGS);
}