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

Commit 77119899 authored by Tracy Zhou's avatar Tracy Zhou
Browse files

Use the correct lockscreen signal for showing non transparent notification shelf background

Fixes: 409271854
Test: manual
Flag: com.android.systemui.notification_row_transparency
Change-Id: Ia14ca6269c71c8e7657bc3d57b8260c0032c5326
parent cedaea13
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.statusbar;

import static com.android.keyguard.BouncerPanelExpansionCalculator.aboutToShowBouncerProgress;
import static com.android.systemui.Flags.notificationRowTransparency;
import static com.android.systemui.Flags.physicalNotificationMovement;
import static com.android.systemui.util.ColorUtilKt.hexColorString;

@@ -1068,11 +1069,6 @@ public class NotificationShelf extends ActivatableNotificationView {
        return false;
    }

    @Override
    protected boolean usesTransparentBackground() {
        return super.usesTransparentBackground() && !mAmbientState.isOnKeyguard();
    }

    public void setCanModifyColorOfNotifications(boolean canModifyColorOfNotifications) {
        mCanModifyColorOfNotifications = canModifyColorOfNotifications;
    }
@@ -1102,6 +1098,7 @@ public class NotificationShelf extends ActivatableNotificationView {
            DumpUtilsKt.withIncreasedIndent(pw, () -> {
                pw.println("mActualWidth: " + mActualWidth);
                pw.println("mStatusBarHeight: " + mStatusBarHeight);
                pw.println("isOnKeyguard: " + isOnKeyguard());
            });
        }
    }
+31 −1
Original line number Diff line number Diff line
@@ -121,6 +121,12 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    protected Point mTargetPoint;
    private boolean mDismissed;
    private boolean mRefocusOnDismiss;
    /**
     * Whether the notification is on the keyguard. This is used to disable the transparent
     * background, and the {@link ExpandableNotificationRow} additionally uses this to disable
     * expansion.
     */
    protected boolean mOnKeyguard;
    protected boolean mIsBlurSupported;

    public ActivatableNotificationView(Context context, AttributeSet attrs) {
@@ -343,7 +349,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
    }

    protected boolean usesTransparentBackground() {
        return mIsBlurSupported && notificationRowTransparency();
        return mIsBlurSupported && notificationRowTransparency() && !mOnKeyguard;
    }

    @Override
@@ -826,6 +832,30 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
        mTouchHandler = touchHandler;
    }

    /**
     * Sets whether this view is on the keyguard.
     * Subclass implementations must set {@link #mOnKeyguard} to the given value.
     * @see #isOnKeyguard()
     */
    public void setOnKeyguard(boolean onKeyguard) {
        if (mOnKeyguard == onKeyguard) {
            return;
        }

        mOnKeyguard = onKeyguard;
        if (notificationRowTransparency()) {
            updateBackgroundTint();
        }
    }

    /**
     * Whether this row is displayed over the unoccluded lockscreen. Returns false on the
     * locked shade.
     */
    public boolean isOnKeyguard() {
        return mOnKeyguard;
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
+23 −36
Original line number Diff line number Diff line
@@ -269,11 +269,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
     */
    private boolean mIsSystemExpanded;

    /**
     * Whether the notification is on the keyguard and the expansion is disabled.
     */
    private boolean mOnKeyguard;

    private Animator mTranslateAnim;
    private ArrayList<View> mTranslateableViews;
    private NotificationContentView mPublicLayout;
@@ -1796,14 +1791,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        return mPrivateLayout.getSingleLineView();
    }

    /**
     * Whether this row is displayed over the unoccluded lockscreen. Returns false on the
     * locked shade.
     */
    public boolean isOnKeyguard() {
        return mOnKeyguard;
    }

    @Override
    public void dismiss(boolean refocusOnDismiss) {
        super.dismiss(refocusOnDismiss);
@@ -3247,12 +3234,17 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    /** @see #isOnKeyguard() */
    @Override
    public void setOnKeyguard(boolean onKeyguard) {
        if (onKeyguard != mOnKeyguard) {
        if (onKeyguard == mOnKeyguard) {
            return;
        }

        boolean wasAboveShelf = isAboveShelf();
        final boolean wasExpanded = isExpanded();
            mOnKeyguard = onKeyguard;

        super.setOnKeyguard(onKeyguard);

        onExpansionChanged(false /* userAction */, wasExpanded);
        if (wasExpanded != isExpanded()) {
            if (mIsSummaryWithChildren) {
@@ -3268,10 +3260,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
                mChildrenContainer.setOnKeyguard(onKeyguard);
            }
        }
            if (notificationRowTransparency()) {
                updateBackgroundTint();
            }
        }
    }

    @Override
@@ -4882,7 +4870,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        return super.usesTransparentBackground()
                && !mustStayOnScreen()
                && !(isChildInGroup() && !mNotificationParent.usesTransparentBackground())
                && !mHeadsupDisappearRunning
                && !mOnKeyguard;
                && !mHeadsupDisappearRunning;
    }
}
+4 −0
Original line number Diff line number Diff line
@@ -5511,6 +5511,7 @@ public class NotificationStackScrollLayout
                    childRow.setOnKeyguard(isOnLockscreen);
                }
            }
            mShelf.setOnKeyguard(isOnLockscreen);
        }
    }

@@ -5601,6 +5602,9 @@ public class NotificationStackScrollLayout
    public void setStatusBarState(int statusBarState) {
        mStatusBarState = statusBarState;
        mAmbientState.setStatusBarState(statusBarState);
        if (!SceneContainerFlag.isEnabled()) {
            mShelf.setOnKeyguard(statusBarState == StatusBarState.KEYGUARD);
        }
        updateSpeedBumpIndex();
        updateDismissBehavior();
    }