mahdi
mahdi

Reputation: 862

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

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?

Upvotes: 0

Views: 4055

Answers (2)

Ashok Mutyala
Ashok Mutyala

Reputation: 97

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));
    }

Upvotes: 1

Martin Zeitler
Martin Zeitler

Reputation: 76699

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

Upvotes: 2

Related Questions