Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5304,6 +5304,7 @@ package android.app.admin { method public void setPasswordMinimumUpperCase(android.content.ComponentName, int); method public void setPasswordQuality(android.content.ComponentName, int); method public void setProfileEnabled(android.content.ComponentName); method public void setProfileName(android.content.ComponentName, java.lang.String); method public void setRecommendedGlobalProxy(android.content.ComponentName, android.net.ProxyInfo); method public void setRestrictionsProvider(android.content.ComponentName, android.content.ComponentName); method public void setSecureSetting(android.content.ComponentName, java.lang.String, java.lang.String); core/java/android/app/admin/DevicePolicyManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -2103,6 +2103,26 @@ public class DevicePolicyManager { } } /** * Sets the name of the Managed profile. In the device owner case it sets the name of the user * which it is called from. Only the profile owner or device owner can call this. If this is * never called by the profile or device owner, the name will be set to default values. * * @see #isProfileOwnerApp * @see #isDeviceOwnerApp * * @param profileName The name of the profile. */ public void setProfileName(ComponentName who, String profileName) { if (mService != null) { try { mService.setProfileName(who, profileName); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } } /** * Used to determine if a particular package is registered as the Profile Owner for the * current user. A profile owner is a special device admin that has additional privileges Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ interface IDevicePolicyManager { String getProfileOwner(int userHandle); String getProfileOwnerName(int userHandle); void setProfileEnabled(in ComponentName who); void setProfileName(in ComponentName who, String profileName); boolean installCaCert(in ComponentName admin, in byte[] certBuffer); void uninstallCaCert(in ComponentName admin, in String alias); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +19 −1 Original line number Diff line number Diff line Loading @@ -3222,7 +3222,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { // Check if this is the profile owner who is calling getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); int userId = UserHandle.getCallingUserId(); Slog.d(LOG_TAG, "Enabling the profile for: " + userId); long id = Binder.clearCallingIdentity(); try { Loading @@ -3239,6 +3238,25 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override public void setProfileName(ComponentName who, String profileName) { int userId = UserHandle.getCallingUserId(); if (who == null) { throw new NullPointerException("ComponentName is null"); } // Check if this is the profile owner (includes device owner). getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); long id = Binder.clearCallingIdentity(); try { mUserManager.setUserName(userId, profileName); } finally { restoreCallingIdentity(id); } } @Override public String getProfileOwner(int userHandle) { if (!mHasFeature) { Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -5304,6 +5304,7 @@ package android.app.admin { method public void setPasswordMinimumUpperCase(android.content.ComponentName, int); method public void setPasswordQuality(android.content.ComponentName, int); method public void setProfileEnabled(android.content.ComponentName); method public void setProfileName(android.content.ComponentName, java.lang.String); method public void setRecommendedGlobalProxy(android.content.ComponentName, android.net.ProxyInfo); method public void setRestrictionsProvider(android.content.ComponentName, android.content.ComponentName); method public void setSecureSetting(android.content.ComponentName, java.lang.String, java.lang.String);
core/java/android/app/admin/DevicePolicyManager.java +20 −0 Original line number Diff line number Diff line Loading @@ -2103,6 +2103,26 @@ public class DevicePolicyManager { } } /** * Sets the name of the Managed profile. In the device owner case it sets the name of the user * which it is called from. Only the profile owner or device owner can call this. If this is * never called by the profile or device owner, the name will be set to default values. * * @see #isProfileOwnerApp * @see #isDeviceOwnerApp * * @param profileName The name of the profile. */ public void setProfileName(ComponentName who, String profileName) { if (mService != null) { try { mService.setProfileName(who, profileName); } catch (RemoteException e) { Log.w(TAG, "Failed talking with device policy service", e); } } } /** * Used to determine if a particular package is registered as the Profile Owner for the * current user. A profile owner is a special device admin that has additional privileges Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -114,6 +114,7 @@ interface IDevicePolicyManager { String getProfileOwner(int userHandle); String getProfileOwnerName(int userHandle); void setProfileEnabled(in ComponentName who); void setProfileName(in ComponentName who, String profileName); boolean installCaCert(in ComponentName admin, in byte[] certBuffer); void uninstallCaCert(in ComponentName admin, in String alias); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +19 −1 Original line number Diff line number Diff line Loading @@ -3222,7 +3222,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { // Check if this is the profile owner who is calling getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); int userId = UserHandle.getCallingUserId(); Slog.d(LOG_TAG, "Enabling the profile for: " + userId); long id = Binder.clearCallingIdentity(); try { Loading @@ -3239,6 +3238,25 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override public void setProfileName(ComponentName who, String profileName) { int userId = UserHandle.getCallingUserId(); if (who == null) { throw new NullPointerException("ComponentName is null"); } // Check if this is the profile owner (includes device owner). getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); long id = Binder.clearCallingIdentity(); try { mUserManager.setUserName(userId, profileName); } finally { restoreCallingIdentity(id); } } @Override public String getProfileOwner(int userHandle) { if (!mHasFeature) { Loading