Loading src/com/android/settings/WirelessSettings.java +20 −9 Original line number Diff line number Diff line Loading @@ -260,7 +260,9 @@ public class WirelessSettings extends SettingsPreferenceFragment addPreferencesFromResource(R.xml.wireless_settings); final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER; final int myUserId = UserHandle.myUserId(); final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; final boolean isRestrictedUser = mUm.getUserInfo(myUserId).isRestricted(); final Activity activity = getActivity(); mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE); Loading @@ -272,8 +274,13 @@ public class WirelessSettings extends SettingsPreferenceFragment mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam); mSmsApplicationPreference = (AppListPreference) findPreference(KEY_SMS_APPLICATION); // Restricted users cannot currently read/write SMS. if (isRestrictedUser) { removePreference(KEY_SMS_APPLICATION); } else { mSmsApplicationPreference.setOnPreferenceChangeListener(this); initSmsApplicationSetting(); } // Remove NSD checkbox by default getPreferenceScreen().removePreference(nsd); Loading Loading @@ -485,8 +492,11 @@ public class WirelessSettings extends SettingsPreferenceFragment result.add(KEY_TOGGLE_NSD); final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER; final boolean isWimaxEnabled = !isSecondaryUser && context.getResources().getBoolean( final int myUserId = UserHandle.myUserId(); final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; final boolean isRestrictedUser = um.getUserInfo(myUserId).isRestricted(); final boolean isWimaxEnabled = !isSecondaryUser && context.getResources().getBoolean( com.android.internal.R.bool.config_wimaxEnabled); if (!isWimaxEnabled || um.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { Loading @@ -498,7 +508,8 @@ public class WirelessSettings extends SettingsPreferenceFragment } // Remove NFC if not available final NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); final NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); if (manager != null) { NfcAdapter adapter = manager.getDefaultAdapter(); if (adapter == null) { Loading @@ -524,7 +535,7 @@ public class WirelessSettings extends SettingsPreferenceFragment // Remove SMS Application if the device does not support SMS TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (!tm.isSmsCapable()) { if (!tm.isSmsCapable() || isRestrictedUser) { result.add(KEY_SMS_APPLICATION); } Loading @@ -539,8 +550,8 @@ public class WirelessSettings extends SettingsPreferenceFragment result.add(KEY_PROXY_SETTINGS); // Disable Tethering if it's not allowed or if it's a wifi-only device ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (isSecondaryUser || !cm.isTetheringSupported()) { result.add(KEY_TETHER_SETTINGS); } Loading Loading
src/com/android/settings/WirelessSettings.java +20 −9 Original line number Diff line number Diff line Loading @@ -260,7 +260,9 @@ public class WirelessSettings extends SettingsPreferenceFragment addPreferencesFromResource(R.xml.wireless_settings); final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER; final int myUserId = UserHandle.myUserId(); final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; final boolean isRestrictedUser = mUm.getUserInfo(myUserId).isRestricted(); final Activity activity = getActivity(); mAirplaneModePreference = (SwitchPreference) findPreference(KEY_TOGGLE_AIRPLANE); Loading @@ -272,8 +274,13 @@ public class WirelessSettings extends SettingsPreferenceFragment mNfcEnabler = new NfcEnabler(activity, nfc, androidBeam); mSmsApplicationPreference = (AppListPreference) findPreference(KEY_SMS_APPLICATION); // Restricted users cannot currently read/write SMS. if (isRestrictedUser) { removePreference(KEY_SMS_APPLICATION); } else { mSmsApplicationPreference.setOnPreferenceChangeListener(this); initSmsApplicationSetting(); } // Remove NSD checkbox by default getPreferenceScreen().removePreference(nsd); Loading Loading @@ -485,8 +492,11 @@ public class WirelessSettings extends SettingsPreferenceFragment result.add(KEY_TOGGLE_NSD); final UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE); final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER; final boolean isWimaxEnabled = !isSecondaryUser && context.getResources().getBoolean( final int myUserId = UserHandle.myUserId(); final boolean isSecondaryUser = myUserId != UserHandle.USER_OWNER; final boolean isRestrictedUser = um.getUserInfo(myUserId).isRestricted(); final boolean isWimaxEnabled = !isSecondaryUser && context.getResources().getBoolean( com.android.internal.R.bool.config_wimaxEnabled); if (!isWimaxEnabled || um.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) { Loading @@ -498,7 +508,8 @@ public class WirelessSettings extends SettingsPreferenceFragment } // Remove NFC if not available final NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); final NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); if (manager != null) { NfcAdapter adapter = manager.getDefaultAdapter(); if (adapter == null) { Loading @@ -524,7 +535,7 @@ public class WirelessSettings extends SettingsPreferenceFragment // Remove SMS Application if the device does not support SMS TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (!tm.isSmsCapable()) { if (!tm.isSmsCapable() || isRestrictedUser) { result.add(KEY_SMS_APPLICATION); } Loading @@ -539,8 +550,8 @@ public class WirelessSettings extends SettingsPreferenceFragment result.add(KEY_PROXY_SETTINGS); // Disable Tethering if it's not allowed or if it's a wifi-only device ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); if (isSecondaryUser || !cm.isTetheringSupported()) { result.add(KEY_TETHER_SETTINGS); } Loading