openedAmount = Math.min(1.0f, openedAmount);
mShelfState.openedAmount = openedAmount;
mShelfState.clipTopAmount = 0;
- mShelfState.alpha = mAmbientState.isPulsing() ? 0 : 1;
+ mShelfState.alpha = mAmbientState.hasPulsingNotifications() ? 0 : 1;
mShelfState.belowSpeedBump = mAmbientState.getSpeedBumpIndex() == 0;
mShelfState.shadowAlpha = 1.0f;
mShelfState.hideSensitive = false;
private long mDownTime;
private float mMinExpandHeight;
private LockscreenGestureLogger mLockscreenGestureLogger = new LockscreenGestureLogger();
+ private boolean mPanelUpdateWhenAnimatorEnds;
private final void logf(String fmt, Object... args) {
Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
- if (mInstantExpanding || !mNotificationsDragEnabled
+ if (mInstantExpanding || !mNotificationsDragEnabled || mTouchDisabled
|| (mMotionAborted && event.getActionMasked() != MotionEvent.ACTION_DOWN)) {
return false;
}
if (clearAllExpandHack && !mCancelled) {
setExpandedHeightInternal(getMaxPanelHeight());
}
- mHeightAnimator = null;
+ setAnimator(null);
if (!mCancelled) {
notifyExpandingFinished();
}
notifyBarPanelExpansionChanged();
}
});
- mHeightAnimator = animator;
+ setAnimator(animator);
animator.start();
}
protected void requestPanelHeightUpdate() {
float currentMaxPanelHeight = getMaxPanelHeight();
- // If the user isn't actively poking us, let's update the height
- if ((!mTracking || isTrackingBlocked())
- && mHeightAnimator == null
- && !isFullyCollapsed()
- && currentMaxPanelHeight != mExpandedHeight
- && mPeekAnimator == null
- && !mPeekTouching) {
- setExpandedHeight(currentMaxPanelHeight);
+ if (isFullyCollapsed()) {
+ return;
+ }
+
+ if (currentMaxPanelHeight == mExpandedHeight) {
+ return;
+ }
+
+ if (mPeekAnimator != null || mPeekTouching) {
+ return;
+ }
+
+ if (mTracking && !isTrackingBlocked()) {
+ return;
+ }
+
+ if (mHeightAnimator != null) {
+ mPanelUpdateWhenAnimatorEnds = true;
+ return;
}
+
+ setExpandedHeight(currentMaxPanelHeight);
}
public void setExpandedHeightInternal(float h) {
@Override
public void onAnimationEnd(Animator animation) {
if (mCancelled) {
- mHeightAnimator = null;
+ setAnimator(null);
onAnimationFinished.run();
} else {
startUnlockHintAnimationPhase2(onAnimationFinished);
}
});
animator.start();
- mHeightAnimator = animator;
+ setAnimator(animator);
mKeyguardBottomArea.getIndicationArea().animate()
.translationY(-mHintDistance)
.setDuration(250)
.start();
}
+ private void setAnimator(ValueAnimator animator) {
+ mHeightAnimator = animator;
+ if (animator == null && mPanelUpdateWhenAnimatorEnds) {
+ mPanelUpdateWhenAnimatorEnds = false;
+ requestPanelHeightUpdate();
+ }
+ }
+
/**
* Phase 2: Bounce down.
*/
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- mHeightAnimator = null;
+ setAnimator(null);
onAnimationFinished.run();
notifyBarPanelExpansionChanged();
}
});
animator.start();
- mHeightAnimator = animator;
+ setAnimator(animator);
}
private ValueAnimator createHeightAnimator(float targetHeight) {
where.getLocationInWindow(mTmpInt2);
mWakeUpTouchLocation = new PointF(mTmpInt2[0] + where.getWidth() / 2,
mTmpInt2[1] + where.getHeight() / 2);
- mNotificationPanel.setTouchDisabled(false);
mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested();
mFalsingManager.onScreenOnFromTouch();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
- if (mService.isDozing() && !mService.isPulsing()) {
+ if (mService.isDozing() && !mStackScrollLayout.hasPulsingNotifications()) {
// Capture all touch events in always-on.
return true;
}
private boolean mPanelTracking;
private boolean mExpansionChanging;
private boolean mPanelFullWidth;
- private boolean mPulsing;
+ private boolean mHasPulsingNotifications;
private boolean mUnlockHintRunning;
public AmbientState(Context context) {
mPanelTracking = panelTracking;
}
- public boolean isPulsing() {
- return mPulsing;
+ public boolean hasPulsingNotifications() {
+ return mHasPulsingNotifications;
}
- public void setPulsing(boolean pulsing) {
- mPulsing = pulsing;
+ public void setHasPulsingNotifications(boolean hasPulsing) {
+ mHasPulsingNotifications = hasPulsing;
}
public boolean isPanelTracking() {
import android.view.WindowInsets;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
-import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import android.widget.OverScroller;
int numShownItems = 0;
boolean finish = false;
int maxDisplayedNotifications = mAmbientState.isDark()
- ? (isPulsing() ? 1 : 0)
+ ? (hasPulsingNotifications() ? 1 : 0)
: mMaxDisplayedNotifications;
for (int i = 0; i < getChildCount(); i++) {
&& !expandableView.hasNoContentHeight()) {
boolean limitReached = maxDisplayedNotifications != -1
&& numShownItems >= maxDisplayedNotifications;
- boolean notificationOnAmbientThatIsNotPulsing = isPulsing()
+ boolean notificationOnAmbientThatIsNotPulsing = mAmbientState.isDark()
+ && hasPulsingNotifications()
&& expandableView instanceof ExpandableNotificationRow
&& !isPulsing(((ExpandableNotificationRow) expandableView).getEntry());
if (limitReached || notificationOnAmbientThatIsNotPulsing) {
return false;
}
- private boolean isPulsing() {
+ public boolean hasPulsingNotifications() {
return mPulsing != null;
}
}
private void updateNotificationAnimationStates() {
- boolean running = mAnimationsEnabled || isPulsing();
+ boolean running = mAnimationsEnabled || hasPulsingNotifications();
mShelf.setAnimationsEnabled(running);
int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
}
private void updateAnimationState(View child) {
- updateAnimationState((mAnimationsEnabled || isPulsing())
+ updateAnimationState((mAnimationsEnabled || hasPulsingNotifications())
&& (mIsExpanded || isPinnedHeadsUp(child)), child);
}
return;
}
mPulsing = pulsing;
- mAmbientState.setPulsing(isPulsing());
+ mAmbientState.setHasPulsingNotifications(hasPulsingNotifications());
updateNotificationAnimationStates();
updateContentHeight();
notifyHeightChangeListener(mShelf);