Is it possible to enable android multi-user from adb?

2.7k views Asked by At

As stated in the official document, it is possible to enable android multiple user feature at build time, but there is no document about enabling it on an exiting android image. Is there a way to enable multi-user on an existing device (e.g. using adb) considering that root access is available?

2

There are 2 answers

0
Martin Zeitler On BEST ANSWER

One can edit /system/build.prop on a rooted device and add multi-user support, then reboot:

fw.max_users=3
fw.show_multiuserui=1
5
Ashok Mutyala On

Setting the property fw.max_users to your desired value can enable multi-user support. Something like setprop fw.max_users $MAX_USERS. Actually android itself reads this property to know if the device supports multi-user or not. You can refer to UserManger source code to find how android reads the maximum number of users. The following snippet is copied from UserManager source:

     /**
     * Returns the maximum number of users that can be created on this device.
 A return value of 1 means that it is a single user device.
     * @hide
     * @return a value greater than or equal to 1
     */

    @UnsupportedAppUsage
    public static int getMaxSupportedUsers() {
        // Don't allow multiple users on certain builds
        if (android.os.Build.ID.startsWith("JVP")) return 1;
        return SystemProperties.getInt("fw.max_users",
                Resources.getSystem().getInteger(R.integer.config_multiuserMaximumUsers));
    }