From dbd299de2a07a2a0a490d4f37cf92870bf87d6c1 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Sun, 6 Mar 2016 22:27:40 -0800 Subject: [PATCH] Ensure PopupDecorView is not IME-focusable during exit transition. Currently PopupDecorView temporarily gets FLAG_NOT_FOCUSABLE bit during exit transition. When doing this we it is important that PopupDecorView does not have FLAG_ALT_FOCUSABLE_IM bit, because having both FLAG_NOT_FOCUSABLE and FLAG_ALT_FOCUSABLE_IM means that PopupDecorView is IME-focusable. To prevent IMEs from flickering, this CL ensures that PopupDecorView is not IME-focusable during exit transition. Bug: 27396330 Change-Id: I0cc81791b826f7d4257f0b6085c028c796fd9536 --- core/java/android/widget/PopupWindow.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java index df2f575893616..dd6a41f9d209c 100644 --- a/core/java/android/widget/PopupWindow.java +++ b/core/java/android/widget/PopupWindow.java @@ -1651,10 +1651,11 @@ public class PopupWindow { // to executing this method, so we can rely on that instead. final Transition exitTransition = mExitTransition; if (mIsAnchorRootAttached && exitTransition != null && decorView.isLaidOut()) { - // The decor view is non-interactive during exit transitions. + // The decor view is non-interactive and non-IME-focusable during exit transitions. final LayoutParams p = (LayoutParams) decorView.getLayoutParams(); p.flags |= LayoutParams.FLAG_NOT_TOUCHABLE; p.flags |= LayoutParams.FLAG_NOT_FOCUSABLE; + p.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM; mWindowManager.updateViewLayout(decorView, p); // Once we start dismissing the decor view, all state (including