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

Commit 96a25b80 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Don't allow user creation intent to work on non-admin users

Only allow admin users to create users using an intent.

Bug: 26692650
Change-Id: Iadcc9843baa6996dcc6e662604dfcc8238e7f35b
parent 026869ee
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.content.pm.UserInfo;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.Log;

@@ -91,7 +92,8 @@ public class ConfirmUserCreationActivity extends AlertActivity
        }
        final String message;
        // Check the user restrictions
        boolean cantCreateUser = mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER);
        boolean cantCreateUser = mUserManager.hasUserRestriction(UserManager.DISALLOW_ADD_USER)
                || !mUserManager.isAdminUser();
        // Check the system state and user count
        boolean cantCreateAnyMoreUsers = !mUserManager.canAddMoreUsers();
        // Check the account existence