Put disallow-safe-boot restriction to system settings
to make it accessible during boot.
BUG: 26251884
Change-Id: I1dee58dfc2aa746e0e97a6675c611c6e313ec91c
diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
index 4b355de62..364e9fa6 100644
--- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
+++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java
@@ -425,6 +425,18 @@
}
}
}
+ break;
+ case UserManager.DISALLOW_SAFE_BOOT:
+ // Unlike with the other restrictions, we want to propagate the new value to
+ // the system settings even if it is false. The other restrictions modify
+ // settings which could be manually changed by the user from the Settings app
+ // after the policies enforcing these restrictions have been revoked, so we
+ // leave re-setting of those settings to the user.
+ android.provider.Settings.Global.putInt(
+ context.getContentResolver(),
+ android.provider.Settings.Global.SAFE_BOOT_DISALLOWED,
+ newValue ? 1 : 0);
+ break;
}
} finally {
Binder.restoreCallingIdentity(id);