List of usage examples for android.content.pm UserInfo isManagedProfile
@UnsupportedAppUsage public boolean isManagedProfile()
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 . jav 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; }