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

Commit ec9266d4 authored by Taran Singh's avatar Taran Singh
Browse files

Few improvements for Companion widget APIs

1. reset ViewRootImpl#mLastClickToolType for KeyEvents
2. move EditorInfo#mInitialToolType initialization so we dont
   explicitly hold lock for one line of code.

Bug: 233108064
Test: atest CtsInputMethodTestCases

Change-Id: I76d3c4c14928a2eb4c1cda48dd3b9a866963d06f
parent 688a6588
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -6403,6 +6403,12 @@ public final class ViewRootImpl implements ViewParent,
            // Make sure the fallback event policy sees all keys that will be
            // delivered to the view hierarchy.
            mFallbackEventHandler.preDispatchKeyEvent(event);

            // Reset last tracked MotionEvent click toolType.
            if (event.getAction() == KeyEvent.ACTION_DOWN) {
                mLastClickToolType = MotionEvent.TOOL_TYPE_UNKNOWN;
            }

            return FORWARD;
        }

+2 −3
Original line number Diff line number Diff line
@@ -2341,9 +2341,6 @@ public final class InputMethodManager {
        editorInfo.packageName = view.getContext().getOpPackageName();
        editorInfo.autofillId = view.getAutofillId();
        editorInfo.fieldId = view.getId();
        synchronized (mH) {
            editorInfo.setInitialToolType(mCurRootView.getLastClickToolType());
        }
        InputConnection ic = view.onCreateInputConnection(editorInfo);
        if (DEBUG) Log.v(TAG, "Starting input: editorInfo=" + editorInfo + " ic=" + ic);

@@ -2383,6 +2380,8 @@ public final class InputMethodManager {
                startInputFlags |= StartInputFlags.INITIAL_CONNECTION;
            }

            editorInfo.setInitialToolType(mCurRootView.getLastClickToolType());

            // Hook 'em up and let 'er rip.
            mCurrentEditorInfo = editorInfo.createCopyInternal();
            // Store the previously served connection so that we can determine whether it is safe