Revert "Add translateY animation to the removed HUNs animating away"
This reverts commit 39fe64c1f9657720b745cdf330e83b0dc81d1444.
Reason for revert: b/324375024, Attempt to invoke virtual method 'float android.graphics.RenderNode.getTranslationY()' on a null object reference
Bug: 324375024
Change-Id: I8f162bae536c46026f8f47bb8b4382bc968381bd
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
index fb14a91..b38d619 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/StackStateAnimator.java
@@ -460,8 +460,15 @@
mHeadsUpAppearChildren.add(changingView);
mTmpState.copyFrom(changingView.getViewState());
- // translate the HUN in from the top, or the bottom of the screen
- mTmpState.setYTranslation(getHeadsUpYTranslationStart(event.headsUpFromBottom));
+ if (event.headsUpFromBottom) {
+ // start from the bottom of the screen
+ mTmpState.setYTranslation(
+ mHeadsUpAppearHeightBottom + mHeadsUpAppearStartAboveScreen);
+ } else {
+ // start from the top of the screen
+ mTmpState.setYTranslation(
+ -mStackTopMargin - mHeadsUpAppearStartAboveScreen);
+ }
// set the height and the initial position
mTmpState.applyToView(changingView);
mAnimationProperties.setCustomInterpolator(View.TRANSLATION_Y,
@@ -505,20 +512,12 @@
|| event.animationType == ANIMATION_TYPE_HEADS_UP_DISAPPEAR_CLICK) {
mHeadsUpDisappearChildren.add(changingView);
Runnable endRunnable = null;
- mTmpState.copyFrom(changingView.getViewState());
if (changingView.getParent() == null) {
// This notification was actually removed, so we need to add it
// transiently
mHostLayout.addTransientView(changingView, 0);
changingView.setTransientContainer(mHostLayout);
- if (NotificationsImprovedHunAnimation.isEnabled()) {
- // StackScrollAlgorithm cannot find this view because it has been removed
- // from the NSSL. To correctly translate the view to the top or bottom of
- // the screen (where it animated from), we need to update its translation.
- mTmpState.setYTranslation(
- getHeadsUpYTranslationStart(event.headsUpFromBottom)
- );
- }
+ mTmpState.initFrom(changingView);
endRunnable = changingView::removeFromTransientContainer;
}
@@ -566,19 +565,16 @@
changingView.setInRemovalAnimation(true);
};
}
+ if (NotificationsImprovedHunAnimation.isEnabled()) {
+ mAnimationProperties.setCustomInterpolator(View.TRANSLATION_Y,
+ Interpolators.FAST_OUT_SLOW_IN_REVERSE);
+ }
long removeAnimationDelay = changingView.performRemoveAnimation(
ANIMATION_DURATION_HEADS_UP_DISAPPEAR,
0, 0.0f, true /* isHeadsUpAppear */,
startAnimation, postAnimation,
getGlobalAnimationFinishedListener());
mAnimationProperties.delay += removeAnimationDelay;
- if (NotificationsImprovedHunAnimation.isEnabled()) {
- mAnimationProperties.duration = ANIMATION_DURATION_HEADS_UP_DISAPPEAR;
- mAnimationProperties.setCustomInterpolator(View.TRANSLATION_Y,
- Interpolators.FAST_OUT_SLOW_IN_REVERSE);
- mAnimationProperties.getAnimationFilter().animateY = true;
- mTmpState.animateTo(changingView, mAnimationProperties);
- }
} else if (endRunnable != null) {
endRunnable.run();
}
@@ -589,15 +585,6 @@
return needsCustomAnimation;
}
- private float getHeadsUpYTranslationStart(boolean headsUpFromBottom) {
- if (headsUpFromBottom) {
- // start from the bottom of the screen
- return mHeadsUpAppearHeightBottom + mHeadsUpAppearStartAboveScreen;
- }
- // start from the top of the screen
- return -mStackTopMargin - mHeadsUpAppearStartAboveScreen;
- }
-
public void animateOverScrollToAmount(float targetAmount, final boolean onTop,
final boolean isRubberbanded) {
final float startOverScrollAmount = mHostLayout.getCurrentOverScrollAmount(onTop);
diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt
index 3d90cd2..5a57035 100644
--- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt
+++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/stack/StackStateAnimatorTest.kt
@@ -18,7 +18,6 @@
import android.platform.test.annotations.EnableFlags
import android.testing.AndroidTestingRunner
-import android.testing.TestableLooper.RunWithLooper
import androidx.test.filters.SmallTest
import com.android.systemui.SysuiTestCase
import com.android.systemui.statusbar.notification.row.ExpandableView
@@ -42,7 +41,6 @@
@SmallTest
@RunWith(AndroidTestingRunner::class)
-@RunWithLooper
class StackStateAnimatorTest : SysuiTestCase() {
private lateinit var stackStateAnimator: StackStateAnimator