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

Commit e04462ca authored by Fyodor Kupolov's avatar Fyodor Kupolov
Browse files

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
parent 21942b22
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -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);
+6 −0
Original line number Diff line number Diff line
@@ -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);
            }