Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23ad2790 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android (Google) Code Review
Browse files

Merge "Add a hidden method to query profile owner name for a user" into lmp-dev

parents 8fbcaacd 38f836b9
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -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