From 75ce82747d7dd939187ec2d802c04119d7471619 Mon Sep 17 00:00:00 2001 From: Taran Singh Date: Thu, 28 Apr 2022 18:16:51 +0000 Subject: [PATCH] Shorten IME surface caching duration Shorten IME surface caching so that we can avoid showing cached IME surface when IME insets have changed from the last time it was shown. Fix: 221458652 Bug: 230762351 Test: Manually using steps: 1. Go to gboard settings and enable Emoji bar 2. Open a chat in messages app 3. tap editor and make sure Insets dont change after show animation completes. Change-Id: I4c2a9c272ef0e7be7128ca64abebd3a3b7d2d7a4 --- core/java/android/inputmethodservice/InputMethodService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index a6ed42348af68..efd4f06818380 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -482,8 +482,9 @@ public class InputMethodService extends AbstractInputMethodService { /** * Timeout after which hidden IME surface will be removed from memory + * TODO(b/230762351): reset timeout to 5000ms and invalidate cache when IME insets change. */ - private static final long TIMEOUT_SURFACE_REMOVAL_MILLIS = 5000; + private static final long TIMEOUT_SURFACE_REMOVAL_MILLIS = 500; InputMethodManager mImm; private InputMethodPrivilegedOperations mPrivOps = new InputMethodPrivilegedOperations();