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

Commit 719136d2 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Fix notification group header color flickers

Also consolidate how we handle headsup and notifications on keyguard

Bug: 400307362
Test: manual
Flag: com.android.systemui.notification_row_transparency
Flag: EXEMPT bugfix
Change-Id: I993ca9becd3fba557bce05d44ea287d63e2cab6e
parent 07d38ff6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        updateColors();
    }

    private void updateColors() {
    protected void updateColors() {
        if (notificationRowTransparency()) {
            if (mIsBlurSupported) {
                mNormalColor = SurfaceEffectColors.surfaceEffect1(getContext());
+5 −8
Original line number Diff line number Diff line
@@ -979,7 +979,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        } else if (isAboveShelf() != wasAboveShelf) {
            mAboveShelfChangedListener.onAboveShelfStateChanged(!wasAboveShelf);
        }
        updateBackgroundOpacity();
        updateColors();
    }

    /**
@@ -3122,7 +3122,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                    mChildrenContainer.setOnKeyguard(onKeyguard);
                }
            }
            updateBackgroundOpacity();
            updateColors();
        }
    }

@@ -4569,11 +4569,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    private void updateBackgroundOpacity() {
        if (mBackgroundNormal != null) {
            // Row background should be opaque when it's displayed as a heads-up notification or
            // displayed on keyguard.
            mBackgroundNormal.setForceOpaque(mIsHeadsUp || mOnKeyguard);
        }
    @Override
    protected boolean usesTransparentBackground() {
        return super.usesTransparentBackground() && !mIsHeadsUp && !mOnKeyguard;
    }
}
+1 −13
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import androidx.annotation.Nullable;
import com.android.internal.graphics.ColorUtils;
import com.android.internal.util.ContrastColorUtil;
import com.android.systemui.Dumpable;
import com.android.systemui.common.shared.colors.SurfaceEffectColors;
import com.android.systemui.res.R;
import com.android.systemui.statusbar.notification.shared.NotificationAddXOnHoverToDismiss;
import com.android.systemui.util.DrawableDumpKt;
@@ -156,14 +155,6 @@ public class NotificationBackgroundView extends View implements Dumpable,
        mBgIsColorized = b;
    }

    /** Sets if the background should be opaque. */
    public void setForceOpaque(boolean forceOpaque) {
        mForceOpaque = forceOpaque;
        if (notificationRowTransparency()) {
            updateBaseLayerColor();
        }
    }

    private Path calculateDismissButtonCutoutPath(Rect backgroundBounds) {
        // TODO(b/365585705): Adapt to RTL after the UX design is finalized.

@@ -327,10 +318,7 @@ public class NotificationBackgroundView extends View implements Dumpable,
        // For colorized notifications, this uses a color that matches the tint color at 90% alpha.
        int color = isColorized()
                ? ColorUtils.setAlphaComponent(mTintColor, (int) (MAX_ALPHA * 0.9f))
                : SurfaceEffectColors.surfaceEffect1(getContext());
        if (mForceOpaque) {
            color = ColorUtils.setAlphaComponent(color, MAX_ALPHA);
        }
                : mNormalColor;
        getBaseBackgroundLayer().setColorFilter(
                new PorterDuffColorFilter(
                        color,