List of usage examples for android.os UserManager getProfiles
@UnsupportedAppUsage public List<UserInfo> getProfiles(@UserIdInt int userHandle)
From source file:com.android.managedprovisioning.ProfileOwnerPreProvisioningActivity.java
/** * @return The User id of an already existing managed profile or -1 if none * exists/*from w w w . j a v a2 s .c o m*/ */ int alreadyHasManagedProfile() { UserManager userManager = (UserManager) getSystemService(Context.USER_SERVICE); List<UserInfo> profiles = userManager.getProfiles(getUserId()); for (UserInfo userInfo : profiles) { if (userInfo.isManagedProfile()) { return userInfo.getUserHandle().getIdentifier(); } } return -1; }