diff options
| author | 2017-07-13 16:29:21 +0000 | |
|---|---|---|
| committer | 2017-07-13 16:29:21 +0000 | |
| commit | ac77186d349480edaea3c513dc4cae672fda7d0c (patch) | |
| tree | ac5104c3103ab962a00cf29653674dd3e5bf58a8 | |
| parent | 4c44a3059c41c5ae95d40be2a4514198e9bbc435 (diff) | |
| parent | ebf423466cff0b2db08d322dbf9772e9b1a3bbf1 (diff) | |
Merge "Fixed a bug where an incoming call wasn't launching" into oc-dr1-dev
5 files changed, 65 insertions, 19 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java index a60102854618..e5f68ad60089 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/NotificationShelf.java @@ -298,7 +298,8 @@ public class NotificationShelf extends ActivatableNotificationView implements private void updateNotificationClipHeight(ExpandableNotificationRow row, float notificationClipEnd) { float viewEnd = row.getTranslationY() + row.getActualHeight(); - boolean isPinned = row.isPinned() || row.isHeadsUpAnimatingAway(); + boolean isPinned = (row.isPinned() || row.isHeadsUpAnimatingAway()) + && !mAmbientState.isDozingAndNotPulsing(row); if (viewEnd > notificationClipEnd && (mAmbientState.isShadeExpanded() || !isPinned)) { int clipBottomAmount = (int) (viewEnd - notificationClipEnd); @@ -450,7 +451,7 @@ public class NotificationShelf extends ActivatableNotificationView implements ? fullTransitionAmount : transitionAmount; iconState.clampedAppearAmount = clampedAmount; - float contentTransformationAmount = !row.isAboveShelf() + float contentTransformationAmount = !mAmbientState.isAboveShelf(row) && (isLastChild || iconState.translateContent) ? iconTransitionAmount : 0.0f; @@ -519,7 +520,7 @@ public class NotificationShelf extends ActivatableNotificationView implements iconState.scaleY = 1.0f; iconState.hidden = false; } - if (row.isAboveShelf() || (!row.isInShelf() && (isLastChild && row.areGutsExposed() + if (mAmbientState.isAboveShelf(row) || (!row.isInShelf() && (isLastChild && row.areGutsExposed() || row.getTranslationZ() > mAmbientState.getBaseZHeight()))) { iconState.hidden = true; } 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 e6a7982fc233..805185d5b840 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java @@ -7240,6 +7240,9 @@ public class StatusBar extends SystemUI implements DemoMode, if (mAccessibilityManager.isTouchExplorationEnabled()) { if (DEBUG) Log.d(TAG, "No peeking: accessible fullscreen: " + sbn.getKey()); return false; + } else if (mDozing) { + // We never want heads up when we are dozing. + return false; } else { // we only allow head-up on the lockscreen if it doesn't have a fullscreen intent return !mStatusBarKeyguardViewManager.isShowing() 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 ba1e7c2d86c5..4d8da441c039 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/AmbientState.java @@ -21,11 +21,15 @@ import android.view.View; import com.android.systemui.R; import com.android.systemui.statusbar.ActivatableNotificationView; +import com.android.systemui.statusbar.ExpandableNotificationRow; +import com.android.systemui.statusbar.ExpandableView; +import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationShelf; import com.android.systemui.statusbar.StatusBarState; import com.android.systemui.statusbar.policy.HeadsUpManager; import java.util.ArrayList; +import java.util.Collection; /** * A global state to track all input states for the algorithm. @@ -59,7 +63,7 @@ public class AmbientState { private boolean mPanelTracking; private boolean mExpansionChanging; private boolean mPanelFullWidth; - private boolean mHasPulsingNotifications; + private Collection<HeadsUpManager.HeadsUpEntry> mPulsing; private boolean mUnlockHintRunning; private boolean mQsCustomizerShowing; private int mIntrinsicPadding; @@ -290,11 +294,23 @@ public class AmbientState { } public boolean hasPulsingNotifications() { - return mHasPulsingNotifications; + return mPulsing != null; } - public void setHasPulsingNotifications(boolean hasPulsing) { - mHasPulsingNotifications = hasPulsing; + public void setPulsing(Collection<HeadsUpManager.HeadsUpEntry> hasPulsing) { + mPulsing = hasPulsing; + } + + public boolean isPulsing(NotificationData.Entry entry) { + if (mPulsing == null) { + return false; + } + for (HeadsUpManager.HeadsUpEntry e : mPulsing) { + if (e.entry == entry) { + return true; + } + } + return false; } public boolean isPanelTracking() { @@ -332,4 +348,34 @@ public class AmbientState { public int getIntrinsicPadding() { return mIntrinsicPadding; } + + /** + * Similar to the normal is above shelf logic but doesn't allow it to be above in AOD1. + * + * @param expandableView the view to check + */ + public boolean isAboveShelf(ExpandableView expandableView) { + if (!(expandableView instanceof ExpandableNotificationRow)) { + return expandableView.isAboveShelf(); + } + ExpandableNotificationRow row = (ExpandableNotificationRow) expandableView; + return row.isAboveShelf() && !isDozingAndNotPulsing(row); + } + + /** + * @return whether a view is dozing and not pulsing right now + */ + public boolean isDozingAndNotPulsing(ExpandableView view) { + if (view instanceof ExpandableNotificationRow) { + return isDozingAndNotPulsing((ExpandableNotificationRow) view); + } + return false; + } + + /** + * @return whether a row is dozing and not pulsing right now + */ + public boolean isDozingAndNotPulsing(ExpandableNotificationRow row) { + return isDark() && !isPulsing(row.getEntry()); + } } 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 74523e28c460..00973911ac0d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java @@ -805,7 +805,7 @@ public class NotificationStackScrollLayout extends ViewGroup */ private float getAppearStartPosition() { if (mTrackingHeadsUp && mFirstVisibleBackgroundChild != null) { - if (mFirstVisibleBackgroundChild.isAboveShelf()) { + if (mAmbientState.isAboveShelf(mFirstVisibleBackgroundChild)) { // If we ever expanded beyond the first notification, it's allowed to merge into // the shelf return mFirstVisibleBackgroundChild.getPinnedHeadsUpHeight(); @@ -823,7 +823,8 @@ public class NotificationStackScrollLayout extends ViewGroup int notGoneChildCount = getNotGoneChildCount(); if (mEmptyShadeView.getVisibility() == GONE && notGoneChildCount != 0) { int minNotificationsForShelf = 1; - if (mTrackingHeadsUp || mHeadsUpManager.hasPinnedHeadsUp()) { + if (mTrackingHeadsUp + || (mHeadsUpManager.hasPinnedHeadsUp() && !mAmbientState.isDark())) { appearPosition = mHeadsUpManager.getTopHeadsUpPinnedHeight(); minNotificationsForShelf = 2; } else { @@ -2008,12 +2009,7 @@ public class NotificationStackScrollLayout extends ViewGroup } private boolean isPulsing(NotificationData.Entry entry) { - for (HeadsUpManager.HeadsUpEntry e : mPulsing) { - if (e.entry == entry) { - return true; - } - } - return false; + return mAmbientState.isPulsing(entry); } public boolean hasPulsingNotifications() { @@ -4148,7 +4144,7 @@ public class NotificationStackScrollLayout extends ViewGroup return; } mPulsing = pulsing; - mAmbientState.setHasPulsingNotifications(hasPulsingNotifications()); + mAmbientState.setPulsing(pulsing); updateNotificationAnimationStates(); updateContentHeight(); notifyHeightChangeListener(mShelf); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java index 8235bc7dde07..f4197a3496ea 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollAlgorithm.java @@ -413,7 +413,7 @@ public class StackScrollAlgorithm { if (mIsExpanded) { // Ensure that the heads up is always visible even when scrolled off clampHunToTop(ambientState, row, childState); - if (i == 0 && row.isAboveShelf()) { + if (i == 0 && ambientState.isAboveShelf(row)) { // the first hun can't get off screen. clampHunToMaxTranslation(ambientState, row, childState); childState.hidden = false; @@ -515,7 +515,7 @@ public class StackScrollAlgorithm { ExpandableViewState childViewState = resultState.getViewStateForView(child); int zDistanceBetweenElements = ambientState.getZDistanceBetweenElements(); float baseZ = ambientState.getBaseZHeight(); - if (child.mustStayOnScreen() + if (child.mustStayOnScreen() && !ambientState.isDozingAndNotPulsing(child) && childViewState.yTranslation < ambientState.getTopPadding() + ambientState.getStackTranslation()) { if (childrenOnTop != 0.0f) { @@ -527,7 +527,7 @@ public class StackScrollAlgorithm { } childViewState.zTranslation = baseZ + childrenOnTop * zDistanceBetweenElements; - } else if (i == 0 && child.isAboveShelf()) { + } else if (i == 0 && ambientState.isAboveShelf(child)) { // In case this is a new view that has never been measured before, we don't want to // elevate if we are currently expanded more then the notification int shelfHeight = ambientState.getShelf().getIntrinsicHeight(); |