summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fyodor Kupolov <fkupolov@google.com> 2015-11-30 15:02:53 -0800
committer Fyodor Kupolov <fkupolov@google.com> 2015-11-30 17:22:20 -0800
commite04462caa46803c64dac5107a8d7b07894e23b9d (patch)
tree692e1fbb5a843717e5bad41d3b0c77fa649464d3
parent21942b2240858de639ed0f727ac03f83fa8ab761 (diff)
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
-rw-r--r--core/java/android/os/UserManager.java3
-rw-r--r--services/core/java/com/android/server/pm/UserManagerService.java6
2 files changed, 6 insertions, 3 deletions
diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java
index 0a149bbac713..f26693c853fb 100644
--- a/core/java/android/os/UserManager.java
+++ b/core/java/android/os/UserManager.java
@@ -929,9 +929,6 @@ public class UserManager {
if (guest != null) {
Settings.Secure.putStringForUser(context.getContentResolver(),
Settings.Secure.SKIP_FIRST_USE_HINTS, "1", guest.id);
-
- mService.setUserRestriction(DISALLOW_SMS, true, guest.id);
- mService.setUserRestriction(DISALLOW_INSTALL_UNKNOWN_SOURCES, true, guest.id);
}
} catch (RemoteException re) {
Log.w(TAG, "Could not create a user", re);
diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java
index ff829ff321d5..b7dfa9b054b8 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 @@ public class UserManagerService extends IUserManager.Stub {
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 @@ public class UserManagerService extends IUserManager.Stub {
}
updateUserIds();
Bundle restrictions = new Bundle();
+ if (isGuest) {
+ synchronized (mGuestRestrictions) {
+ restrictions.putAll(mGuestRestrictions);
+ }
+ }
synchronized (mRestrictionsLock) {
mBaseUserRestrictions.append(userId, restrictions);
}