Merge "Remove ExpandableNotificationRow#isBlockingHelperShowing" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
acb2d9fc59
@@ -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
|
// 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.
|
// the background on first content update just in case it happens to be during a theme change.
|
||||||
private boolean mUpdateSelfBackgroundOnUpdate = true;
|
private boolean mUpdateSelfBackgroundOnUpdate = true;
|
||||||
private boolean mNotificationTranslationFinished = false;
|
|
||||||
private boolean mIsSnoozed;
|
private boolean mIsSnoozed;
|
||||||
private boolean mIsFaded;
|
private boolean mIsFaded;
|
||||||
private boolean mAnimatePinnedRoundness = false;
|
private boolean mAnimatePinnedRoundness = false;
|
||||||
@@ -208,11 +207,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
* If {@link #mHasUserChangedExpansion}, has the user expanded this row
|
* If {@link #mHasUserChangedExpansion}, has the user expanded this row
|
||||||
*/
|
*/
|
||||||
private boolean mUserExpanded;
|
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
|
* 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
|
@Override
|
||||||
public View getShelfTransformationTarget() {
|
public View getShelfTransformationTarget() {
|
||||||
if (mIsSummaryWithChildren && !shouldShowPublic()) {
|
if (mIsSummaryWithChildren && !shouldShowPublic()) {
|
||||||
@@ -2155,10 +2137,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
@Override
|
@Override
|
||||||
public void setTranslation(float translationX) {
|
public void setTranslation(float translationX) {
|
||||||
invalidate();
|
invalidate();
|
||||||
if (isBlockingHelperShowingAndTranslationFinished()) {
|
if (mDismissUsingRowTranslationX) {
|
||||||
mGuts.setTranslationX(translationX);
|
|
||||||
return;
|
|
||||||
} else if (mDismissUsingRowTranslationX) {
|
|
||||||
setTranslationX(translationX);
|
setTranslationX(translationX);
|
||||||
} else if (mTranslateableViews != null) {
|
} else if (mTranslateableViews != null) {
|
||||||
// Translate the group of views
|
// Translate the group of views
|
||||||
@@ -2186,10 +2165,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
return getTranslationX();
|
return getTranslationX();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isBlockingHelperShowingAndCanTranslate()) {
|
|
||||||
return mGuts.getTranslationX();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mTranslateableViews != null && mTranslateableViews.size() > 0) {
|
if (mTranslateableViews != null && mTranslateableViews.size() > 0) {
|
||||||
// All of the views in the list should have same translation, just use first one.
|
// All of the views in the list should have same translation, just use first one.
|
||||||
return mTranslateableViews.get(0).getTranslationX();
|
return mTranslateableViews.get(0).getTranslationX();
|
||||||
@@ -2198,10 +2173,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBlockingHelperShowingAndCanTranslate() {
|
|
||||||
return areGutsExposed() && mIsBlockingHelperShowing && mNotificationTranslationFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Animator getTranslateViewAnimator(final float leftTarget,
|
public Animator getTranslateViewAnimator(final float leftTarget,
|
||||||
AnimatorUpdateListener listener) {
|
AnimatorUpdateListener listener) {
|
||||||
if (mTranslateAnim != null) {
|
if (mTranslateAnim != null) {
|
||||||
@@ -2223,9 +2194,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator anim) {
|
public void onAnimationEnd(Animator anim) {
|
||||||
if (mIsBlockingHelperShowing) {
|
|
||||||
mNotificationTranslationFinished = true;
|
|
||||||
}
|
|
||||||
if (!cancelled && leftTarget == 0) {
|
if (!cancelled && leftTarget == 0) {
|
||||||
if (mMenuRow != null) {
|
if (mMenuRow != null) {
|
||||||
mMenuRow.resetMenu();
|
mMenuRow.resetMenu();
|
||||||
|
|||||||
@@ -238,12 +238,11 @@ public class NotificationGuts extends FrameLayout {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void openControls(
|
public void openControls(
|
||||||
boolean shouldDoCircularReveal,
|
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
boolean needsFalsingProtection,
|
boolean needsFalsingProtection,
|
||||||
@Nullable Runnable onAnimationEnd) {
|
@Nullable Runnable onAnimationEnd) {
|
||||||
animateOpen(shouldDoCircularReveal, x, y, onAnimationEnd);
|
animateOpen(x, y, onAnimationEnd);
|
||||||
setExposed(true /* exposed */, needsFalsingProtection);
|
setExposed(true /* exposed */, needsFalsingProtection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +299,7 @@ public class NotificationGuts extends FrameLayout {
|
|||||||
if (mGutsContent == null
|
if (mGutsContent == null
|
||||||
|| !mGutsContent.handleCloseControls(save, force)) {
|
|| !mGutsContent.handleCloseControls(save, force)) {
|
||||||
// We only want to do a circular reveal if we're not showing the blocking helper.
|
// 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);
|
setExposed(false, mNeedsFalsingProtection);
|
||||||
if (mClosedListener != null) {
|
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. */
|
/** Animates in the guts view with a circular reveal. */
|
||||||
private void animateOpen(
|
private void animateOpen(int x, int y, @Nullable Runnable onAnimationEnd) {
|
||||||
boolean shouldDoCircularReveal, int x, int y, @Nullable Runnable onAnimationEnd) {
|
|
||||||
if (isAttachedToWindow()) {
|
if (isAttachedToWindow()) {
|
||||||
if (shouldDoCircularReveal) {
|
double horz = Math.max(getWidth() - x, x);
|
||||||
double horz = Math.max(getWidth() - x, x);
|
double vert = Math.max(getHeight() - y, y);
|
||||||
double vert = Math.max(getHeight() - y, y);
|
float r = (float) Math.hypot(horz, vert);
|
||||||
float r = (float) Math.hypot(horz, vert);
|
// Make sure we'll be visible after the circular reveal
|
||||||
// Make sure we'll be visible after the circular reveal
|
setAlpha(1f);
|
||||||
setAlpha(1f);
|
// Circular reveal originating at (x, y)
|
||||||
// Circular reveal originating at (x, y)
|
Animator a = ViewAnimationUtils.createCircularReveal(this, x, y, 0, r);
|
||||||
Animator a = ViewAnimationUtils.createCircularReveal(this, x, y, 0, r);
|
a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
||||||
a.setDuration(StackStateAnimator.ANIMATION_DURATION_STANDARD);
|
a.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
|
||||||
a.setInterpolator(Interpolators.LINEAR_OUT_SLOW_IN);
|
a.addListener(new AnimateOpenListener(onAnimationEnd));
|
||||||
a.addListener(new AnimateOpenListener(onAnimationEnd));
|
a.start();
|
||||||
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 {
|
} else {
|
||||||
Log.w(TAG, "Failed to animate guts open");
|
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
|
@VisibleForTesting
|
||||||
void animateClose(int x, int y, boolean shouldDoCircularReveal) {
|
void animateClose(int x, int y) {
|
||||||
if (isAttachedToWindow()) {
|
if (isAttachedToWindow()) {
|
||||||
if (shouldDoCircularReveal) {
|
// Circular reveal originating at (x, y)
|
||||||
// Circular reveal originating at (x, y)
|
if (x == -1 || y == -1) {
|
||||||
if (x == -1 || y == -1) {
|
x = (getLeft() + getRight()) / 2;
|
||||||
x = (getLeft() + getRight()) / 2;
|
y = (getTop() + getHeight() / 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();
|
|
||||||
}
|
}
|
||||||
|
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 {
|
} else {
|
||||||
Log.w(TAG, "Failed to animate guts close");
|
Log.w(TAG, "Failed to animate guts close");
|
||||||
mGutsContent.onFinishedClosing();
|
mGutsContent.onFinishedClosing();
|
||||||
@@ -449,7 +427,7 @@ public class NotificationGuts extends FrameLayout {
|
|||||||
return mGutsContent != null && mGutsContent.isLeavebehind();
|
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 {
|
private static class AnimateOpenListener extends AnimatorListenerAdapter {
|
||||||
final Runnable mOnAnimationEnd;
|
final Runnable mOnAnimationEnd;
|
||||||
|
|
||||||
|
|||||||
@@ -629,7 +629,6 @@ public class NotificationGutsManager implements NotifGutsViewManager {
|
|||||||
!mAccessibilityManager.isTouchExplorationEnabled());
|
!mAccessibilityManager.isTouchExplorationEnabled());
|
||||||
|
|
||||||
guts.openControls(
|
guts.openControls(
|
||||||
!row.isBlockingHelperShowing(),
|
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
needsFalsingProtection,
|
needsFalsingProtection,
|
||||||
|
|||||||
@@ -402,17 +402,6 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
|
|||||||
verify(aboveShelfChangedListener).onAboveShelfStateChanged(false);
|
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
|
@Test
|
||||||
public void testGetNumUniqueChildren_defaultChannel() throws Exception {
|
public void testGetNumUniqueChildren_defaultChannel() throws Exception {
|
||||||
ExpandableNotificationRow groupRow = mNotificationTestHelper.createGroup();
|
ExpandableNotificationRow groupRow = mNotificationTestHelper.createGroup();
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
|
|||||||
@Mock private NotificationPresenter mPresenter;
|
@Mock private NotificationPresenter mPresenter;
|
||||||
@Mock private NotificationActivityStarter mNotificationActivityStarter;
|
@Mock private NotificationActivityStarter mNotificationActivityStarter;
|
||||||
@Mock private NotificationListContainer mNotificationListContainer;
|
@Mock private NotificationListContainer mNotificationListContainer;
|
||||||
@Mock private NotificationInfo.CheckSaveListener mCheckSaveListener;
|
|
||||||
@Mock private OnSettingsClickListener mOnSettingsClickListener;
|
@Mock private OnSettingsClickListener mOnSettingsClickListener;
|
||||||
@Mock private DeviceProvisionedController mDeviceProvisionedController;
|
@Mock private DeviceProvisionedController mDeviceProvisionedController;
|
||||||
@Mock private CentralSurfaces mCentralSurfaces;
|
@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.
|
// Test doesn't support animation since the guts view is not attached.
|
||||||
doNothing().when(guts).openControls(
|
doNothing().when(guts).openControls(
|
||||||
eq(true) /* shouldDoCircularReveal */,
|
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyBoolean(),
|
anyBoolean(),
|
||||||
@@ -190,7 +188,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
|
|||||||
assertEquals(View.INVISIBLE, guts.getVisibility());
|
assertEquals(View.INVISIBLE, guts.getVisibility());
|
||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
verify(guts).openControls(
|
verify(guts).openControls(
|
||||||
eq(true),
|
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyBoolean(),
|
anyBoolean(),
|
||||||
@@ -213,7 +210,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
|
|||||||
|
|
||||||
// Test doesn't support animation since the guts view is not attached.
|
// Test doesn't support animation since the guts view is not attached.
|
||||||
doNothing().when(guts).openControls(
|
doNothing().when(guts).openControls(
|
||||||
eq(true) /* shouldDoCircularReveal */,
|
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyBoolean(),
|
anyBoolean(),
|
||||||
@@ -237,7 +233,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
|
|||||||
assertTrue(mGutsManager.openGutsInternal(row, 0, 0, menuItem));
|
assertTrue(mGutsManager.openGutsInternal(row, 0, 0, menuItem));
|
||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
verify(guts).openControls(
|
verify(guts).openControls(
|
||||||
eq(true),
|
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyInt(),
|
anyInt(),
|
||||||
anyBoolean(),
|
anyBoolean(),
|
||||||
@@ -379,7 +374,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
|
|||||||
public void testInitializeNotificationInfoView_PassesAlongProvisionedState() throws Exception {
|
public void testInitializeNotificationInfoView_PassesAlongProvisionedState() throws Exception {
|
||||||
NotificationInfo notificationInfoView = mock(NotificationInfo.class);
|
NotificationInfo notificationInfoView = mock(NotificationInfo.class);
|
||||||
ExpandableNotificationRow row = spy(mHelper.createRow());
|
ExpandableNotificationRow row = spy(mHelper.createRow());
|
||||||
row.setBlockingHelperShowing(false);
|
|
||||||
modifyRanking(row.getEntry())
|
modifyRanking(row.getEntry())
|
||||||
.setUserSentiment(USER_SENTIMENT_NEGATIVE)
|
.setUserSentiment(USER_SENTIMENT_NEGATIVE)
|
||||||
.build();
|
.build();
|
||||||
@@ -414,7 +408,6 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
|
|||||||
public void testInitializeNotificationInfoView_withInitialAction() throws Exception {
|
public void testInitializeNotificationInfoView_withInitialAction() throws Exception {
|
||||||
NotificationInfo notificationInfoView = mock(NotificationInfo.class);
|
NotificationInfo notificationInfoView = mock(NotificationInfo.class);
|
||||||
ExpandableNotificationRow row = spy(mHelper.createRow());
|
ExpandableNotificationRow row = spy(mHelper.createRow());
|
||||||
row.setBlockingHelperShowing(true);
|
|
||||||
modifyRanking(row.getEntry())
|
modifyRanking(row.getEntry())
|
||||||
.setUserSentiment(USER_SENTIMENT_NEGATIVE)
|
.setUserSentiment(USER_SENTIMENT_NEGATIVE)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class NotificationGutsTest : SysuiTestCase() {
|
|||||||
fun openControls() {
|
fun openControls() {
|
||||||
guts.gutsContent = gutsContent
|
guts.gutsContent = gutsContent
|
||||||
|
|
||||||
guts.openControls(true, 0, 0, false, null)
|
guts.openControls(0, 0, false, null)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user