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

Commit cb1535eb authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Fix bundle icon sizing

It needs to be treated like a notification icon rather than status bar
icon

Test: manual (post one bundle and one silent notif, make sure both show
status bar)
Test: Increase text size, make sure bundle icon spacing doesn't change
Test: validate content descriptions for notification and bundle status
bar icons
Fixes: 428513924
Flag: com.android.systemui.notification_bundle_ui

Change-Id: I283697e58f47fa467921cdae21d075967ee8fafe
parent d869b235
Loading
Loading
Loading
Loading
+16 −4
Original line number Original line Diff line number Diff line
@@ -64,6 +64,7 @@ import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.statusbar.notification.NotificationContentDescription;
import com.android.systemui.statusbar.notification.NotificationContentDescription;
import com.android.systemui.statusbar.notification.NotificationDozeHelper;
import com.android.systemui.statusbar.notification.NotificationDozeHelper;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.NotificationUtils;
import com.android.systemui.statusbar.notification.collection.BundleEntry;
import com.android.systemui.util.drawable.DrawableSize;
import com.android.systemui.util.drawable.DrawableSize;


import java.lang.annotation.Retention;
import java.lang.annotation.Retention;
@@ -147,7 +148,8 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    private StatusBarIcon mIcon;
    private StatusBarIcon mIcon;
    private int mLayoutDirectionForLoadedDrawable = LayoutDirection.UNDEFINED;
    private int mLayoutDirectionForLoadedDrawable = LayoutDirection.UNDEFINED;
    @ViewDebug.ExportedProperty private String mSlot;
    @ViewDebug.ExportedProperty private String mSlot;
    private StatusBarNotification mNotification;
    @Nullable private StatusBarNotification mNotification;
    @Nullable private BundleEntry mBundleEntry;
    private final boolean mBlocked;
    private final boolean mBlocked;
    private Configuration mConfiguration;
    private Configuration mConfiguration;
    private boolean mNightMode;
    private boolean mNightMode;
@@ -187,6 +189,12 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
        this(context, slot, sbn, false);
        this(context, slot, sbn, false);
    }
    }


    public StatusBarIconView(Context context, String slot, StatusBarNotification sbn,
            BundleEntry entry) {
        this(context, slot, sbn, false);
        mBundleEntry = entry;
    }

    public StatusBarIconView(Context context, String slot, StatusBarNotification sbn,
    public StatusBarIconView(Context context, String slot, StatusBarNotification sbn,
            boolean blocked) {
            boolean blocked) {
        super(context);
        super(context);
@@ -210,7 +218,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    public void maybeUpdateIconScaleDimens() {
    public void maybeUpdateIconScaleDimens() {
        // We scale notification icons (on the left) plus icons on the right that explicitly
        // We scale notification icons (on the left) plus icons on the right that explicitly
        // want FIXED_SPACE.
        // want FIXED_SPACE.
        boolean useNonSystemIconScaling = isNotification()
        boolean useNonSystemIconScaling = isShownWithNotifications()
                || (mIcon != null && mIcon.shape == Shape.FIXED_SPACE);
                || (mIcon != null && mIcon.shape == Shape.FIXED_SPACE);


        if (useNonSystemIconScaling) {
        if (useNonSystemIconScaling) {
@@ -377,6 +385,10 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
        return mNotification != null;
        return mNotification != null;
    }
    }


    private boolean isShownWithNotifications() {
        return mNotification != null || mBundleEntry != null;
    }

    public boolean equalIcons(Icon a, Icon b) {
    public boolean equalIcons(Icon a, Icon b) {
        if (a == b) return true;
        if (a == b) return true;
        if (a.getType() != b.getType()) return false;
        if (a.getType() != b.getType()) return false;
@@ -545,7 +557,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);


        if (!isNotification()) {
        if (!isShownWithNotifications()) {
            // for system icons, calculated measured width from super is for image drawable real
            // for system icons, calculated measured width from super is for image drawable real
            // width (17dp). We may scale the image with font scale, so we also need to scale the
            // width (17dp). We may scale the image with font scale, so we also need to scale the
            // measured width so that scaled measured width and image width would be fit.
            // measured width so that scaled measured width and image width would be fit.
@@ -627,7 +639,7 @@ public class StatusBarIconView extends AnimatedImageView implements StatusIconDi
    }
    }


    private void initializeDecorColor() {
    private void initializeDecorColor() {
        if (isNotification()) {
        if (isShownWithNotifications()) {
            setDecorColor(getContext().getColor(mNightMode
            setDecorColor(getContext().getColor(mNightMode
                    ? com.android.internal.R.color.notification_default_color_dark
                    ? com.android.internal.R.color.notification_default_color_dark
                    : com.android.internal.R.color.notification_default_color_light));
                    : com.android.internal.R.color.notification_default_color_light));
+1 −1
Original line number Original line Diff line number Diff line
@@ -41,7 +41,7 @@ class IconBuilder @Inject constructor(@Main private val context: Context) {


    @JvmOverloads
    @JvmOverloads
    fun createIconView(entry: BundleEntry, context: Context = this.context): StatusBarIconView {
    fun createIconView(entry: BundleEntry, context: Context = this.context): StatusBarIconView {
        return StatusBarIconView(context, entry.key, null)
        return StatusBarIconView(context, entry.key, null, entry)
    }
    }


    fun getIconContentDescription(n: Notification): CharSequence {
    fun getIconContentDescription(n: Notification): CharSequence {