Loading core/java/android/inputmethodservice/InlineSuggestionSession.java +5 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,11 @@ class InlineSuggestionSession { */ @MainThread void invalidate() { try { mCallback.onInlineSuggestionsSessionInvalidated(); } catch (RemoteException e) { Log.w(TAG, "onInlineSuggestionsSessionInvalidated() remote exception:" + e); } if (mResponseCallback != null) { consumeInlineSuggestionsResponse(EMPTY_RESPONSE); mResponseCallback.invalidate(); Loading core/java/com/android/internal/view/IInlineSuggestionsRequestCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -58,4 +58,7 @@ oneway interface IInlineSuggestionsRequestCallback { // #onFinishInput()} is called on the field specified by the earlier // {@link #onInputMethodStartInput(AutofillId)}. void onInputMethodFinishInput(); // Indicates that the current IME changes inline suggestion session. void onInlineSuggestionsSessionInvalidated(); } services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java +31 −1 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ final class AutofillInlineSuggestionsRequestSession { private boolean mDestroyed = false; @GuardedBy("mLock") private boolean mPreviousHasNonPinSuggestionShow; @GuardedBy("mLock") private boolean mImeSessionInvalidated = false; AutofillInlineSuggestionsRequestSession( @NonNull InputMethodManagerInternal inputMethodManagerInternal, int userId, Loading Loading @@ -157,7 +159,7 @@ final class AutofillInlineSuggestionsRequestSession { Slog.d(TAG, "onInlineSuggestionsResponseLocked called for:" + inlineFillUi.getAutofillId()); } if (mImeRequest == null || mResponseCallback == null) { if (mImeRequest == null || mResponseCallback == null || mImeSessionInvalidated) { return false; } // TODO(b/151123764): each session should only correspond to one field. Loading Loading @@ -191,6 +193,7 @@ final class AutofillInlineSuggestionsRequestSession { if (mDestroyed) { return; } mImeSessionInvalidated = false; if (sDebug) Slog.d(TAG, "onCreateInlineSuggestionsRequestLocked called: " + mAutofillId); mInputMethodManagerInternal.onCreateInlineSuggestionsRequest(mUserId, new InlineSuggestionsRequestInfo(mComponentName, mAutofillId, mUiExtras), Loading Loading @@ -291,6 +294,7 @@ final class AutofillInlineSuggestionsRequestSession { return; } mImeRequestReceived = true; mImeSessionInvalidated = false; if (request != null && callback != null) { mImeRequest = request; Loading Loading @@ -346,6 +350,20 @@ final class AutofillInlineSuggestionsRequestSession { } } /** * Handles the IME session status received from the IME. * * <p> Should only be invoked in the {@link #mHandler} thread. */ private void handleOnReceiveImeSessionInvalidated() { synchronized (mLock) { if (mDestroyed) { return; } mImeSessionInvalidated = true; } } private static final class InlineSuggestionsRequestCallbackImpl extends IInlineSuggestionsRequestCallback.Stub { Loading Loading @@ -433,6 +451,18 @@ final class AutofillInlineSuggestionsRequestSession { session, false, false)); } } @BinderThread @Override public void onInlineSuggestionsSessionInvalidated() throws RemoteException { if (sDebug) Slog.d(TAG, "onInlineSuggestionsSessionInvalidated() called."); final AutofillInlineSuggestionsRequestSession session = mSession.get(); if (session != null) { session.mHandler.sendMessage(obtainMessage( AutofillInlineSuggestionsRequestSession ::handleOnReceiveImeSessionInvalidated, session)); } } } private static boolean match(@Nullable AutofillId autofillId, Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -2128,6 +2128,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub public void onInputMethodFinishInput() throws RemoteException { mCallback.onInputMethodFinishInput(); } @Override public void onInlineSuggestionsSessionInvalidated() throws RemoteException { mCallback.onInlineSuggestionsSessionInvalidated(); } } /** Loading Loading
core/java/android/inputmethodservice/InlineSuggestionSession.java +5 −0 Original line number Diff line number Diff line Loading @@ -149,6 +149,11 @@ class InlineSuggestionSession { */ @MainThread void invalidate() { try { mCallback.onInlineSuggestionsSessionInvalidated(); } catch (RemoteException e) { Log.w(TAG, "onInlineSuggestionsSessionInvalidated() remote exception:" + e); } if (mResponseCallback != null) { consumeInlineSuggestionsResponse(EMPTY_RESPONSE); mResponseCallback.invalidate(); Loading
core/java/com/android/internal/view/IInlineSuggestionsRequestCallback.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -58,4 +58,7 @@ oneway interface IInlineSuggestionsRequestCallback { // #onFinishInput()} is called on the field specified by the earlier // {@link #onInputMethodStartInput(AutofillId)}. void onInputMethodFinishInput(); // Indicates that the current IME changes inline suggestion session. void onInlineSuggestionsSessionInvalidated(); }
services/autofill/java/com/android/server/autofill/AutofillInlineSuggestionsRequestSession.java +31 −1 Original line number Diff line number Diff line Loading @@ -103,6 +103,8 @@ final class AutofillInlineSuggestionsRequestSession { private boolean mDestroyed = false; @GuardedBy("mLock") private boolean mPreviousHasNonPinSuggestionShow; @GuardedBy("mLock") private boolean mImeSessionInvalidated = false; AutofillInlineSuggestionsRequestSession( @NonNull InputMethodManagerInternal inputMethodManagerInternal, int userId, Loading Loading @@ -157,7 +159,7 @@ final class AutofillInlineSuggestionsRequestSession { Slog.d(TAG, "onInlineSuggestionsResponseLocked called for:" + inlineFillUi.getAutofillId()); } if (mImeRequest == null || mResponseCallback == null) { if (mImeRequest == null || mResponseCallback == null || mImeSessionInvalidated) { return false; } // TODO(b/151123764): each session should only correspond to one field. Loading Loading @@ -191,6 +193,7 @@ final class AutofillInlineSuggestionsRequestSession { if (mDestroyed) { return; } mImeSessionInvalidated = false; if (sDebug) Slog.d(TAG, "onCreateInlineSuggestionsRequestLocked called: " + mAutofillId); mInputMethodManagerInternal.onCreateInlineSuggestionsRequest(mUserId, new InlineSuggestionsRequestInfo(mComponentName, mAutofillId, mUiExtras), Loading Loading @@ -291,6 +294,7 @@ final class AutofillInlineSuggestionsRequestSession { return; } mImeRequestReceived = true; mImeSessionInvalidated = false; if (request != null && callback != null) { mImeRequest = request; Loading Loading @@ -346,6 +350,20 @@ final class AutofillInlineSuggestionsRequestSession { } } /** * Handles the IME session status received from the IME. * * <p> Should only be invoked in the {@link #mHandler} thread. */ private void handleOnReceiveImeSessionInvalidated() { synchronized (mLock) { if (mDestroyed) { return; } mImeSessionInvalidated = true; } } private static final class InlineSuggestionsRequestCallbackImpl extends IInlineSuggestionsRequestCallback.Stub { Loading Loading @@ -433,6 +451,18 @@ final class AutofillInlineSuggestionsRequestSession { session, false, false)); } } @BinderThread @Override public void onInlineSuggestionsSessionInvalidated() throws RemoteException { if (sDebug) Slog.d(TAG, "onInlineSuggestionsSessionInvalidated() called."); final AutofillInlineSuggestionsRequestSession session = mSession.get(); if (session != null) { session.mHandler.sendMessage(obtainMessage( AutofillInlineSuggestionsRequestSession ::handleOnReceiveImeSessionInvalidated, session)); } } } private static boolean match(@Nullable AutofillId autofillId, Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +5 −0 Original line number Diff line number Diff line Loading @@ -2128,6 +2128,11 @@ public class InputMethodManagerService extends IInputMethodManager.Stub public void onInputMethodFinishInput() throws RemoteException { mCallback.onInputMethodFinishInput(); } @Override public void onInlineSuggestionsSessionInvalidated() throws RemoteException { mCallback.onInlineSuggestionsSessionInvalidated(); } } /** Loading