Merge "Fixed that notifications could be stuck and invisible on AOD" into qt-dev
This commit is contained in:
@@ -149,6 +149,7 @@ constructor(context: Context,
|
|||||||
}
|
}
|
||||||
isExpanding = false
|
isExpanding = false
|
||||||
isWakingToShadeLocked = true
|
isWakingToShadeLocked = true
|
||||||
|
mWakeUpCoordinator.willWakeUp = true
|
||||||
mPowerManager!!.wakeUp(SystemClock.uptimeMillis(), WAKE_REASON_GESTURE,
|
mPowerManager!!.wakeUp(SystemClock.uptimeMillis(), WAKE_REASON_GESTURE,
|
||||||
"com.android.systemui:PULSEDRAG")
|
"com.android.systemui:PULSEDRAG")
|
||||||
mShadeController!!.goToLockedShade(mStartingChild)
|
mShadeController!!.goToLockedShade(mStartingChild)
|
||||||
|
|||||||
@@ -63,6 +63,25 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
private var mWakingUp = false
|
private var mWakingUp = false
|
||||||
private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>()
|
private val mEntrySetToClearWhenFinished = mutableSetOf<NotificationEntry>()
|
||||||
private val mDozeParameters: DozeParameters;
|
private val mDozeParameters: DozeParameters;
|
||||||
|
var willWakeUp = false
|
||||||
|
set(value) {
|
||||||
|
if (value && mDozeAmount != 0.0f) {
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var pulsing: Boolean = false
|
||||||
|
set(value) {
|
||||||
|
field = value
|
||||||
|
if (value) {
|
||||||
|
// Only when setting pulsing to true we want an immediate update, since we get
|
||||||
|
// this already when the doze service finishes which is usually before we get
|
||||||
|
// the waking up callback
|
||||||
|
updateNotificationVisibility(animate = shouldAnimateVisibility(),
|
||||||
|
increaseSpeed = false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
mAmbientPulseManager.addListener(this)
|
mAmbientPulseManager.addListener(this)
|
||||||
@@ -92,8 +111,9 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun updateNotificationVisibility(animate: Boolean, increaseSpeed: Boolean) {
|
private fun updateNotificationVisibility(animate: Boolean, increaseSpeed: Boolean) {
|
||||||
var visible = mNotificationsVisibleForExpansion || mAmbientPulseManager.hasNotifications()
|
var visible = (mNotificationsVisibleForExpansion || mAmbientPulseManager.hasNotifications())
|
||||||
if (!visible && mNotificationsVisible && mWakingUp && mDozeAmount != 0.0f) {
|
&& pulsing;
|
||||||
|
if (!visible && mNotificationsVisible && (mWakingUp || willWakeUp) && mDozeAmount != 0.0f) {
|
||||||
// let's not make notifications invisible while waking up, otherwise the animation
|
// let's not make notifications invisible while waking up, otherwise the animation
|
||||||
// is strange
|
// is strange
|
||||||
return;
|
return;
|
||||||
@@ -192,6 +212,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun setWakingUp(wakingUp: Boolean) {
|
fun setWakingUp(wakingUp: Boolean) {
|
||||||
|
willWakeUp = false
|
||||||
mWakingUp = wakingUp
|
mWakingUp = wakingUp
|
||||||
if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion) {
|
if (wakingUp && mNotificationsVisible && !mNotificationsVisibleForExpansion) {
|
||||||
// We're waking up while pulsing, let's make sure the animation looks nice
|
// We're waking up while pulsing, let's make sure the animation looks nice
|
||||||
@@ -200,9 +221,9 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAmbientStateChanged(entry: NotificationEntry, isPulsing: Boolean) {
|
override fun onAmbientStateChanged(entry: NotificationEntry, isPulsing: Boolean) {
|
||||||
var animate = mDozeParameters.getAlwaysOn() && !mDozeParameters.getDisplayNeedsBlanking()
|
var animate = shouldAnimateVisibility()
|
||||||
if (!isPulsing) {
|
if (!isPulsing) {
|
||||||
if (mLinearDozeAmount != 0.0f) {
|
if (mLinearDozeAmount != 0.0f && mLinearVisibilityAmount != 0.0f) {
|
||||||
if (entry.isRowDismissed) {
|
if (entry.isRowDismissed) {
|
||||||
// if we animate, we see the shelf briefly visible. Instead we fully animate
|
// if we animate, we see the shelf briefly visible. Instead we fully animate
|
||||||
// the notification and its background out
|
// the notification and its background out
|
||||||
@@ -218,4 +239,7 @@ class NotificationWakeUpCoordinator @Inject constructor(
|
|||||||
}
|
}
|
||||||
updateNotificationVisibility(animate, increaseSpeed = false)
|
updateNotificationVisibility(animate, increaseSpeed = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun shouldAnimateVisibility() =
|
||||||
|
mDozeParameters.getAlwaysOn() && !mDozeParameters.getDisplayNeedsBlanking()
|
||||||
}
|
}
|
||||||
@@ -340,6 +340,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl
|
|||||||
&& !NotificationStackScrollLayout.isPinnedHeadsUp(getParent())
|
&& !NotificationStackScrollLayout.isPinnedHeadsUp(getParent())
|
||||||
&& !mParent.areGutsExposed()
|
&& !mParent.areGutsExposed()
|
||||||
&& !mParent.isDark()
|
&& !mParent.isDark()
|
||||||
|
&& !mParent.showingAmbientPulsing()
|
||||||
&& (mCheckForDrag == null || !mHandler.hasCallbacks(mCheckForDrag))) {
|
&& (mCheckForDrag == null || !mHandler.hasCallbacks(mCheckForDrag))) {
|
||||||
// Only show the menu if we're not a heads up view and guts aren't exposed.
|
// Only show the menu if we're not a heads up view and guts aren't exposed.
|
||||||
mCheckForDrag = new CheckForDrag();
|
mCheckForDrag = new CheckForDrag();
|
||||||
|
|||||||
@@ -395,6 +395,13 @@ public class AmbientState {
|
|||||||
mPulsing = hasPulsing;
|
mPulsing = hasPulsing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return if we're pulsing in general
|
||||||
|
*/
|
||||||
|
public boolean isPulsing() {
|
||||||
|
return mPulsing;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isPulsing(NotificationEntry entry) {
|
public boolean isPulsing(NotificationEntry entry) {
|
||||||
if (!mPulsing || mAmbientPulseManager == null) {
|
if (!mPulsing || mAmbientPulseManager == null) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ class NotificationSection {
|
|||||||
+ ExpandableViewState.getFinalActualHeight(firstView));
|
+ ExpandableViewState.getFinalActualHeight(firstView));
|
||||||
if (shiftBackgroundWithFirst) {
|
if (shiftBackgroundWithFirst) {
|
||||||
mBounds.left += Math.max(firstView.getTranslation(), 0);
|
mBounds.left += Math.max(firstView.getTranslation(), 0);
|
||||||
|
mBounds.right += Math.min(firstView.getTranslation(), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -871,6 +871,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
int lastSectionBottom =
|
int lastSectionBottom =
|
||||||
mSections[0].getCurrentBounds().bottom + animationYOffset;
|
mSections[0].getCurrentBounds().bottom + animationYOffset;
|
||||||
int previousLeft = left;
|
int previousLeft = left;
|
||||||
|
int previousRight = right;
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (NotificationSection section : mSections) {
|
for (NotificationSection section : mSections) {
|
||||||
if (section.getFirstVisibleChild() == null) {
|
if (section.getFirstVisibleChild() == null) {
|
||||||
@@ -878,6 +879,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
}
|
}
|
||||||
int sectionTop = section.getCurrentBounds().top + animationYOffset;
|
int sectionTop = section.getCurrentBounds().top + animationYOffset;
|
||||||
int ownLeft = Math.min(Math.max(left, section.getCurrentBounds().left), right);
|
int ownLeft = Math.min(Math.max(left, section.getCurrentBounds().left), right);
|
||||||
|
int ownRight = Math.max(Math.min(right, section.getCurrentBounds().right), ownLeft);
|
||||||
// If sections are directly adjacent to each other, we don't want to draw them
|
// If sections are directly adjacent to each other, we don't want to draw them
|
||||||
// as separate roundrects, as the rounded corners right next to each other look
|
// as separate roundrects, as the rounded corners right next to each other look
|
||||||
// bad.
|
// bad.
|
||||||
@@ -885,19 +887,20 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
|| (previousLeft != ownLeft && !first)) {
|
|| (previousLeft != ownLeft && !first)) {
|
||||||
canvas.drawRoundRect(ownLeft,
|
canvas.drawRoundRect(ownLeft,
|
||||||
backgroundRectTop,
|
backgroundRectTop,
|
||||||
right,
|
ownRight,
|
||||||
lastSectionBottom,
|
lastSectionBottom,
|
||||||
mCornerRadius, mCornerRadius, mBackgroundPaint);
|
mCornerRadius, mCornerRadius, mBackgroundPaint);
|
||||||
backgroundRectTop = sectionTop;
|
backgroundRectTop = sectionTop;
|
||||||
}
|
}
|
||||||
previousLeft = ownLeft;
|
previousLeft = ownLeft;
|
||||||
|
previousRight = ownRight;
|
||||||
lastSectionBottom =
|
lastSectionBottom =
|
||||||
section.getCurrentBounds().bottom + animationYOffset;
|
section.getCurrentBounds().bottom + animationYOffset;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
canvas.drawRoundRect(previousLeft,
|
canvas.drawRoundRect(previousLeft,
|
||||||
backgroundRectTop,
|
backgroundRectTop,
|
||||||
right,
|
previousRight,
|
||||||
lastSectionBottom,
|
lastSectionBottom,
|
||||||
mCornerRadius, mCornerRadius, mBackgroundPaint);
|
mCornerRadius, mCornerRadius, mBackgroundPaint);
|
||||||
}
|
}
|
||||||
@@ -2406,11 +2409,6 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
mAmbientState.setLayoutMaxHeight(mContentHeight);
|
mAmbientState.setLayoutMaxHeight(mContentHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
|
||||||
private boolean isPulsing(NotificationEntry entry) {
|
|
||||||
return mAmbientState.isPulsing(entry);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
@ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
|
||||||
public boolean hasPulsingNotifications() {
|
public boolean hasPulsingNotifications() {
|
||||||
@@ -5170,6 +5168,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
|
|||||||
}
|
}
|
||||||
mPulsing = pulsing;
|
mPulsing = pulsing;
|
||||||
mAmbientState.setPulsing(pulsing);
|
mAmbientState.setPulsing(pulsing);
|
||||||
|
mSwipeHelper.setPulsing(pulsing);
|
||||||
updateNotificationAnimationStates();
|
updateNotificationAnimationStates();
|
||||||
updateAlgorithmHeightAndPadding();
|
updateAlgorithmHeightAndPadding();
|
||||||
updateContentHeight();
|
updateContentHeight();
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class NotificationSwipeHelper extends SwipeHelper
|
|||||||
|
|
||||||
private NotificationMenuRowPlugin mCurrMenuRow;
|
private NotificationMenuRowPlugin mCurrMenuRow;
|
||||||
private boolean mIsExpanded;
|
private boolean mIsExpanded;
|
||||||
|
private boolean mPulsing;
|
||||||
|
|
||||||
public NotificationSwipeHelper(int swipeDirection, NotificationCallback callback,
|
public NotificationSwipeHelper(int swipeDirection, NotificationCallback callback,
|
||||||
Context context, NotificationMenuRowPlugin.OnMenuEventListener menuListener) {
|
Context context, NotificationMenuRowPlugin.OnMenuEventListener menuListener) {
|
||||||
@@ -205,7 +206,8 @@ class NotificationSwipeHelper extends SwipeHelper
|
|||||||
boolean slowSwipedFarEnough = swipedEnoughToShowMenu(menuRow) && isSlowSwipe;
|
boolean slowSwipedFarEnough = swipedEnoughToShowMenu(menuRow) && isSlowSwipe;
|
||||||
boolean isFastNonDismissGesture =
|
boolean isFastNonDismissGesture =
|
||||||
gestureFastEnough && !gestureTowardsMenu && !isDismissGesture;
|
gestureFastEnough && !gestureTowardsMenu && !isDismissGesture;
|
||||||
boolean isAbleToShowMenu = menuRow.shouldShowGutsOnSnapOpen() || mIsExpanded;
|
boolean isAbleToShowMenu = menuRow.shouldShowGutsOnSnapOpen()
|
||||||
|
|| mIsExpanded && !mPulsing;
|
||||||
boolean isMenuRevealingGestureAwayFromMenu = slowSwipedFarEnough
|
boolean isMenuRevealingGestureAwayFromMenu = slowSwipedFarEnough
|
||||||
|| (isFastNonDismissGesture && isAbleToShowMenu);
|
|| (isFastNonDismissGesture && isAbleToShowMenu);
|
||||||
int menuSnapTarget = menuRow.getMenuSnapTarget();
|
int menuSnapTarget = menuRow.getMenuSnapTarget();
|
||||||
@@ -436,6 +438,10 @@ class NotificationSwipeHelper extends SwipeHelper
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setPulsing(boolean pulsing) {
|
||||||
|
mPulsing = pulsing;
|
||||||
|
}
|
||||||
|
|
||||||
public interface NotificationCallback extends SwipeHelper.Callback{
|
public interface NotificationCallback extends SwipeHelper.Callback{
|
||||||
/**
|
/**
|
||||||
* @return if the view should be dismissed as soon as the touch is released, otherwise its
|
* @return if the view should be dismissed as soon as the touch is released, otherwise its
|
||||||
|
|||||||
@@ -3982,6 +3982,7 @@ public class StatusBar extends SystemUI implements DemoMode,
|
|||||||
}
|
}
|
||||||
updateScrimController();
|
updateScrimController();
|
||||||
mPulseExpansionHandler.setPulsing(pulsing);
|
mPulseExpansionHandler.setPulsing(pulsing);
|
||||||
|
mWakeUpCoordinator.setPulsing(pulsing);
|
||||||
}
|
}
|
||||||
}, reason);
|
}, reason);
|
||||||
// DozeScrimController is in pulse state, now let's ask ScrimController to start
|
// DozeScrimController is in pulse state, now let's ask ScrimController to start
|
||||||
|
|||||||
Reference in New Issue
Block a user