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

Commit 8286a6d8 authored by Fyodor Kupolov's avatar Fyodor Kupolov Committed by Android (Google) Code Review
Browse files

Merge "Correctly set default restrictions when creating guest"

parents a0a8ae46 e04462ca
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
@@ -652,6 +652,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);
            }
@@ -1652,6 +1653,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);
            }