Fixes that notifications were sometimes clipped on the lockscreen

When dragging down a notification into the bottom, the top notification
could become clipped.

Test: add notifications, pull down on last notification on lockscreen
Bug: 32437839
Change-Id: Ibb58d1aa7575fbe9d84b8542ac57ffae494bb127
This commit is contained in:
Selim Cinek
2016-12-07 13:32:12 -08:00
parent 61190fb7e7
commit 355652a6c8
4 changed files with 22 additions and 4 deletions

View File

@@ -4558,6 +4558,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mGroupManager.setStatusBarState(state);
mFalsingManager.setStatusBarState(state);
mStatusBarWindowManager.setStatusBarState(state);
mStackScroller.setStatusBarState(state);
updateReportRejectedTouchVisibility();
updateDozing();
}

View File

@@ -22,6 +22,7 @@ import android.view.View;
import com.android.systemui.R;
import com.android.systemui.statusbar.ActivatableNotificationView;
import com.android.systemui.statusbar.NotificationShelf;
import com.android.systemui.statusbar.StatusBarState;
import com.android.systemui.statusbar.policy.HeadsUpManager;
import java.util.ArrayList;
@@ -53,6 +54,7 @@ public class AmbientState {
private int mMaxLayoutHeight;
private ActivatableNotificationView mLastVisibleBackgroundChild;
private float mCurrentScrollVelocity;
private int mStatusBarState;
public AmbientState(Context context) {
reload(context);
@@ -250,4 +252,12 @@ public class AmbientState {
public float getCurrentScrollVelocity() {
return mCurrentScrollVelocity;
}
public boolean isOnKeyguard() {
return mStatusBarState == StatusBarState.KEYGUARD;
}
public void setStatusBarState(int statusBarState) {
mStatusBarState = statusBarState;
}
}

View File

@@ -357,6 +357,7 @@ public class NotificationStackScrollLayout extends ViewGroup
private Rect mRequestedClipBounds;
private boolean mInHeadsUpPinnedMode;
private boolean mHeadsUpAnimatingAway;
private int mStatusBarState;
public NotificationStackScrollLayout(Context context) {
this(context, null);
@@ -1187,7 +1188,7 @@ public class NotificationStackScrollLayout extends ViewGroup
}
private boolean onKeyguard() {
return mPhoneStatusBar.getBarState() == StatusBarState.KEYGUARD;
return mStatusBarState == StatusBarState.KEYGUARD;
}
private void setSwipingInProgress(boolean isSwiped) {
@@ -2124,7 +2125,7 @@ public class NotificationStackScrollLayout extends ViewGroup
top = mTopPadding;
bottom = top;
}
if (mPhoneStatusBar.getBarState() != StatusBarState.KEYGUARD) {
if (mStatusBarState != StatusBarState.KEYGUARD) {
top = (int) Math.max(mTopPadding + mStackTranslation, top);
} else {
// otherwise the animation from the shade to the keyguard will jump as it's maxed
@@ -2358,7 +2359,7 @@ public class NotificationStackScrollLayout extends ViewGroup
}
break;
case MotionEvent.ACTION_UP:
if (mPhoneStatusBar.getBarState() != StatusBarState.KEYGUARD && mTouchIsClick &&
if (mStatusBarState != StatusBarState.KEYGUARD && mTouchIsClick &&
isBelowLastNotification(mInitialTouchX, mInitialTouchY)) {
mOnEmptySpaceClickListener.onEmptySpaceClicked(mInitialTouchX, mInitialTouchY);
}
@@ -3981,6 +3982,11 @@ public class NotificationStackScrollLayout extends ViewGroup
updateClipping();
}
public void setStatusBarState(int statusBarState) {
mStatusBarState = statusBarState;
mAmbientState.setStatusBarState(statusBarState);
}
/**
* A listener that is notified when some child locations might have changed.
*/

View File

@@ -124,7 +124,8 @@ public class StackScrollAlgorithm {
private void updateClipping(StackScrollState resultState,
StackScrollAlgorithmState algorithmState, AmbientState ambientState) {
float drawStart = ambientState.getTopPadding() + ambientState.getStackTranslation();
float drawStart = !ambientState.isOnKeyguard() ? ambientState.getTopPadding()
+ ambientState.getStackTranslation() : 0;
float previousNotificationEnd = 0;
float previousNotificationStart = 0;
int childCount = algorithmState.visibleChildren.size();