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

Commit 7c2cb756 authored by Istvan Nagy's avatar Istvan Nagy
Browse files

Update UserIcons.java to support overridden default icon.

This change updates `UserIcons.java` to correctly support
the default user icon overridden in the resource overlay.

Test: manually on VM. Tested on login, lock screen and settings.
Bug: 424367031
Flag: EXEMPT this change only affects desktop, because of the overlay ag/34580616
Change-Id: Ib18b334fc70b2ec43031d031a39533df5ac67f78
parent 13ca7927
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.os.UserHandle;

import com.android.internal.R;
@@ -94,6 +95,10 @@ public class UserIcons {
     */
    public static Drawable getDefaultUserIconInColor(Resources resources, @ColorInt int color) {
        Drawable icon = resources.getDrawable(R.drawable.ic_account_circle, null).mutate();
        // Return icon as is if it's already styled by the overlay.
        if (icon instanceof LayerDrawable) {
            return icon;
        }
        icon.setColorFilter(color, Mode.SRC_IN);
        icon.setBounds(0, 0, icon.getIntrinsicWidth(), icon.getIntrinsicHeight());
        return icon;