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

Commit 3c636000 authored by András Kurucz's avatar András Kurucz Committed by Automerger Merge Worker
Browse files

Merge "Remove ExpandableNotificationRow#isBlockingHelperShowing" into...

Merge "Remove ExpandableNotificationRow#isBlockingHelperShowing" into tm-qpr-dev am: acb2d9fc am: 85d4817e am: 3d060baa

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21781488



Change-Id: I66521610f32ca9cad1e89d360401aec6dc83c3b5
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents e77a4190 3d060baa
Loading
Loading
Loading
Loading
+1 −33
Original line number Diff line number Diff line
@@ -153,7 +153,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    // We don't correctly track dark mode until the content views are inflated, so always update
    // the background on first content update just in case it happens to be during a theme change.
    private boolean mUpdateSelfBackgroundOnUpdate = true;
    private boolean mNotificationTranslationFinished = false;
    private boolean mIsSnoozed;
    private boolean mIsFaded;
    private boolean mAnimatePinnedRoundness = false;
@@ -209,11 +208,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
     * If {@link #mHasUserChangedExpansion}, has the user expanded this row
     */
    private boolean mUserExpanded;
    /**
     * Whether the blocking helper is showing on this notification (even if dismissed)
     */
    private boolean mIsBlockingHelperShowing;

    /**
     * Has this notification been expanded while it was pinned
     */
@@ -1579,18 +1573,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    public void setBlockingHelperShowing(boolean isBlockingHelperShowing) {
        mIsBlockingHelperShowing = isBlockingHelperShowing;
    }

    public boolean isBlockingHelperShowing() {
        return mIsBlockingHelperShowing;
    }

    public boolean isBlockingHelperShowingAndTranslationFinished() {
        return mIsBlockingHelperShowing && mNotificationTranslationFinished;
    }

    @Override
    public View getShelfTransformationTarget() {
        if (mIsSummaryWithChildren && !shouldShowPublic()) {
@@ -2171,10 +2153,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    @Override
    public void setTranslation(float translationX) {
        invalidate();
        if (isBlockingHelperShowingAndTranslationFinished()) {
            mGuts.setTranslationX(translationX);
            return;
        } else if (mDismissUsingRowTranslationX) {
        if (mDismissUsingRowTranslationX) {
            setTranslationX(translationX);
        } else if (mTranslateableViews != null) {
            // Translate the group of views
@@ -2202,10 +2181,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            return getTranslationX();
        }

        if (isBlockingHelperShowingAndCanTranslate()) {
            return mGuts.getTranslationX();
        }

        if (mTranslateableViews != null && mTranslateableViews.size() > 0) {
            // All of the views in the list should have same translation, just use first one.
            return mTranslateableViews.get(0).getTranslationX();
@@ -2214,10 +2189,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        return 0;
    }

    private boolean isBlockingHelperShowingAndCanTranslate() {
        return areGutsExposed() && mIsBlockingHelperShowing && mNotificationTranslationFinished;
    }

    public Animator getTranslateViewAnimator(final float leftTarget,
                                             AnimatorUpdateListener listener) {
        if (mTranslateAnim != null) {
@@ -2239,9 +2210,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView

            @Override
            public void onAnimationEnd(Animator anim) {
                if (mIsBlockingHelperShowing) {
                    mNotificationTranslationFinished = true;
                }
                if (!cancelled && leftTarget == 0) {
                    if (mMenuRow != null) {
                        mMenuRow.resetMenu();
+32 −54
Original line number Diff line number Diff line
@@ -238,12 +238,11 @@ public class NotificationGuts extends FrameLayout {
    }

    public void openControls(
            boolean shouldDoCircularReveal,
            int x,
            int y,
            boolean needsFalsingProtection,
            @Nullable Runnable onAnimationEnd) {
        animateOpen(shouldDoCircularReveal, x, y, onAnimationEnd);
        animateOpen(x, y, onAnimationEnd);
        setExposed(true /* exposed */, needsFalsingProtection);
    }

@@ -300,7 +299,7 @@ public class NotificationGuts extends FrameLayout {
        if (mGutsContent == null
                || !mGutsContent.handleCloseControls(save, force)) {
            // We only want to do a circular reveal if we're not showing the blocking helper.
            animateClose(x, y, true /* shouldDoCircularReveal */);
            animateClose(x, y);

            setExposed(false, mNeedsFalsingProtection);
            if (mClosedListener != null) {
@@ -309,11 +308,9 @@ public class NotificationGuts extends FrameLayout {
        }
    }

    /** Animates in the guts view via either a fade or a circular reveal. */
    private void animateOpen(
            boolean shouldDoCircularReveal, int x, int y, @Nullable Runnable onAnimationEnd) {
    /** Animates in the guts view with a circular reveal. */
    private void animateOpen(int x, int y, @Nullable Runnable onAnimationEnd) {
        if (isAttachedToWindow()) {
            if (shouldDoCircularReveal) {
            double horz = Math.max(getWidth() - x, x);
            double vert = Math.max(getHeight() - y, y);
            float r = (float) Math.hypot(horz, vert);
@@ -325,27 +322,17 @@ public class NotificationGuts extends FrameLayout {
            a.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
            a.addListener(new AnimateOpenListener(onAnimationEnd));
            a.start();
            } else {
                // Fade in content
                this.setAlpha(0f);
                this.animate()
                        .alpha(1f)
                        .setDuration(StackStateAnimator.ANIMATION_DURATION_BLOCKING_HELPER_FADE)
                        .setInterpolator(Interpolators.ALPHA_IN)
                        .setListener(new AnimateOpenListener(onAnimationEnd))
                        .start();
            }

        } else {
            Log.w(TAG, "Failed to animate guts open");
        }
    }


    /** Animates out the guts view via either a fade or a circular reveal. */
    /** Animates out the guts view with a circular reveal. */
    @VisibleForTesting
    void animateClose(int x, int y, boolean shouldDoCircularReveal) {
    void animateClose(int x, int y) {
        if (isAttachedToWindow()) {
            if (shouldDoCircularReveal) {
            // Circular reveal originating at (x, y)
            if (x == -1 || y == -1) {
                x = (getLeft() + getRight()) / 2;
@@ -360,15 +347,6 @@ public class NotificationGuts extends FrameLayout {
            a.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN);
            a.addListener(new AnimateCloseListener(this /* view */, mGutsContent));
            a.start();
            } else {
                // Fade in the blocking helper.
                this.animate()
                        .alpha(0f)
                        .setDuration(StackStateAnimator.ANIMATION_DURATION_BLOCKING_HELPER_FADE)
                        .setInterpolator(Interpolators.ALPHA_OUT)
                        .setListener(new AnimateCloseListener(this, /* view */mGutsContent))
                        .start();
            }
        } else {
            Log.w(TAG, "Failed to animate guts close");
            mGutsContent.onFinishedClosing();
@@ -449,7 +427,7 @@ public class NotificationGuts extends FrameLayout {
        return mGutsContent != null && mGutsContent.isLeavebehind();
    }

    /** Listener for animations executed in {@link #animateOpen(boolean, int, int, Runnable)}. */
    /** Listener for animations executed in {@link #animateOpen(int, int, Runnable)}. */
    private static class AnimateOpenListener extends AnimatorListenerAdapter {
        final Runnable mOnAnimationEnd;

+0 −1
Original line number Diff line number Diff line
@@ -629,7 +629,6 @@ public class NotificationGutsManager implements NotifGutsViewManager {
                                !mAccessibilityManager.isTouchExplorationEnabled());

                guts.openControls(
                        !row.isBlockingHelperShowing(),
                        x,
                        y,
                        needsFalsingProtection,
+0 −11
Original line number Diff line number Diff line
@@ -399,17 +399,6 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
        verify(aboveShelfChangedListener).onAboveShelfStateChanged(false);
    }

    @Test
    public void testIsBlockingHelperShowing_isCorrectlyUpdated() throws Exception {
        ExpandableNotificationRow group = mNotificationTestHelper.createGroup();

        group.setBlockingHelperShowing(true);
        assertTrue(group.isBlockingHelperShowing());

        group.setBlockingHelperShowing(false);
        assertFalse(group.isBlockingHelperShowing());
    }

    @Test
    public void testGetNumUniqueChildren_defaultChannel() throws Exception {
        ExpandableNotificationRow groupRow = mNotificationTestHelper.createGroup();
+0 −7
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
    @Mock private NotificationPresenter mPresenter;
    @Mock private NotificationActivityStarter mNotificationActivityStarter;
    @Mock private NotificationListContainer mNotificationListContainer;
    @Mock private NotificationInfo.CheckSaveListener mCheckSaveListener;
    @Mock private OnSettingsClickListener mOnSettingsClickListener;
    @Mock private DeviceProvisionedController mDeviceProvisionedController;
    @Mock private CentralSurfaces mCentralSurfaces;
@@ -173,7 +172,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {

        // Test doesn't support animation since the guts view is not attached.
        doNothing().when(guts).openControls(
                eq(true) /* shouldDoCircularReveal */,
                anyInt(),
                anyInt(),
                anyBoolean(),
@@ -190,7 +188,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
        assertEquals(View.INVISIBLE, guts.getVisibility());
        mTestableLooper.processAllMessages();
        verify(guts).openControls(
                eq(true),
                anyInt(),
                anyInt(),
                anyBoolean(),
@@ -213,7 +210,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {

        // Test doesn't support animation since the guts view is not attached.
        doNothing().when(guts).openControls(
                eq(true) /* shouldDoCircularReveal */,
                anyInt(),
                anyInt(),
                anyBoolean(),
@@ -237,7 +233,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
        assertTrue(mGutsManager.openGutsInternal(row, 0, 0, menuItem));
        mTestableLooper.processAllMessages();
        verify(guts).openControls(
                eq(true),
                anyInt(),
                anyInt(),
                anyBoolean(),
@@ -379,7 +374,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
    public void testInitializeNotificationInfoView_PassesAlongProvisionedState() throws Exception {
        NotificationInfo notificationInfoView = mock(NotificationInfo.class);
        ExpandableNotificationRow row = spy(mHelper.createRow());
        row.setBlockingHelperShowing(false);
        modifyRanking(row.getEntry())
                .setUserSentiment(USER_SENTIMENT_NEGATIVE)
                .build();
@@ -414,7 +408,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
    public void testInitializeNotificationInfoView_withInitialAction() throws Exception {
        NotificationInfo notificationInfoView = mock(NotificationInfo.class);
        ExpandableNotificationRow row = spy(mHelper.createRow());
        row.setBlockingHelperShowing(true);
        modifyRanking(row.getEntry())
                .setUserSentiment(USER_SENTIMENT_NEGATIVE)
                .build();
Loading