summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nikolas Havrikov <havrikov@google.com> 2022-11-08 14:00:55 +0100
committer Nikolas Havrikov <havrikov@google.com> 2022-11-08 16:01:06 +0000
commitf583eb6607bccab79c1d2203c09b004abdb7f10b (patch)
tree84b2735061b688568e2d24e049656008758a22cc
parent6bde545c1b9f7c10d1bd873131a1939a560ba3a9 (diff)
Reduce DPAD navigation logspam with killable IME
On Android TV, when the killable IME feature is enabled, navigating through the interface using the DPAD buttons on a remote controller leads to logspam on logcat. This CL takes the feature into account and lowers the severity of the log message about the input event not being delivered to the IME when appropriate. Bug: 258201658 Test: manually on a tv device Change-Id: I04b85aaf13e1442f070d8dfcff7cf9bd599dac0a
-rw-r--r--core/java/android/view/inputmethod/InputMethodManager.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java
index d08816b7dafc..dd59ebda7da4 100644
--- a/core/java/android/view/inputmethod/InputMethodManager.java
+++ b/core/java/android/view/inputmethod/InputMethodManager.java
@@ -632,6 +632,8 @@ public final class InputMethodManager {
private final DelegateImpl mDelegate = new DelegateImpl();
+ private static boolean sPreventImeStartupUnlessTextEditor;
+
// -----------------------------------------------------------
private static final int MSG_DUMP = 1;
@@ -1435,6 +1437,10 @@ public final class InputMethodManager {
// display case.
final Looper looper = displayId == Display.DEFAULT_DISPLAY
? Looper.getMainLooper() : context.getMainLooper();
+ // Keep track of whether to expect the IME to be unavailable so as to avoid log spam in
+ // sendInputEventOnMainLooperLocked() by not logging a verbose message on every DPAD event
+ sPreventImeStartupUnlessTextEditor = context.getResources().getBoolean(
+ com.android.internal.R.bool.config_preventImeStartupUnlessTextEditor);
return forContextInternal(displayId, looper);
}
@@ -3360,8 +3366,12 @@ public final class InputMethodManager {
return DISPATCH_IN_PROGRESS;
}
- Log.w(TAG, "Unable to send input event to IME: " + getImeIdLocked()
- + " dropping: " + event);
+ if (sPreventImeStartupUnlessTextEditor) {
+ Log.d(TAG, "Dropping event because IME is evicted: " + event);
+ } else {
+ Log.w(TAG, "Unable to send input event to IME: " + getImeIdLocked()
+ + " dropping: " + event);
+ }
}
return DISPATCH_NOT_HANDLED;
}