Loading core/java/android/os/IUserManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,12 @@ import android.os.ParcelFileDescriptor; * {@hide} */ interface IUserManager { /* * DO NOT MOVE - UserManager.h depends on the ordering of this function. */ int getCredentialOwnerProfile(int userHandle); UserInfo createUser(in String name, int flags); UserInfo createProfileForUser(in String name, int flags, int userHandle); void setUserEnabled(int userHandle); Loading core/java/android/os/UserManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -1094,6 +1094,22 @@ public class UserManager { return profiles; } /** * Returns the device credential owner id of the profile from * which this method is called, or userHandle if called from a user that * is not a profile. * * @hide */ public int getCredentialOwnerProfile(int userHandle) { try { return mService.getCredentialOwnerProfile(userHandle); } catch (RemoteException re) { Log.w(TAG, "Could not get credential owner", re); return -1; } } /** * Returns the parent of the profile which this method is called from * or null if called from a user that is not a profile. Loading services/core/java/com/android/server/pm/UserManagerService.java +21 −1 Original line number Diff line number Diff line Loading @@ -136,6 +136,11 @@ public class UserManagerService extends IUserManager.Stub { // without first making sure that the rest of the framework is prepared for it. private static final int MAX_MANAGED_PROFILES = 1; /** * Flag indicating whether device credentials are shared among same-user profiles. */ private static final boolean CONFIG_PROFILES_SHARE_CREDENTIAL = true; // Set of user restrictions, which can only be enforced by the system private static final Set<String> SYSTEM_CONTROLLED_RESTRICTIONS = Sets.newArraySet( UserManager.DISALLOW_RECORD_AUDIO); Loading Loading @@ -331,6 +336,21 @@ public class UserManagerService extends IUserManager.Stub { return users; } @Override public int getCredentialOwnerProfile(int userHandle) { checkManageUsersPermission("get the credential owner"); if (CONFIG_PROFILES_SHARE_CREDENTIAL) { synchronized (mPackagesLock) { UserInfo profileParent = getProfileParentLocked(userHandle); if (profileParent != null) { return profileParent.id; } } } return userHandle; } @Override public UserInfo getProfileParent(int userHandle) { checkManageUsersPermission("get the profile parent"); Loading Loading
core/java/android/os/IUserManager.aidl +6 −0 Original line number Diff line number Diff line Loading @@ -27,6 +27,12 @@ import android.os.ParcelFileDescriptor; * {@hide} */ interface IUserManager { /* * DO NOT MOVE - UserManager.h depends on the ordering of this function. */ int getCredentialOwnerProfile(int userHandle); UserInfo createUser(in String name, int flags); UserInfo createProfileForUser(in String name, int flags, int userHandle); void setUserEnabled(int userHandle); Loading
core/java/android/os/UserManager.java +16 −0 Original line number Diff line number Diff line Loading @@ -1094,6 +1094,22 @@ public class UserManager { return profiles; } /** * Returns the device credential owner id of the profile from * which this method is called, or userHandle if called from a user that * is not a profile. * * @hide */ public int getCredentialOwnerProfile(int userHandle) { try { return mService.getCredentialOwnerProfile(userHandle); } catch (RemoteException re) { Log.w(TAG, "Could not get credential owner", re); return -1; } } /** * Returns the parent of the profile which this method is called from * or null if called from a user that is not a profile. Loading
services/core/java/com/android/server/pm/UserManagerService.java +21 −1 Original line number Diff line number Diff line Loading @@ -136,6 +136,11 @@ public class UserManagerService extends IUserManager.Stub { // without first making sure that the rest of the framework is prepared for it. private static final int MAX_MANAGED_PROFILES = 1; /** * Flag indicating whether device credentials are shared among same-user profiles. */ private static final boolean CONFIG_PROFILES_SHARE_CREDENTIAL = true; // Set of user restrictions, which can only be enforced by the system private static final Set<String> SYSTEM_CONTROLLED_RESTRICTIONS = Sets.newArraySet( UserManager.DISALLOW_RECORD_AUDIO); Loading Loading @@ -331,6 +336,21 @@ public class UserManagerService extends IUserManager.Stub { return users; } @Override public int getCredentialOwnerProfile(int userHandle) { checkManageUsersPermission("get the credential owner"); if (CONFIG_PROFILES_SHARE_CREDENTIAL) { synchronized (mPackagesLock) { UserInfo profileParent = getProfileParentLocked(userHandle); if (profileParent != null) { return profileParent.id; } } } return userHandle; } @Override public UserInfo getProfileParent(int userHandle) { checkManageUsersPermission("get the profile parent"); Loading