Merge "Add padlocks to more preferences in wireless settings."

This commit is contained in:
Sudheer Shanka
2016-01-27 15:15:06 +00:00
committed by Android (Google) Code Review
2 changed files with 24 additions and 29 deletions

View File

@@ -45,38 +45,46 @@
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"

View File

@@ -51,6 +51,7 @@ import com.android.internal.telephony.TelephonyProperties;
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;
@@ -241,8 +242,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
//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);
@@ -284,9 +284,8 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
}
// 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);
}
@@ -318,9 +317,11 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
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));
@@ -349,19 +350,6 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
} 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
@@ -421,8 +409,7 @@ public class WirelessSettings extends SettingsPreferenceFragment implements Inde
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);
}