From 38f836b972adac73c563692352b345cc09556364 Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Wed, 20 Aug 2014 14:51:15 -0700 Subject: Add a hidden method to query profile owner name for a user Bug: 17066115 Change-Id: I812a37ea2e7bb6da5aa4c31cb7e37934e5d698fa --- .../java/android/app/admin/DevicePolicyManager.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 053afb7982d2..bc4d2c1dbacd 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -2405,6 +2405,27 @@ public class DevicePolicyManager { return null; } + /** + * @hide + * @param user The user for whom to fetch the profile owner name, if any. + * @return the human readable name of the organisation associated with this profile owner or + * null if one is not set. + * @throws IllegalArgumentException if the userId is invalid. + */ + @SystemApi + public String getProfileOwnerNameAsUser(UserHandle user) throws IllegalArgumentException { + if (mService != null) { + try { + return mService.getProfileOwnerName(user.getIdentifier()); + } catch (RemoteException re) { + Log.w(TAG, "Failed to get profile owner"); + throw new IllegalArgumentException( + "Requested profile owner for invalid userId", re); + } + } + return null; + } + /** * Called by a profile owner or device owner to add a default intent handler activity for * intents that match a certain intent filter. This activity will remain the default intent -- cgit v1.2.3-59-g8ed1b