Loading core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -85,4 +85,5 @@ interface IUserManager { boolean isDemoUser(int userId); UserInfo createProfileForUserEvenWhenDisallowed(in String name, int flags, int userHandle, in String[] disallowedPackages); boolean isUserUnlockingOrUnlocked(int userId); } core/java/android/os/UserManager.java +1 −3 Original line number Diff line number Diff line Loading @@ -1094,10 +1094,8 @@ public class UserManager { /** {@hide} */ public boolean isUserUnlockingOrUnlocked(@UserIdInt int userId) { // TODO Switch to using UMS internal isUserUnlockingOrUnlocked try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKING_OR_UNLOCKED); return mService.isUserUnlockingOrUnlocked(userId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } Loading services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +2 −7 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManagerInternal; import android.provider.Settings; import android.text.TextUtils; import android.text.TextUtils.SimpleStringSplitter; Loading Loading @@ -1301,14 +1302,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { private void updateServicesLocked(UserState userState) { Map<ComponentName, Service> componentNameToServiceMap = userState.mComponentNameToServiceMap; boolean isUnlockingOrUnlocked; final long identity = Binder.clearCallingIdentity(); try { isUnlockingOrUnlocked = mContext.getSystemService(UserManager.class) boolean isUnlockingOrUnlocked = LocalServices.getService(UserManagerInternal.class) .isUserUnlockingOrUnlocked(userState.mUserId); } finally { Binder.restoreCallingIdentity(identity); } for (int i = 0, count = userState.mInstalledServices.size(); i < count; i++) { AccessibilityServiceInfo installedService = userState.mInstalledServices.get(i); Loading services/core/java/com/android/server/pm/UserManagerService.java +16 −12 Original line number Diff line number Diff line Loading @@ -673,12 +673,6 @@ public class UserManagerService extends IUserManager.Stub { public boolean isSameProfileGroup(int userId, int otherUserId) { if (userId == otherUserId) return true; checkManageUsersPermission("check if in the same profile group"); synchronized (mPackagesLock) { return isSameProfileGroupLP(userId, otherUserId); } } private boolean isSameProfileGroupLP(int userId, int otherUserId) { synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); if (userInfo == null || userInfo.profileGroupId == UserInfo.NO_PROFILE_GROUP_ID) { Loading Loading @@ -880,20 +874,30 @@ public class UserManagerService extends IUserManager.Stub { public boolean isManagedProfile(int userId) { int callingUserId = UserHandle.getCallingUserId(); if (callingUserId != userId && !hasManageUsersPermission()) { synchronized (mPackagesLock) { if (!isSameProfileGroupLP(callingUserId, userId)) { if (!isSameProfileGroup(callingUserId, userId)) { throw new SecurityException( "You need MANAGE_USERS permission to: check if specified user a " + "managed profile outside your profile group"); } } } synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isManagedProfile(); } } @Override public boolean isUserUnlockingOrUnlocked(int userId) { int callingUserId = UserHandle.getCallingUserId(); if (callingUserId != userId && !hasManageUsersPermission()) { if (!isSameProfileGroup(callingUserId, userId)) { throw new SecurityException( "You need MANAGE_USERS permission to: check isUserUnlockingOrUnlocked"); } } return mLocalService.isUserUnlockingOrUnlocked(userId); } @Override public boolean isDemoUser(int userId) { int callingUserId = UserHandle.getCallingUserId(); Loading Loading
core/java/android/os/IUserManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -85,4 +85,5 @@ interface IUserManager { boolean isDemoUser(int userId); UserInfo createProfileForUserEvenWhenDisallowed(in String name, int flags, int userHandle, in String[] disallowedPackages); boolean isUserUnlockingOrUnlocked(int userId); }
core/java/android/os/UserManager.java +1 −3 Original line number Diff line number Diff line Loading @@ -1094,10 +1094,8 @@ public class UserManager { /** {@hide} */ public boolean isUserUnlockingOrUnlocked(@UserIdInt int userId) { // TODO Switch to using UMS internal isUserUnlockingOrUnlocked try { return ActivityManagerNative.getDefault().isUserRunning(userId, ActivityManager.FLAG_AND_UNLOCKING_OR_UNLOCKED); return mService.isUserUnlockingOrUnlocked(userId); } catch (RemoteException re) { throw re.rethrowFromSystemServer(); } Loading
services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +2 −7 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManagerInternal; import android.provider.Settings; import android.text.TextUtils; import android.text.TextUtils.SimpleStringSplitter; Loading Loading @@ -1301,14 +1302,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { private void updateServicesLocked(UserState userState) { Map<ComponentName, Service> componentNameToServiceMap = userState.mComponentNameToServiceMap; boolean isUnlockingOrUnlocked; final long identity = Binder.clearCallingIdentity(); try { isUnlockingOrUnlocked = mContext.getSystemService(UserManager.class) boolean isUnlockingOrUnlocked = LocalServices.getService(UserManagerInternal.class) .isUserUnlockingOrUnlocked(userState.mUserId); } finally { Binder.restoreCallingIdentity(identity); } for (int i = 0, count = userState.mInstalledServices.size(); i < count; i++) { AccessibilityServiceInfo installedService = userState.mInstalledServices.get(i); Loading
services/core/java/com/android/server/pm/UserManagerService.java +16 −12 Original line number Diff line number Diff line Loading @@ -673,12 +673,6 @@ public class UserManagerService extends IUserManager.Stub { public boolean isSameProfileGroup(int userId, int otherUserId) { if (userId == otherUserId) return true; checkManageUsersPermission("check if in the same profile group"); synchronized (mPackagesLock) { return isSameProfileGroupLP(userId, otherUserId); } } private boolean isSameProfileGroupLP(int userId, int otherUserId) { synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); if (userInfo == null || userInfo.profileGroupId == UserInfo.NO_PROFILE_GROUP_ID) { Loading Loading @@ -880,20 +874,30 @@ public class UserManagerService extends IUserManager.Stub { public boolean isManagedProfile(int userId) { int callingUserId = UserHandle.getCallingUserId(); if (callingUserId != userId && !hasManageUsersPermission()) { synchronized (mPackagesLock) { if (!isSameProfileGroupLP(callingUserId, userId)) { if (!isSameProfileGroup(callingUserId, userId)) { throw new SecurityException( "You need MANAGE_USERS permission to: check if specified user a " + "managed profile outside your profile group"); } } } synchronized (mUsersLock) { UserInfo userInfo = getUserInfoLU(userId); return userInfo != null && userInfo.isManagedProfile(); } } @Override public boolean isUserUnlockingOrUnlocked(int userId) { int callingUserId = UserHandle.getCallingUserId(); if (callingUserId != userId && !hasManageUsersPermission()) { if (!isSameProfileGroup(callingUserId, userId)) { throw new SecurityException( "You need MANAGE_USERS permission to: check isUserUnlockingOrUnlocked"); } } return mLocalService.isUserUnlockingOrUnlocked(userId); } @Override public boolean isDemoUser(int userId) { int callingUserId = UserHandle.getCallingUserId(); Loading