Merge "Fixed a bug where an incoming call wasn't launching" into oc-dr1-dev

This commit is contained in:
Selim Cinek
2017-07-13 16:29:21 +00:00
committed by Android (Google) Code Review
5 changed files with 65 additions and 19 deletions

View File

@@ -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;
}

View File

@@ -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()

View File

@@ -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());
}
}

View File

@@ -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);

View File

@@ -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();