diff options
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 89562dc494e9..bb2cea9fb957 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -3370,9 +3370,9 @@ public final class ViewRootImpl implements ViewParent, } // TODO (b/131181940): Make sure this doesn't leak Activity with mActivityConfigCallback // config changes. - final View focusedView = mView != null ? mView.findFocus() : null; if (hasWindowFocus) { - mInsetsController.onWindowFocusGained(focusedView != null /* hasViewFocused */); + mInsetsController.onWindowFocusGained( + getFocusedViewOrNull() != null /* hasViewFocused */); } else { mInsetsController.onWindowFocusLost(); } @@ -3421,7 +3421,8 @@ public final class ViewRootImpl implements ViewParent, // Note: must be done after the focus change callbacks, // so all of the view state is set up correctly. - mImeFocusController.onPostWindowFocus(focusedView, hasWindowFocus, mWindowAttributes); + mImeFocusController.onPostWindowFocus( + getFocusedViewOrNull(), hasWindowFocus, mWindowAttributes); if (hasWindowFocus) { // Clear the forward bit. We can just do this directly, since @@ -6390,6 +6391,11 @@ public final class ViewRootImpl implements ViewParent, mView.dispatchTooltipHoverEvent(event); } + @Nullable + private View getFocusedViewOrNull() { + return mView != null ? mView.findFocus() : null; + } + /** * Performs synthesis of new input events from unhandled input events. */ |
