From 4d0cedf95f29afea3e678bd81be289b7a8e31583 Mon Sep 17 00:00:00 2001 From: Jay Shrauner Date: Fri, 24 Oct 2014 08:37:12 -0700 Subject: Fix NPE in processNestedScroll Null check mCapturedView Bug:18114408 Change-Id: I5abb9f5bcca37aafab55f12c69d824ab92faf68f --- src/com/android/dialer/widget/ViewDragHelper.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/com/android/dialer/widget') diff --git a/src/com/android/dialer/widget/ViewDragHelper.java b/src/com/android/dialer/widget/ViewDragHelper.java index a0e1d801b..c0bc2ce29 100644 --- a/src/com/android/dialer/widget/ViewDragHelper.java +++ b/src/com/android/dialer/widget/ViewDragHelper.java @@ -1548,6 +1548,12 @@ public class ViewDragHelper { * deltas that it consumed. */ public void processNestedScroll(View target, int dx, int dy, int[] consumed) { + if (mCapturedView == null) { + // This is safe because consumed array is null when called from + // onNestedScroll, and pre-initialized to {0, 0} when called from + // onNestedPreScroll. + return; + } final int targetX = mCapturedView.getLeft() + dx; final int targetY = mCapturedView.getTop() + dy; dragTo(targetX, targetY, dx, dy); -- cgit v1.2.3 From 33065b917a4305df446685b330c3bd7a6c83f3e2 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 11 Nov 2014 11:55:52 -0800 Subject: Fix IOOB exception in ViewDragHelper If findPointerIndex returns -1, ignore the motion event. The equivalent fix is done for other handlers of motion events as well. Bug: 18186775 Change-Id: Ia7548335eeb84310510260381a8bcedf6556aa40 --- src/com/android/dialer/widget/ViewDragHelper.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/com/android/dialer/widget') diff --git a/src/com/android/dialer/widget/ViewDragHelper.java b/src/com/android/dialer/widget/ViewDragHelper.java index c0bc2ce29..fe3ab8230 100644 --- a/src/com/android/dialer/widget/ViewDragHelper.java +++ b/src/com/android/dialer/widget/ViewDragHelper.java @@ -21,6 +21,7 @@ import android.content.Context; import android.support.v4.view.MotionEventCompat; import android.support.v4.view.VelocityTrackerCompat; import android.support.v4.view.ViewCompat; +import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; @@ -1176,7 +1177,12 @@ public class ViewDragHelper { case MotionEvent.ACTION_MOVE: { if (mDragState == STATE_DRAGGING) { - final int index = MotionEventCompat.findPointerIndex(ev, mActivePointerId); + int index = MotionEventCompat.findPointerIndex(ev, mActivePointerId); + if (index < 0) { + Log.e(TAG, "Pointer index for id " + mActivePointerId + " not found." + + " Skipping MotionEvent"); + return; + } final float x = MotionEventCompat.getX(ev, index); final float y = MotionEventCompat.getY(ev, index); final int idx = (int) (x - mLastMotionX[mActivePointerId]); -- cgit v1.2.3 From e1ddde782f4e688426ea9f353a1e894b06a7319a Mon Sep 17 00:00:00 2001 From: Ihab Awad Date: Fri, 12 Dec 2014 15:30:24 -0800 Subject: Avoid spurious Talkback notifications Bug: 18678952 Change-Id: I2f15cad4b71ba780e6ed860b5dd67c745a3b4823 --- src/com/android/dialer/widget/OverlappingPaneLayout.java | 1 - 1 file changed, 1 deletion(-) (limited to 'src/com/android/dialer/widget') diff --git a/src/com/android/dialer/widget/OverlappingPaneLayout.java b/src/com/android/dialer/widget/OverlappingPaneLayout.java index 95a0e43de..8f911c2da 100644 --- a/src/com/android/dialer/widget/OverlappingPaneLayout.java +++ b/src/com/android/dialer/widget/OverlappingPaneLayout.java @@ -230,7 +230,6 @@ public class OverlappingPaneLayout extends ViewGroup { setWillNotDraw(false); ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegate()); - ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); mDragHelper = ViewDragHelper.create(this, 0.5f, new DragHelperCallback()); mDragHelper.setMinVelocity(MIN_FLING_VELOCITY * density); -- cgit v1.2.3 From cb11520577f0c1e9c6e765e54488bf64684f36be Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Tue, 30 Dec 2014 11:03:00 -0800 Subject: Fixing overlap pane offset when shortcut card disappears. When the shortcut card was hidden due to the call log being cleared, the offset for the overlapping pane needed to be recalculated based on the new height of the top portion of the dialtacts activity. Bug: 18849546 Change-Id: Ib5953a2a537e9a7520d4f022e43fa974f67eb410 --- src/com/android/dialer/widget/OverlappingPaneLayout.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/com/android/dialer/widget') diff --git a/src/com/android/dialer/widget/OverlappingPaneLayout.java b/src/com/android/dialer/widget/OverlappingPaneLayout.java index 8f911c2da..167b849f2 100644 --- a/src/com/android/dialer/widget/OverlappingPaneLayout.java +++ b/src/com/android/dialer/widget/OverlappingPaneLayout.java @@ -717,6 +717,22 @@ public class OverlappingPaneLayout extends ViewGroup { return wantTouchEvents; } + /** + * Refreshes the {@link OverlappingPaneLayout} be attempting to re-open or re-close the pane. + * This ensures that the overlapping pane is repositioned based on any changes to the view + * which is being overlapped. + *

+ * The {@link #openPane()} and {@link #closePane()} methods do not perform any animation if the + * pane has already been positioned appropriately. + */ + public void refresh() { + if (isOpen()) { + openPane(); + } else { + closePane(); + } + } + private boolean closePane(View pane, int initialVelocity) { if (mFirstLayout || smoothSlideTo(0.f, initialVelocity)) { mPreservedOpenState = false; -- cgit v1.2.3