diff options
| author | 2017-06-01 17:40:42 +0000 | |
|---|---|---|
| committer | 2017-06-01 17:40:48 +0000 | |
| commit | a7a39ea187480e86023ac92e6570dac0f9e40e2e (patch) | |
| tree | 967c821971857d6f9cba258cbae6eda74d5890c0 | |
| parent | bfa8b3d542377567f1b26c2e2a3992f66ad4d939 (diff) | |
| parent | be2c443e21410bb27decec5d2aea60ef37f10c05 (diff) | |
Merge "Fixed an issue where the panel could be stuck tracking" into oc-dev
6 files changed, 51 insertions, 30 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index 5cb3c1f1f7cd..8368143b176d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -165,7 +165,7 @@ public class NotificationShelf extends ActivatableNotificationView implements 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; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java index 4b1d7d7e4508..b1d82b1198a3 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java @@ -55,6 +55,7 @@ public abstract class PanelView extends FrameLayout { 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)); @@ -507,7 +508,7 @@ public abstract class PanelView extends FrameLayout { @Override public boolean onInterceptTouchEvent(MotionEvent event) { - if (mInstantExpanding || !mNotificationsDragEnabled + if (mInstantExpanding || !mNotificationsDragEnabled || mTouchDisabled || (mMotionAborted && event.getActionMasked() != MotionEvent.ACTION_DOWN)) { return false; } @@ -758,14 +759,14 @@ public abstract class PanelView extends FrameLayout { if (clearAllExpandHack && !mCancelled) { setExpandedHeightInternal(getMaxPanelHeight()); } - mHeightAnimator = null; + setAnimator(null); if (!mCancelled) { notifyExpandingFinished(); } notifyBarPanelExpansionChanged(); } }); - mHeightAnimator = animator; + setAnimator(animator); animator.start(); } @@ -802,15 +803,28 @@ public abstract class PanelView extends FrameLayout { 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) { @@ -1062,7 +1076,7 @@ public abstract class PanelView extends FrameLayout { @Override public void onAnimationEnd(Animator animation) { if (mCancelled) { - mHeightAnimator = null; + setAnimator(null); onAnimationFinished.run(); } else { startUnlockHintAnimationPhase2(onAnimationFinished); @@ -1070,7 +1084,7 @@ public abstract class PanelView extends FrameLayout { } }); animator.start(); - mHeightAnimator = animator; + setAnimator(animator); mKeyguardBottomArea.getIndicationArea().animate() .translationY(-mHintDistance) .setDuration(250) @@ -1088,6 +1102,14 @@ public abstract class PanelView extends FrameLayout { .start(); } + private void setAnimator(ValueAnimator animator) { + mHeightAnimator = animator; + if (animator == null && mPanelUpdateWhenAnimatorEnds) { + mPanelUpdateWhenAnimatorEnds = false; + requestPanelHeightUpdate(); + } + } + /** * Phase 2: Bounce down. */ @@ -1098,13 +1120,13 @@ public abstract class PanelView extends FrameLayout { 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) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java index 24c19282a4f6..4e28e90a1402 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -4940,7 +4940,6 @@ public class StatusBar extends SystemUI implements DemoMode, where.getLocationInWindow(mTmpInt2); mWakeUpTouchLocation = new PointF(mTmpInt2[0] + where.getWidth() / 2, mTmpInt2[1] + where.getHeight() / 2); - mNotificationPanel.setTouchDisabled(false); mStatusBarKeyguardViewManager.notifyDeviceWakeUpRequested(); mFalsingManager.onScreenOnFromTouch(); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java index f050be4720b7..236e008d4296 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarWindowView.java @@ -277,7 +277,7 @@ public class StatusBarWindowView extends FrameLayout { @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; } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java index e409b9c4454f..41ef78121c12 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java @@ -59,7 +59,7 @@ public class AmbientState { private boolean mPanelTracking; private boolean mExpansionChanging; private boolean mPanelFullWidth; - private boolean mPulsing; + private boolean mHasPulsingNotifications; private boolean mUnlockHintRunning; public AmbientState(Context context) { @@ -287,12 +287,12 @@ public class AmbientState { 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() { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java index 431f646163f5..aeaa5afa2081 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -53,7 +53,6 @@ import android.view.ViewTreeObserver; 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; @@ -1941,7 +1940,7 @@ public class NotificationStackScrollLayout extends ViewGroup int numShownItems = 0; boolean finish = false; int maxDisplayedNotifications = mAmbientState.isDark() - ? (isPulsing() ? 1 : 0) + ? (hasPulsingNotifications() ? 1 : 0) : mMaxDisplayedNotifications; for (int i = 0; i < getChildCount(); i++) { @@ -1950,7 +1949,8 @@ public class NotificationStackScrollLayout extends ViewGroup && !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) { @@ -2008,7 +2008,7 @@ public class NotificationStackScrollLayout extends ViewGroup return false; } - private boolean isPulsing() { + public boolean hasPulsingNotifications() { return mPulsing != null; } @@ -2837,7 +2837,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private void updateNotificationAnimationStates() { - boolean running = mAnimationsEnabled || isPulsing(); + boolean running = mAnimationsEnabled || hasPulsingNotifications(); mShelf.setAnimationsEnabled(running); int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { @@ -2848,7 +2848,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private void updateAnimationState(View child) { - updateAnimationState((mAnimationsEnabled || isPulsing()) + updateAnimationState((mAnimationsEnabled || hasPulsingNotifications()) && (mIsExpanded || isPinnedHeadsUp(child)), child); } @@ -4117,7 +4117,7 @@ public class NotificationStackScrollLayout extends ViewGroup return; } mPulsing = pulsing; - mAmbientState.setPulsing(isPulsing()); + mAmbientState.setHasPulsingNotifications(hasPulsingNotifications()); updateNotificationAnimationStates(); updateContentHeight(); notifyHeightChangeListener(mShelf); |