From 8cbc4206f5c4d71faf09291c1775ba117d4ebf30 Mon Sep 17 00:00:00 2001 From: Nikolas Havrikov Date: Fri, 13 May 2022 14:03:52 +0200 Subject: [PATCH] Delete config_killableInputMethods setting This change effectively reverts the introduction of the config_killableInputMethods setting in [1]. Permanently setting the oom_score_adj of the IME process to CACHED leads to cases where the lowmemorykiller kills it before it can be raised to "visible". In order to achieve the killable IME behavior, enabling the setting config_preventImeStartupUnlessTextEditor is sufficient. Test: atest CtsInputMethodTestCases Test: also manually on adt3 Bug: 232511947 [1]: Ib191d964de15bbb84daa8bbeca6f2dca6f96311c Change-Id: I92091e0e1c26635b8fc38f1371445a17a0afafae --- core/res/res/values/config.xml | 3 -- core/res/res/values/symbols.xml | 1 - .../InputMethodBindingController.java | 31 +------------------ 3 files changed, 1 insertion(+), 34 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index b139e472460a1..054695ef8f939 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2963,9 +2963,6 @@ com.android.inputmethod.latin - - false - false diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 77007afc2156d..5bfc568887891 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2254,7 +2254,6 @@ - diff --git a/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java b/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java index c4ff4ac6c981c..9195b68e7a8f2 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodBindingController.java @@ -90,13 +90,6 @@ final class InputMethodBindingController { | Context.BIND_NOT_VISIBLE | Context.BIND_NOT_FOREGROUND | Context.BIND_IMPORTANT_BACKGROUND; - /** - * Binding flags for establishing connection to the {@link InputMethodService} when - * config_killableInputMethods is enabled. - */ - private static final int IME_CONNECTION_LOW_PRIORITY_BIND_FLAGS = - Context.BIND_AUTO_CREATE - | Context.BIND_REDUCTION_FLAGS; /** * Binding flags used only while the {@link InputMethodService} is showing window. */ @@ -108,16 +101,6 @@ final class InputMethodBindingController { | Context.BIND_SHOWING_UI | Context.BIND_SCHEDULE_LIKE_TOP_APP; - /** - * Binding flags for establishing connection to the {@link InputMethodService}. - * - *

- * This defaults to {@link InputMethodBindingController#IME_CONNECTION_BIND_FLAGS} unless - * config_killableInputMethods is enabled, in which case this takes the value of - * {@link InputMethodBindingController#IME_CONNECTION_LOW_PRIORITY_BIND_FLAGS}. - */ - private final int mImeConnectionBindFlags; - InputMethodBindingController(@NonNull InputMethodManagerService service) { mService = service; mContext = mService.mContext; @@ -127,17 +110,6 @@ final class InputMethodBindingController { mIWindowManager = mService.mIWindowManager; mWindowManagerInternal = mService.mWindowManagerInternal; mRes = mService.mRes; - - // If configured, use low priority flags to make the IME killable by the lowmemorykiller - final boolean lowerIMEPriority = mRes.getBoolean( - com.android.internal.R.bool.config_killableInputMethods); - - if (lowerIMEPriority) { - mImeConnectionBindFlags = - InputMethodBindingController.IME_CONNECTION_LOW_PRIORITY_BIND_FLAGS; - } else { - mImeConnectionBindFlags = InputMethodBindingController.IME_CONNECTION_BIND_FLAGS; - } } /** @@ -500,8 +472,7 @@ final class InputMethodBindingController { @GuardedBy("ImfLock.class") private boolean bindCurrentInputMethodServiceMainConnection() { - mHasConnection = bindCurrentInputMethodService(mMainConnection, - mImeConnectionBindFlags); + mHasConnection = bindCurrentInputMethodService(mMainConnection, IME_CONNECTION_BIND_FLAGS); return mHasConnection; }