summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Android (Google) Code Review <android-gerrit@google.com> 2009-07-14 15:38:19 -0700
committer The Android Open Source Project <initial-contribution@android.com> 2009-07-14 15:38:19 -0700
commit5b2e50cbe18d525e9a15cad437f04f45e3c0e46c (patch)
tree516a1ef8505af16181718157b25b729b1cac0d51
parent6d713b7616ed79c98f138e01593d4c2a1ee194fd (diff)
parent30d86e5143d01815763f8c28b0fc72b0493ea9f8 (diff)
am 30d86e51: Merge change 7124 into donut
Merge commit '30d86e5143d01815763f8c28b0fc72b0493ea9f8' * commit '30d86e5143d01815763f8c28b0fc72b0493ea9f8': Fixes #1977685. Prevent crash when the soft keyboard is brought up.
-rw-r--r--core/java/android/view/ViewRoot.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 57768515ad48..1e3cdb34f436 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -1374,6 +1374,15 @@ public final class ViewRoot extends Handler implements ViewParent,
// is non-null and we just want to scroll to whatever that
// rectangle is).
View focus = mRealFocusedView;
+
+ // When in touch mode, focus points to the previously focused view,
+ // which may have been removed from the view hierarchy. The following
+ // line checks whether the view is still in the hierarchy
+ if (focus == null || focus.getParent() == null) {
+ mRealFocusedView = null;
+ return false;
+ }
+
if (focus != mLastScrolledFocus) {
// If the focus has changed, then ignore any requests to scroll
// to a rectangle; first we want to make sure the entire focus