Loading core/java/android/app/admin/DevicePolicyManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -1690,16 +1690,16 @@ public class DevicePolicyManager { * user. Also, this method must be called before the user has been used for the first time. * @param packageName the package name of the application to be registered as profile owner. * @param ownerName the human readable name of the organisation associated with this DPM. * @param userHandle the userId to set the profile owner for. * @return whether the package was successfully registered as the profile owner. * @throws IllegalArgumentException if packageName is null, the package isn't installed, or * the user has already been set up. */ public boolean setProfileOwner(String packageName, String ownerName) public boolean setProfileOwner(String packageName, String ownerName, int userHandle) throws IllegalArgumentException { if (mService != null) { try { return mService.setProfileOwner(packageName, ownerName, Process.myUserHandle().getIdentifier()); return mService.setProfileOwner(packageName, ownerName, userHandle); } catch (RemoteException re) { Log.w(TAG, "Failed to set profile owner", re); throw new IllegalArgumentException("Couldn't set profile owner.", re); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +8 −0 Original line number Diff line number Diff line Loading @@ -2830,6 +2830,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return false; } mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null); UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); if (um.getUserInfo(userHandle) == null) { // User doesn't exist. throw new IllegalArgumentException( "Attempted to set profile owner for invalid userId: " + userHandle); } if (packageName == null || !DeviceOwner.isInstalledForUser(packageName, userHandle)) { throw new IllegalArgumentException("Package name " + packageName Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +3 −3 Original line number Diff line number Diff line Loading @@ -1690,16 +1690,16 @@ public class DevicePolicyManager { * user. Also, this method must be called before the user has been used for the first time. * @param packageName the package name of the application to be registered as profile owner. * @param ownerName the human readable name of the organisation associated with this DPM. * @param userHandle the userId to set the profile owner for. * @return whether the package was successfully registered as the profile owner. * @throws IllegalArgumentException if packageName is null, the package isn't installed, or * the user has already been set up. */ public boolean setProfileOwner(String packageName, String ownerName) public boolean setProfileOwner(String packageName, String ownerName, int userHandle) throws IllegalArgumentException { if (mService != null) { try { return mService.setProfileOwner(packageName, ownerName, Process.myUserHandle().getIdentifier()); return mService.setProfileOwner(packageName, ownerName, userHandle); } catch (RemoteException re) { Log.w(TAG, "Failed to set profile owner", re); throw new IllegalArgumentException("Couldn't set profile owner.", re); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +8 −0 Original line number Diff line number Diff line Loading @@ -2830,6 +2830,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return false; } mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null); UserManager um = (UserManager) mContext.getSystemService(Context.USER_SERVICE); if (um.getUserInfo(userHandle) == null) { // User doesn't exist. throw new IllegalArgumentException( "Attempted to set profile owner for invalid userId: " + userHandle); } if (packageName == null || !DeviceOwner.isInstalledForUser(packageName, userHandle)) { throw new IllegalArgumentException("Package name " + packageName Loading