summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Craig Mautner <cmautner@google.com> 2013-04-11 19:09:05 -0700
committer Craig Mautner <cmautner@google.com> 2013-04-11 19:33:54 -0700
commit26a84dfdd09011d6a93a3758f794e4585bf10c3d (patch)
tree855a5ff1a9eb9df6c717c9e41ec4284d9c96fb58
parentc37b63d6e777748d17ff177b128e30504fbd6c71 (diff)
Clear test rectangle if previous focus is null.
A bug in FolderEditText or DynamicLayout (b/8600683) was causing the 'rectangle' parameter passed to scrollToRectOrFocus() to be roughly 1000 feet to the right of the screen. This bug is normally masked because the focus found in mLastScrolledFocus never matches the new focus and consequently the misleading 'rectangle' is nulled. However, on the first time in to scrollToRectOrFocus when returning to Launcher from another app, mLastScrolledFocus is null and the code skips over the place where 'rectangle' is nulled. Without this clearing it was determined that 'rectangle' was outside the viewable area and scrolling not required. This is bug 8547155. This change causes even null values of mLastScrollFocus to be compared to the new focus thus masking the bug in all situations. Bug 8600683 will be fixed in a separate CL. Fixes bug 8547155. Change-Id: Ic6cb22c42b0e93a9793dd2babc25727c2ba29155
-rw-r--r--core/java/android/view/ViewRootImpl.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 98b787765d08..d62887504ccd 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -2592,12 +2592,12 @@ public final class ViewRootImpl implements ViewParent,
// requestChildRectangleOnScreen() call (in which case 'rectangle'
// is non-null and we just want to scroll to whatever that
// rectangle is).
- View focus = mView.findFocus();
+ final View focus = mView.findFocus();
if (focus == null) {
return false;
}
View lastScrolledFocus = (mLastScrolledFocus != null) ? mLastScrolledFocus.get() : null;
- if (lastScrolledFocus != null && focus != lastScrolledFocus) {
+ if (focus != lastScrolledFocus) {
// If the focus has changed, then ignore any requests to scroll
// to a rectangle; first we want to make sure the entire focus
// view is visible.
@@ -2612,7 +2612,7 @@ public final class ViewRootImpl implements ViewParent,
// as they are.
if (DEBUG_INPUT_RESIZE) Log.v(TAG, "Keeping scroll y="
+ mScrollY + " vi=" + vi.toShortString());
- } else if (focus != null) {
+ } else {
// We need to determine if the currently focused view is
// within the visible part of the window and, if not, apply
// a pan so it can be seen.