From 23861dc19228992953017f4cd2b72a0404063b06 Mon Sep 17 00:00:00 2001 From: Manu Cornet Date: Mon, 7 Nov 2016 14:45:47 -0800 Subject: [PATCH] Slight generalization of task view hit test logic The existing logic does not work if task views happen not to be clipped. This makes the logic a little more generic. Bug: 32101881 Test: Locally on Ryu device with existing Recents implementation as well as another, in-progress implementation. Change-Id: I177aa5c2a020741175b2e9c85a48165fa7294b4e --- .../com/android/systemui/recents/views/TaskView.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java index 99d98bcd3f1d8..b6ec5040397bf 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java @@ -668,10 +668,16 @@ public class TaskView extends FixedSizeFrameLayout implements Task.TaskCallbacks @Override public boolean onLongClick(View v) { SystemServicesProxy ssp = Recents.getSystemServices(); - // Since we are clipping the view to the bounds, manually do the hit test + boolean inBounds = false; Rect clipBounds = new Rect(mViewBounds.mClipBounds); - clipBounds.scale(getScaleX()); - boolean inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y); + if (!clipBounds.isEmpty()) { + // If we are clipping the view to the bounds, manually do the hit test. + clipBounds.scale(getScaleX()); + inBounds = clipBounds.contains(mDownTouchPos.x, mDownTouchPos.y); + } else { + // Otherwise just make sure we're within the view's bounds. + inBounds = mDownTouchPos.x <= getWidth() && mDownTouchPos.y <= getHeight(); + } if (v == this && inBounds && !ssp.hasDockedTask()) { // Start listening for drag events setClipViewInStack(false);