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

Commit f97faada authored by Benjamin Franz's avatar Benjamin Franz Committed by Android (Google) Code Review
Browse files

Merge "Block user from setting safe boot setting via adb" into nyc-dev

parents adfb20c2 0ff13fce
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1202,6 +1202,11 @@ public class SettingsProvider extends ContentProvider {
                restriction = UserManager.DISALLOW_CONFIG_VPN;
                break;

            case Settings.Global.SAFE_BOOT_DISALLOWED:
                if ("1".equals(value)) return false;
                restriction = UserManager.DISALLOW_SAFE_BOOT;
                break;

            default:
                if (setting != null && setting.startsWith(Settings.Global.DATA_ROAMING)) {
                    if ("0".equals(value)) return false;
+3 −0
Original line number Diff line number Diff line
@@ -330,6 +330,9 @@ public class UserRestrictionsUtils {
        // set, and in that case even if the restriction is lifted, changing it to ON would be
        // wrong.  So just don't do anything in such a case.  If the user hopes to enable location
        // later, they can do it on the Settings UI.
        // WARNING: Remember that Settings.Global and Settings.Secure are changeable via adb.
        // To prevent this from happening for a given user restriction, you have to add a check to
        // SettingsProvider.isGlobalOrSecureSettingRestrictedForUser.

        final ContentResolver cr = context.getContentResolver();
        final long id = Binder.clearCallingIdentity();