Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f583eb66 authored by Nikolas Havrikov's avatar Nikolas Havrikov
Browse files

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
parent 6bde545c
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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,9 +3366,13 @@ public final class InputMethodManager {
                return DISPATCH_IN_PROGRESS;
            }

            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;
    }