Correctly set default restrictions when creating guest
Use restrictions from mGuestRestrictions when creating a guest. Initially
phone calls, SMS and installing from unknown sources is not allowed.
Bug: 25904144
Bug: 25729516
Change-Id: I461c492ad64842d3707f73dfd83b533aa31b63ef
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index ff829ff..b7dfa9b 100644
--- a/services/core/java/com/android/server/pm/UserManagerService.java
+++ b/services/core/java/com/android/server/pm/UserManagerService.java
@@ -648,6 +648,7 @@
private void initDefaultGuestRestrictions() {
synchronized (mGuestRestrictions) {
if (mGuestRestrictions.isEmpty()) {
+ mGuestRestrictions.putBoolean(UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES, true);
mGuestRestrictions.putBoolean(UserManager.DISALLOW_OUTGOING_CALLS, true);
mGuestRestrictions.putBoolean(UserManager.DISALLOW_SMS, true);
}
@@ -1649,6 +1650,11 @@
}
updateUserIds();
Bundle restrictions = new Bundle();
+ if (isGuest) {
+ synchronized (mGuestRestrictions) {
+ restrictions.putAll(mGuestRestrictions);
+ }
+ }
synchronized (mRestrictionsLock) {
mBaseUserRestrictions.append(userId, restrictions);
}