diff options
5 files changed, 30 insertions, 43 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 2d7ea2e6e3a8..537f887305ee 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -12482,8 +12482,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Determines whether the given point, in local coordinates is inside the view. */ /*package*/ final boolean pointInView(float localX, float localY) { - return localX >= 0 && localX < (mRight - mLeft) - && localY >= 0 && localY < (mBottom - mTop); + return pointInView(localX, localY, 0); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 874b76aaf2bd..1e738110eb0f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -518,11 +518,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } @Override - protected boolean filterMotionEvent(MotionEvent event) { - return mIsHeadsUp || super.filterMotionEvent(event); - } - - @Override protected void onFinishInflate() { super.onFinishInflate(); mPublicLayout = (NotificationContentView) findViewById(R.id.expandedPublic); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index 59cbd4089a3b..bc7bd5bcca00 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -45,7 +45,6 @@ public abstract class ExpandableView extends FrameLayout { private static Rect mClipRect = new Rect(); private boolean mWillBeGone; private int mMinClipTopAmount = 0; - private boolean mMeasuredTooHigh; public ExpandableView(Context context, AttributeSet attrs) { super(context, attrs); @@ -59,9 +58,7 @@ public abstract class ExpandableView extends FrameLayout { final int givenSize = MeasureSpec.getSize(heightMeasureSpec); int ownMaxHeight = limitViewHeight ? mMaxViewHeight : Integer.MAX_VALUE; int heightMode = MeasureSpec.getMode(heightMeasureSpec); - boolean hasFixedHeight = heightMode == MeasureSpec.EXACTLY; - if (hasFixedHeight) { - // We have a height set in our layout, so we want to be at most as big as given + if (heightMode != MeasureSpec.UNSPECIFIED && givenSize != 0) { ownMaxHeight = Math.min(givenSize, ownMaxHeight); } int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST); @@ -77,7 +74,7 @@ public abstract class ExpandableView extends FrameLayout { if (layoutParams.height != ViewGroup.LayoutParams.MATCH_PARENT) { if (layoutParams.height >= 0) { // An actual height is set - childHeightSpec = layoutParams.height > ownMaxHeight && limitViewHeight + childHeightSpec = layoutParams.height > ownMaxHeight ? MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.EXACTLY) : MeasureSpec.makeMeasureSpec(layoutParams.height, MeasureSpec.EXACTLY); } @@ -90,7 +87,8 @@ public abstract class ExpandableView extends FrameLayout { mMatchParentViews.add(child); } } - int ownHeight = hasFixedHeight ? ownMaxHeight : Math.min(ownMaxHeight, maxChildHeight); + int ownHeight = heightMode == MeasureSpec.EXACTLY + ? givenSize : Math.min(ownMaxHeight, maxChildHeight); newHeightSpec = MeasureSpec.makeMeasureSpec(ownHeight, MeasureSpec.EXACTLY); for (View child : mMatchParentViews) { child.measure(getChildMeasureSpec( @@ -100,7 +98,6 @@ public abstract class ExpandableView extends FrameLayout { mMatchParentViews.clear(); int width = MeasureSpec.getSize(widthMeasureSpec); setMeasuredDimension(width, ownHeight); - mMeasuredTooHigh = heightMode != MeasureSpec.UNSPECIFIED && ownHeight > givenSize; } protected boolean shouldLimitViewHeight() { @@ -133,26 +130,11 @@ public abstract class ExpandableView extends FrameLayout { } @Override - public boolean dispatchGenericMotionEvent(MotionEvent ev) { - if (filterMotionEvent(ev)) { - return super.dispatchGenericMotionEvent(ev); - } - return false; - } - - @Override - public boolean dispatchTouchEvent(MotionEvent ev) { - if (filterMotionEvent(ev)) { - return super.dispatchTouchEvent(ev); - } - return false; - } - - protected boolean filterMotionEvent(MotionEvent event) { - return event.getActionMasked() != MotionEvent.ACTION_DOWN - && event.getActionMasked() != MotionEvent.ACTION_HOVER_ENTER - && event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE - || event.getY() > mClipTopAmount && event.getY() < mActualHeight; + public boolean pointInView(float localX, float localY, float slop) { + float top = mClipTopAmount; + float bottom = mActualHeight; + return localX >= -slop && localY >= top - slop && localX < ((mRight - mLeft) + slop) && + localY < (bottom + slop); } /** @@ -397,7 +379,8 @@ public abstract class ExpandableView extends FrameLayout { @Override public boolean hasOverlappingRendering() { - return super.hasOverlappingRendering() && !mMeasuredTooHigh; + // Otherwise it will be clipped + return super.hasOverlappingRendering() && getActualHeight() <= getHeight(); } /** diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java index 5cfd17463886..b38c3fe477bb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/HeadsUpManager.java @@ -378,23 +378,22 @@ public class HeadsUpManager implements ViewTreeObserver.OnComputeInternalInsetsL return; } if (mHasPinnedNotification) { - int minX = Integer.MAX_VALUE; + int minX = 0; int maxX = 0; - int minY = Integer.MAX_VALUE; int maxY = 0; for (HeadsUpEntry entry : mSortedEntries) { ExpandableNotificationRow row = entry.entry.row; if (row.isPinned()) { row.getLocationOnScreen(mTmpTwoArray); - minX = Math.min(minX, mTmpTwoArray[0]); - minY = Math.min(minY, 0); - maxX = Math.max(maxX, mTmpTwoArray[0] + row.getWidth()); - maxY = Math.max(maxY, row.getHeadsUpHeight()); + minX = mTmpTwoArray[0]; + maxX = mTmpTwoArray[0] + row.getWidth(); + maxY = row.getHeadsUpHeight(); + break; } } info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION); - info.touchableRegion.set(minX, minY, maxX, maxY + mNotificationsTopPadding); + info.touchableRegion.set(minX, 0, maxX, maxY + mNotificationsTopPadding); } else if (mHeadsUpGoingAway || mWaitingOnCollapseWhenGoingAway) { info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo.TOUCHABLE_INSETS_REGION); info.touchableRegion.set(0, 0, mStatusBarWindowView.getWidth(), mStatusBarHeight); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java index beaa3ad60b37..321bcbc9320a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationChildrenContainer.java @@ -56,6 +56,7 @@ public class NotificationChildrenContainer extends ViewGroup { private ExpandableNotificationRow mNotificationParent; private HybridNotificationView mGroupOverflowContainer; private ViewState mGroupOverFlowState; + private int mRealHeight; public NotificationChildrenContainer(Context context) { this(context, null); @@ -111,8 +112,8 @@ public class NotificationChildrenContainer extends ViewGroup { int heightMode = MeasureSpec.getMode(heightMeasureSpec); boolean hasFixedHeight = heightMode == MeasureSpec.EXACTLY; boolean isHeightLimited = heightMode == MeasureSpec.AT_MOST; + int size = MeasureSpec.getSize(heightMeasureSpec); if (hasFixedHeight || isHeightLimited) { - int size = MeasureSpec.getSize(heightMeasureSpec); ownMaxHeight = Math.min(ownMaxHeight, size); } int newHeightSpec = MeasureSpec.makeMeasureSpec(ownMaxHeight, MeasureSpec.AT_MOST); @@ -133,9 +134,19 @@ public class NotificationChildrenContainer extends ViewGroup { if (mGroupOverflowContainer != null) { mGroupOverflowContainer.measure(widthMeasureSpec, newHeightSpec); } + mRealHeight = height; + if (heightMode != MeasureSpec.UNSPECIFIED) { + height = Math.min(height, size); + } setMeasuredDimension(width, height); } + @Override + public boolean pointInView(float localX, float localY, float slop) { + return localX >= -slop && localY >= -slop && localX < ((mRight - mLeft) + slop) && + localY < (mRealHeight + slop); + } + /** * Add a child notification to this view. * |