Loading core/java/android/os/UserManagerInternal.java +3 −0 Original line number Diff line number Diff line Loading @@ -221,4 +221,7 @@ public abstract class UserManagerInternal { */ public abstract boolean isSettingRestrictedForUser(String setting, int userId, String value, int callingUid); /** @return a specific user restriction that's in effect currently. */ public abstract boolean hasUserRestriction(String restriction, int userId); } services/core/java/com/android/server/pm/InstantAppRegistry.java +1 −1 Original line number Diff line number Diff line Loading @@ -686,7 +686,7 @@ class InstantAppRegistry { // Prune first installed instant apps synchronized (mService.mLock) { allUsers = PackageManagerService.sUserManager.getUserIds(); allUsers = mService.mUserManager.getUserIds(); final int packageCount = mService.mPackages.size(); for (int i = 0; i < packageCount; i++) { Loading services/core/java/com/android/server/pm/PackageManagerService.java +224 −171 File changed.Preview size limit exceeded, changes collapsed. Show changes services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +5 −2 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.os.Process; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManagerInternal; import android.service.pm.PackageServiceDumpProto; import android.system.ErrnoException; import android.system.Os; Loading Loading @@ -375,10 +376,12 @@ public class PackageManagerServiceUtils { } } public static void enforceShellRestriction(String restriction, int callingUid, int userHandle) { /** Enforces that if the caller is shell, it does not have the provided user restriction. */ public static void enforceShellRestriction( UserManagerInternal userManager, String restriction, int callingUid, int userHandle) { if (callingUid == Process.SHELL_UID) { if (userHandle >= 0 && PackageManagerService.sUserManager.hasUserRestriction( && userManager.hasUserRestriction( restriction, userHandle)) { throw new SecurityException("Shell does not have permission to access user " + userHandle); Loading services/core/java/com/android/server/pm/UserManagerService.java +10 −5 Original line number Diff line number Diff line Loading @@ -1557,11 +1557,7 @@ public class UserManagerService extends IUserManager.Stub { /** @return a specific user restriction that's in effect currently. */ @Override public boolean hasUserRestriction(String restrictionKey, int userId) { if (!UserRestrictionsUtils.isValidRestriction(restrictionKey)) { return false; } Bundle restrictions = getEffectiveUserRestrictions(userId); return restrictions != null && restrictions.getBoolean(restrictionKey); return mLocalService.hasUserRestriction(restrictionKey, userId); } /** @return if any user has the given restriction. */ Loading Loading @@ -4128,6 +4124,15 @@ public class UserManagerService extends IUserManager.Stub { return UserRestrictionsUtils.isSettingRestrictedForUser(mContext, setting, userId, value, callingUid); } @Override public boolean hasUserRestriction(String restrictionKey, int userId) { if (!UserRestrictionsUtils.isValidRestriction(restrictionKey)) { return false; } Bundle restrictions = getEffectiveUserRestrictions(userId); return restrictions != null && restrictions.getBoolean(restrictionKey); } } /* Remove all the users except of the system one. */ Loading Loading
core/java/android/os/UserManagerInternal.java +3 −0 Original line number Diff line number Diff line Loading @@ -221,4 +221,7 @@ public abstract class UserManagerInternal { */ public abstract boolean isSettingRestrictedForUser(String setting, int userId, String value, int callingUid); /** @return a specific user restriction that's in effect currently. */ public abstract boolean hasUserRestriction(String restriction, int userId); }
services/core/java/com/android/server/pm/InstantAppRegistry.java +1 −1 Original line number Diff line number Diff line Loading @@ -686,7 +686,7 @@ class InstantAppRegistry { // Prune first installed instant apps synchronized (mService.mLock) { allUsers = PackageManagerService.sUserManager.getUserIds(); allUsers = mService.mUserManager.getUserIds(); final int packageCount = mService.mPackages.size(); for (int i = 0; i < packageCount; i++) { Loading
services/core/java/com/android/server/pm/PackageManagerService.java +224 −171 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/core/java/com/android/server/pm/PackageManagerServiceUtils.java +5 −2 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ import android.os.Process; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; import android.os.UserManagerInternal; import android.service.pm.PackageServiceDumpProto; import android.system.ErrnoException; import android.system.Os; Loading Loading @@ -375,10 +376,12 @@ public class PackageManagerServiceUtils { } } public static void enforceShellRestriction(String restriction, int callingUid, int userHandle) { /** Enforces that if the caller is shell, it does not have the provided user restriction. */ public static void enforceShellRestriction( UserManagerInternal userManager, String restriction, int callingUid, int userHandle) { if (callingUid == Process.SHELL_UID) { if (userHandle >= 0 && PackageManagerService.sUserManager.hasUserRestriction( && userManager.hasUserRestriction( restriction, userHandle)) { throw new SecurityException("Shell does not have permission to access user " + userHandle); Loading
services/core/java/com/android/server/pm/UserManagerService.java +10 −5 Original line number Diff line number Diff line Loading @@ -1557,11 +1557,7 @@ public class UserManagerService extends IUserManager.Stub { /** @return a specific user restriction that's in effect currently. */ @Override public boolean hasUserRestriction(String restrictionKey, int userId) { if (!UserRestrictionsUtils.isValidRestriction(restrictionKey)) { return false; } Bundle restrictions = getEffectiveUserRestrictions(userId); return restrictions != null && restrictions.getBoolean(restrictionKey); return mLocalService.hasUserRestriction(restrictionKey, userId); } /** @return if any user has the given restriction. */ Loading Loading @@ -4128,6 +4124,15 @@ public class UserManagerService extends IUserManager.Stub { return UserRestrictionsUtils.isSettingRestrictedForUser(mContext, setting, userId, value, callingUid); } @Override public boolean hasUserRestriction(String restrictionKey, int userId) { if (!UserRestrictionsUtils.isValidRestriction(restrictionKey)) { return false; } Bundle restrictions = getEffectiveUserRestrictions(userId); return restrictions != null && restrictions.getBoolean(restrictionKey); } } /* Remove all the users except of the system one. */ Loading