Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c395b9f3 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Don't show SMS app settings for restricted profiles" into lmp-mr1-dev

parents c01754ba 32505ac6
Loading
Loading
Loading
Loading
+20 −9
Original line number Diff line number Diff line
@@ -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);
@@ -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);
@@ -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)) {
@@ -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) {
@@ -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);
                }

@@ -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);
                }