Merge "Remove ExpandableNotificationRow#isBlockingHelperShowing" into tm-qpr-dev am: acb2d9fc59

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

Change-Id: I5e72f008fe210e764bd53a5392487e5d4fe9a130
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
András Kurucz
2023-03-08 16:40:17 +00:00
committed by Automerger Merge Worker
6 changed files with 34 additions and 107 deletions

View File

@@ -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;
@@ -208,11 +207,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
*/
@@ -1565,18 +1559,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()) {
@@ -2155,10 +2137,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
@@ -2186,10 +2165,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();
@@ -2198,10 +2173,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) {
@@ -2223,9 +2194,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();

View File

@@ -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,66 +308,45 @@ 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);
// Make sure we'll be visible after the circular reveal
setAlpha(1f);
// Circular reveal originating at (x, y)
Animator a = ViewAnimationUtils.createCircularReveal(this, x, y, 0, r);
a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
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();
}
double horz = Math.max(getWidth() - x, x);
double vert = Math.max(getHeight() - y, y);
float r = (float) Math.hypot(horz, vert);
// Make sure we'll be visible after the circular reveal
setAlpha(1f);
// Circular reveal originating at (x, y)
Animator a = ViewAnimationUtils.createCircularReveal(this, x, y, 0, r);
a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
a.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
a.addListener(new AnimateOpenListener(onAnimationEnd));
a.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;
y = (getTop() + getHeight() / 2);
}
double horz = Math.max(getWidth() - x, x);
double vert = Math.max(getHeight() - y, y);
float r = (float) Math.hypot(horz, vert);
Animator a = ViewAnimationUtils.createCircularReveal(this,
x, y, r, 0);
a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
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();
// Circular reveal originating at (x, y)
if (x == -1 || y == -1) {
x = (getLeft() + getRight()) / 2;
y = (getTop() + getHeight() / 2);
}
double horz = Math.max(getWidth() - x, x);
double vert = Math.max(getHeight() - y, y);
float r = (float) Math.hypot(horz, vert);
Animator a = ViewAnimationUtils.createCircularReveal(this,
x, y, r, 0);
a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
a.setInterpolator(Interpolators.FAST_OUT_LINEAR_IN);
a.addListener(new AnimateCloseListener(this /* view */, mGutsContent));
a.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;

View File

@@ -629,7 +629,6 @@ public class NotificationGutsManager implements NotifGutsViewManager {
!mAccessibilityManager.isTouchExplorationEnabled());
guts.openControls(
!row.isBlockingHelperShowing(),
x,
y,
needsFalsingProtection,

View File

@@ -402,17 +402,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();

View File

@@ -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();

View File

@@ -76,7 +76,7 @@ class NotificationGutsTest : SysuiTestCase() {
fun openControls() {
guts.gutsContent = gutsContent
guts.openControls(true, 0, 0, false, null)
guts.openControls(0, 0, false, null)
}
@Test