BinTianqi/OwnDroid

Create multiple/unlimited, clone users

Closed this issue · 1 comments

Type android.os.usertype.profile.CLONE
Please provide support

I will not provide support for it.

UserManager#USER_TYPE_PROFILE_CLONE

@SystemApi
public static final String USER_TYPE_PROFILE_CLONE = "android.os.usertype.profile.CLONE";

UserManager#createProfileForUser

/**
* Creates a user with the specified name and options as a profile of another user.
*
* @param name the user's name
* @param userType the type of user, such as {@link UserManager#USER_TYPE_PROFILE_MANAGED}.
* @param flags UserInfo flags that specify user properties.
* @param userId new user will be a profile of this user.
*
* @return the {@link UserInfo} object for the created user, or null if the user could not be created.
* @hide
*/
@RequiresPermission(anyOf = {Manifest.permission.MANAGE_USERS, Manifest.permission.CREATE_USERS})
public @Nullable UserInfo createProfileForUser(String name, @NonNull String userType, @UserInfoFlag int flags, @UserIdInt int userId) {
    return createProfileForUser(name, userType, flags, userId, null);
}
  1. Android SDK don't provide it for me, because this method is a hidden system API. That is to say, only system apps can call this method.
  2. This function is belonged to UserManager, not DevicePolicyManager, I won't dig into it.

If you want to create mutiple/unlimited users with OwnDroid, you can activate OwnDroid as Device owner, then create managed users in User manager.