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

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

Merge "Expose an API to generate a badged icon for managed profiles."

parents fd7d3108 7dda2657
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19978,6 +19978,7 @@ package android.os {
  public class UserManager {
    method public android.os.Bundle getApplicationRestrictions(java.lang.String);
    method public android.graphics.drawable.Drawable getBadgedDrawableForUser(android.graphics.drawable.Drawable, android.os.UserHandle);
    method public long getSerialNumberForUser(android.os.UserHandle);
    method public int getUserCount();
    method public android.os.UserHandle getUserForSerialNumber(long);
+14 −1
Original line number Diff line number Diff line
@@ -492,7 +492,20 @@ public class UserManager {
        return profiles;
    }

    /** @hide */
    /**
     * If the target user is a managed profile of the calling user or the caller
     * is itself a managed profile, then this returns a badged copy of the given
     * icon to be able to distinguish it from the original icon.
     * <P>
     * If the original drawable is not a BitmapDrawable, then the original
     * drawable is returned.
     * </P>
     *
     * @param icon The icon to badge.
     * @param user The target user.
     * @return A drawable that combines the original icon and a badge as
     *         determined by the system.
     */
    public Drawable getBadgedDrawableForUser(Drawable icon, UserHandle user) {
        int badgeResId = getBadgeResIdForUser(user.getIdentifier());
        if (badgeResId == 0) {