Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -23381,6 +23381,7 @@ package android.os { method public android.os.Bundle getApplicationRestrictions(java.lang.String); method public long getSerialNumberForUser(android.os.UserHandle); method public int getUserCount(); method public long getUserCreationTime(int); method public android.os.UserHandle getUserForSerialNumber(long); method public java.lang.String getUserName(); method public java.util.List<android.os.UserHandle> getUserProfiles(); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25264,6 +25264,7 @@ package android.os { method public android.os.Bundle getApplicationRestrictions(java.lang.String); method public long getSerialNumberForUser(android.os.UserHandle); method public int getUserCount(); method public long getUserCreationTime(int); method public android.os.UserHandle getUserForSerialNumber(long); method public java.lang.String getUserName(); method public java.util.List<android.os.UserHandle> getUserProfiles(); core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ interface IUserManager { List<UserInfo> getProfiles(int userHandle, boolean enabledOnly); UserInfo getProfileParent(int userHandle); UserInfo getUserInfo(int userHandle); long getUserCreationTime(int userHandle); boolean isRestricted(); int getUserSerialNumber(int userHandle); int getUserHandle(int userSerialNumber); Loading core/java/android/os/UserManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -1320,4 +1320,19 @@ public class UserManager { } return new Bundle(); } /** * Returns creation time of the user or of a managed profile associated with the calling user. * @param userHandle user handle of the user or a managed profile associated with the * calling user. * @return creation time in milliseconds since Epoch time. */ public long getUserCreationTime(int userHandle) { try { return mService.getUserCreationTime(userHandle); } catch (RemoteException re) { Log.w(TAG, "Could not get user creation time", re); return 0; } } } services/core/java/com/android/server/pm/UserManagerService.java +35 −10 Original line number Diff line number Diff line Loading @@ -327,6 +327,11 @@ public class UserManagerService extends IUserManager.Stub { public UserInfo getProfileParent(int userHandle) { checkManageUsersPermission("get the profile parent"); synchronized (mPackagesLock) { return getProfileParentLocked(userHandle); } } private UserInfo getProfileParentLocked(int userHandle) { UserInfo profile = getUserInfoLocked(userHandle); if (profile == null) { return null; Loading @@ -338,7 +343,6 @@ public class UserManagerService extends IUserManager.Stub { return getUserInfoLocked(parentUserId); } } } private boolean isProfileOf(UserInfo user, UserInfo profile) { return user.id == profile.id || Loading Loading @@ -1867,6 +1871,27 @@ public class UserManagerService extends IUserManager.Stub { } } @Override public long getUserCreationTime(int userHandle) { int callingUserId = UserHandle.getCallingUserId(); UserInfo userInfo = null; synchronized (mPackagesLock) { if (callingUserId == userHandle) { userInfo = getUserInfoLocked(userHandle); } else { UserInfo parent = getProfileParentLocked(userHandle); if (parent != null && parent.id == callingUserId) { userInfo = getUserInfoLocked(userHandle); } } } if (userInfo == null) { throw new SecurityException("userHandle can only be the calling user or a managed " + "profile associated with this user"); } return userInfo.creationTime; } /** * Caches the list of user ids in an array, adjusting the array size when necessary. */ Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -23381,6 +23381,7 @@ package android.os { method public android.os.Bundle getApplicationRestrictions(java.lang.String); method public long getSerialNumberForUser(android.os.UserHandle); method public int getUserCount(); method public long getUserCreationTime(int); method public android.os.UserHandle getUserForSerialNumber(long); method public java.lang.String getUserName(); method public java.util.List<android.os.UserHandle> getUserProfiles();
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -25264,6 +25264,7 @@ package android.os { method public android.os.Bundle getApplicationRestrictions(java.lang.String); method public long getSerialNumberForUser(android.os.UserHandle); method public int getUserCount(); method public long getUserCreationTime(int); method public android.os.UserHandle getUserForSerialNumber(long); method public java.lang.String getUserName(); method public java.util.List<android.os.UserHandle> getUserProfiles();
core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ interface IUserManager { List<UserInfo> getProfiles(int userHandle, boolean enabledOnly); UserInfo getProfileParent(int userHandle); UserInfo getUserInfo(int userHandle); long getUserCreationTime(int userHandle); boolean isRestricted(); int getUserSerialNumber(int userHandle); int getUserHandle(int userSerialNumber); Loading
core/java/android/os/UserManager.java +15 −0 Original line number Diff line number Diff line Loading @@ -1320,4 +1320,19 @@ public class UserManager { } return new Bundle(); } /** * Returns creation time of the user or of a managed profile associated with the calling user. * @param userHandle user handle of the user or a managed profile associated with the * calling user. * @return creation time in milliseconds since Epoch time. */ public long getUserCreationTime(int userHandle) { try { return mService.getUserCreationTime(userHandle); } catch (RemoteException re) { Log.w(TAG, "Could not get user creation time", re); return 0; } } }
services/core/java/com/android/server/pm/UserManagerService.java +35 −10 Original line number Diff line number Diff line Loading @@ -327,6 +327,11 @@ public class UserManagerService extends IUserManager.Stub { public UserInfo getProfileParent(int userHandle) { checkManageUsersPermission("get the profile parent"); synchronized (mPackagesLock) { return getProfileParentLocked(userHandle); } } private UserInfo getProfileParentLocked(int userHandle) { UserInfo profile = getUserInfoLocked(userHandle); if (profile == null) { return null; Loading @@ -338,7 +343,6 @@ public class UserManagerService extends IUserManager.Stub { return getUserInfoLocked(parentUserId); } } } private boolean isProfileOf(UserInfo user, UserInfo profile) { return user.id == profile.id || Loading Loading @@ -1867,6 +1871,27 @@ public class UserManagerService extends IUserManager.Stub { } } @Override public long getUserCreationTime(int userHandle) { int callingUserId = UserHandle.getCallingUserId(); UserInfo userInfo = null; synchronized (mPackagesLock) { if (callingUserId == userHandle) { userInfo = getUserInfoLocked(userHandle); } else { UserInfo parent = getProfileParentLocked(userHandle); if (parent != null && parent.id == callingUserId) { userInfo = getUserInfoLocked(userHandle); } } } if (userInfo == null) { throw new SecurityException("userHandle can only be the calling user or a managed " + "profile associated with this user"); } return userInfo.creationTime; } /** * Caches the list of user ids in an array, adjusting the array size when necessary. */ Loading