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

Commit c072c478 authored by Jeff DeCew's avatar Jeff DeCew
Browse files

Clean up SENSITIVE_REVEAL_ANIM flag

Fix: 268005230
Test: atest SystemUITests
Flag: LEGACY SENSITIVE_REVEAL_ANIM ENABLED
Change-Id: I013a6e99e5306d33eae5baf635e97cb059474fdf
parent c09eeda4
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -76,10 +76,6 @@ object Flags {
    val NOTIFICATION_MEMORY_LOGGING_ENABLED =
            releasedFlag("notification_memory_logging_enabled")

    // TODO(b/268005230): Tracking Bug
    @JvmField
    val SENSITIVE_REVEAL_ANIM = releasedFlag("sensitive_reveal_anim")

    // TODO(b/280783617): Tracking Bug
    @Keep
    @JvmField
+8 −29
Original line number Diff line number Diff line
@@ -39,8 +39,6 @@ import com.android.app.animation.Interpolators;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.policy.SystemBarUtils;
import com.android.systemui.animation.ShadeInterpolation;
import com.android.systemui.flags.Flags;
import com.android.systemui.flags.RefactorFlag;
import com.android.systemui.res.R;
import com.android.systemui.shade.transition.LargeScreenShadeInterpolator;
import com.android.systemui.statusbar.notification.ColorUpdateLogger;
@@ -95,8 +93,6 @@ public class NotificationShelf extends ActivatableNotificationView {
    private float mCornerAnimationDistance;
    private float mActualWidth = -1;
    private int mMaxIconsOnLockscreen;
    private final RefactorFlag mSensitiveRevealAnim =
            RefactorFlag.forView(Flags.SENSITIVE_REVEAL_ANIM);
    private boolean mCanModifyColorOfNotifications;
    private boolean mCanInteract;
    private NotificationStackScrollLayout mHostLayout;
@@ -266,7 +262,7 @@ public class NotificationShelf extends ActivatableNotificationView {
        }

        final float stackEnd = ambientState.getStackY() + ambientState.getStackHeight();
        if (mSensitiveRevealAnim.isEnabled() && viewState.hidden) {
        if (viewState.hidden) {
            // if the shelf is hidden, position it at the end of the stack (plus the clip
            // padding), such that when it appears animated, it will smoothly move in from the
            // bottom, without jump cutting any notifications
@@ -398,10 +394,6 @@ public class NotificationShelf extends ActivatableNotificationView {
        //  find the first view that doesn't overlap with the shelf
        int notGoneIndex = 0;
        int colorOfViewBeforeLast = NO_COLOR;
        boolean backgroundForceHidden = false;
        if (mHideBackground && !((ShelfState) getViewState()).hasItemsInStableShelf) {
            backgroundForceHidden = true;
        }
        int colorTwoBefore = NO_COLOR;
        int previousColor = NO_COLOR;
        float transitionAmount = 0.0f;
@@ -429,8 +421,7 @@ public class NotificationShelf extends ActivatableNotificationView {
                    expandingAnimated, isLastChild, shelfClipStart);

            // TODO(b/172289889) scale mPaddingBetweenElements with expansion amount
            if ((!mSensitiveRevealAnim.isEnabled() && ((isLastChild && !child.isInShelf())
                    || backgroundForceHidden)) || aboveShelf) {
            if (aboveShelf) {
                notificationClipEnd = shelfStart + getIntrinsicHeight();
            } else {
                notificationClipEnd = shelfStart - mPaddingBetweenElements;
@@ -440,8 +431,7 @@ public class NotificationShelf extends ActivatableNotificationView {

            // If the current row is an ExpandableNotificationRow, update its color, roundedness,
            // and icon state.
            if (child instanceof ExpandableNotificationRow) {
                ExpandableNotificationRow expandableRow = (ExpandableNotificationRow) child;
            if (child instanceof ExpandableNotificationRow expandableRow) {
                numViewsInShelf += inShelfAmount;
                int ownColorUntinted = expandableRow.getBackgroundColorWithoutTint();
                if (viewStart >= shelfStart && mNotGoneIndex == -1) {
@@ -471,16 +461,8 @@ public class NotificationShelf extends ActivatableNotificationView {
                notGoneIndex++;
            }

            if (child instanceof ActivatableNotificationView) {
                ActivatableNotificationView anv = (ActivatableNotificationView) child;
                // Because we show whole notifications on the lockscreen, the bottom notification is
                // always "just about to enter the shelf" by normal scrolling rules.  This is fine
                // if the shelf is visible, but if the shelf is hidden, it causes incorrect curling.
                // notificationClipEnd handles the discrepancy between a visible and hidden shelf,
                // so we use that when on the keyguard (and while animating away) to reduce curling.
                final float keyguardSafeShelfStart = !mSensitiveRevealAnim.isEnabled()
                        && mAmbientState.isOnKeyguard() ? notificationClipEnd : shelfStart;
                updateCornerRoundnessOnScroll(anv, viewStart, keyguardSafeShelfStart);
            if (child instanceof ActivatableNotificationView anv) {
                updateCornerRoundnessOnScroll(anv, viewStart, shelfStart);
            }
        }

@@ -519,11 +501,10 @@ public class NotificationShelf extends ActivatableNotificationView {
        mShelfIcons.applyIconStates();
        for (int i = 0; i < getHostLayoutChildCount(); i++) {
            View child = getHostLayoutChildAt(i);
            if (!(child instanceof ExpandableNotificationRow)
            if (!(child instanceof ExpandableNotificationRow row)
                    || child.getVisibility() == GONE) {
                continue;
            }
            ExpandableNotificationRow row = (ExpandableNotificationRow) child;
            updateContinuousClipping(row);
        }
        boolean hideBackground = isHidden;
@@ -613,8 +594,7 @@ public class NotificationShelf extends ActivatableNotificationView {
    private void clipTransientViews() {
        for (int i = 0; i < getHostLayoutTransientViewCount(); i++) {
            View transientView = getHostLayoutTransientView(i);
            if (transientView instanceof ExpandableView) {
                ExpandableView transientExpandableView = (ExpandableView) transientView;
            if (transientView instanceof ExpandableView transientExpandableView) {
                updateNotificationClipHeight(transientExpandableView, getTranslationY(), -1);
            }
        }
@@ -871,10 +851,9 @@ public class NotificationShelf extends ActivatableNotificationView {
    }

    private void setIconTransformationAmount(ExpandableView view, float transitionAmount) {
        if (!(view instanceof ExpandableNotificationRow)) {
        if (!(view instanceof ExpandableNotificationRow row)) {
            return;
        }
        ExpandableNotificationRow row = (ExpandableNotificationRow) view;
        StatusBarIconView icon = row.getShelfIcon();
        NotificationIconContainer.IconState iconState = getIconState(icon);
        if (iconState == null) {
+1 −2
Original line number Diff line number Diff line
@@ -2878,8 +2878,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        mSensitiveHiddenInGeneral = hideSensitive;
        int intrinsicAfter = getIntrinsicHeight();
        if (intrinsicBefore != intrinsicAfter) {
            boolean needsAnimation = mFeatureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM);
            notifyHeightChanged(needsAnimation);
            notifyHeightChanged(true);
        }
    }

+2 −4
Original line number Diff line number Diff line
@@ -194,7 +194,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
     */
    private Set<Integer> mDebugTextUsedYPositions;
    private final boolean mDebugRemoveAnimation;
    private final boolean mSensitiveRevealAnimEndabled;
    private int mContentHeight;
    private float mIntrinsicContentHeight;
    private int mPaddingBetweenElements;
@@ -615,7 +614,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
                Flags.LOCKSCREEN_ENABLE_LANDSCAPE);
        mDebugLines = mFeatureFlags.isEnabled(Flags.NSSL_DEBUG_LINES);
        mDebugRemoveAnimation = mFeatureFlags.isEnabled(Flags.NSSL_DEBUG_REMOVE_ANIMATION);
        mSensitiveRevealAnimEndabled = mFeatureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM);
        mSectionsManager = Dependency.get(NotificationSectionsManager.class);
        mScreenOffAnimationController =
                Dependency.get(ScreenOffAnimationController.class);
@@ -2549,7 +2547,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            return;
        }
        child.setOnHeightChangedListener(null);
        if (child instanceof ExpandableNotificationRow && mSensitiveRevealAnimEndabled) {
        if (child instanceof ExpandableNotificationRow) {
            NotificationEntry entry = ((ExpandableNotificationRow) child).getEntry();
            entry.removeOnSensitivityChangedListener(mOnChildSensitivityChangedListener);
        }
@@ -2845,7 +2843,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
    private void onViewAddedInternal(ExpandableView child) {
        updateHideSensitiveForChild(child);
        child.setOnHeightChangedListener(mOnChildHeightChangedListener);
        if (child instanceof ExpandableNotificationRow && mSensitiveRevealAnimEndabled) {
        if (child instanceof ExpandableNotificationRow) {
            NotificationEntry entry = ((ExpandableNotificationRow) child).getEntry();
            entry.addOnSensitivityChangedListener(mOnChildSensitivityChangedListener);
        }
+2 −30
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ import com.android.internal.widget.CachingIconView;
import com.android.systemui.SysuiTestCase;
import com.android.systemui.SysuiTestableContext;
import com.android.systemui.flags.FakeFeatureFlags;
import com.android.systemui.flags.Flags;
import com.android.systemui.plugins.statusbar.NotificationMenuRowPlugin;
import com.android.systemui.plugins.statusbar.StatusBarStateController;
import com.android.systemui.statusbar.notification.AboveShelfChangedListener;
@@ -104,7 +103,6 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
                TestableLooper.get(this),
                mFeatureFlags);
        mNotificationTestHelper.setDefaultInflationFlags(FLAG_CONTENT_VIEW_ALL);
        mFeatureFlags.setDefault(Flags.SENSITIVE_REVEAL_ANIM);
    }

    @Test
@@ -185,14 +183,6 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
                .isEqualTo(resetTint);
    }

    @Test
    public void testSetSensitiveOnNotifRowNotifiesOfHeightChange_withOtherFlagValue()
            throws Exception {
        FakeFeatureFlags flags = mFeatureFlags;
        flags.set(Flags.SENSITIVE_REVEAL_ANIM, !flags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM));
        testSetSensitiveOnNotifRowNotifiesOfHeightChange();
    }

    @Test
    public void testSetSensitiveOnNotifRowNotifiesOfHeightChange() throws Exception {
        // GIVEN a sensitive notification row that's currently redacted
@@ -210,19 +200,10 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
        // WHEN the row is set to no longer be sensitive
        row.setSensitive(false, true);

        boolean expectAnimation = mFeatureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM);
        // VERIFY that the height change listener is invoked
        assertThat(row.getShowingLayout()).isSameInstanceAs(row.getPrivateLayout());
        assertThat(row.getIntrinsicHeight()).isGreaterThan(0);
        verify(listener).onHeightChanged(eq(row), eq(expectAnimation));
    }

    @Test
    public void testSetSensitiveOnGroupRowNotifiesOfHeightChange_withOtherFlagValue()
            throws Exception {
        FakeFeatureFlags flags = mFeatureFlags;
        flags.set(Flags.SENSITIVE_REVEAL_ANIM, !flags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM));
        testSetSensitiveOnGroupRowNotifiesOfHeightChange();
        verify(listener).onHeightChanged(eq(row), eq(true));
    }

    @Test
@@ -242,19 +223,10 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
        // WHEN the row is set to no longer be sensitive
        group.setSensitive(false, true);

        boolean expectAnimation = mFeatureFlags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM);
        // VERIFY that the height change listener is invoked
        assertThat(group.getShowingLayout()).isSameInstanceAs(group.getPrivateLayout());
        assertThat(group.getIntrinsicHeight()).isGreaterThan(0);
        verify(listener).onHeightChanged(eq(group), eq(expectAnimation));
    }

    @Test
    public void testSetSensitiveOnPublicRowDoesNotNotifyOfHeightChange_withOtherFlagValue()
            throws Exception {
        FakeFeatureFlags flags = mFeatureFlags;
        flags.set(Flags.SENSITIVE_REVEAL_ANIM, !flags.isEnabled(Flags.SENSITIVE_REVEAL_ANIM));
        testSetSensitiveOnPublicRowDoesNotNotifyOfHeightChange();
        verify(listener).onHeightChanged(eq(group), eq(true));
    }

    @Test
Loading