Loading services/core/java/com/android/server/inputmethod/AutofillSuggestionsController.java +27 −7 Original line number Diff line number Diff line Loading @@ -40,6 +40,13 @@ final class AutofillSuggestionsController { @NonNull private final InputMethodManagerService mService; /** * The host input token of the input method that is currently associated with this controller. */ @GuardedBy("ImfLock.class") @Nullable private IBinder mCurHostInputToken; private static final class CreateInlineSuggestionsRequest { @NonNull final InlineSuggestionsRequestInfo mRequestInfo; @NonNull final IInlineSuggestionsRequestCallback mCallback; Loading Loading @@ -77,6 +84,17 @@ final class AutofillSuggestionsController { mService = service; } @GuardedBy("ImfLock.class") void onResetSystemUi() { mCurHostInputToken = null; } @Nullable @GuardedBy("ImfLock.class") IBinder getCurHostInputToken() { return mCurHostInputToken; } @GuardedBy("ImfLock.class") void onCreateInlineSuggestionsRequest(@UserIdInt int userId, InlineSuggestionsRequestInfo requestInfo, IInlineSuggestionsRequestCallback callback, Loading Loading @@ -124,8 +142,7 @@ final class AutofillSuggestionsController { mPendingInlineSuggestionsRequest.mCallback, mPendingInlineSuggestionsRequest.mPackageName, mService.getCurTokenDisplayIdLocked(), mService.getCurTokenLocked(), mService); mService.getCurTokenLocked()); curMethod.onCreateInlineSuggestionsRequest( mPendingInlineSuggestionsRequest.mRequestInfo, callback); } else { Loading Loading @@ -161,22 +178,20 @@ final class AutofillSuggestionsController { * The decorator which validates the host package name in the * {@link InlineSuggestionsRequest} argument to make sure it matches the IME package name. */ private static final class InlineSuggestionsRequestCallbackDecorator private final class InlineSuggestionsRequestCallbackDecorator extends IInlineSuggestionsRequestCallback.Stub { @NonNull private final IInlineSuggestionsRequestCallback mCallback; @NonNull private final String mImePackageName; private final int mImeDisplayId; @NonNull private final IBinder mImeToken; @NonNull private final InputMethodManagerService mImms; InlineSuggestionsRequestCallbackDecorator( @NonNull IInlineSuggestionsRequestCallback callback, @NonNull String imePackageName, int displayId, @NonNull IBinder imeToken, @NonNull InputMethodManagerService imms) { int displayId, @NonNull IBinder imeToken) { mCallback = callback; mImePackageName = imePackageName; mImeDisplayId = displayId; mImeToken = imeToken; mImms = imms; } @Override Loading @@ -195,7 +210,12 @@ final class AutofillSuggestionsController { + "]."); } request.setHostDisplayId(mImeDisplayId); mImms.setCurHostInputToken(mImeToken, request.getHostInputToken()); synchronized (ImfLock.class) { final IBinder curImeToken = mService.getCurTokenLocked(); if (mImeToken == curImeToken) { mCurHostInputToken = request.getHostInputToken(); } } mCallback.onInlineSuggestionsRequest(request, callback); } Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +7 −27 Original line number Diff line number Diff line Loading @@ -644,14 +644,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @MultiUserUnawareField private int mCurTokenDisplayId = INVALID_DISPLAY; /** * The host input token of the current active input method. */ @GuardedBy("ImfLock.class") @Nullable @MultiUserUnawareField private IBinder mCurHostInputToken; /** * The display ID of the input method indicates the fallback display which returned by * {@link #computeImeDisplayIdForTarget}. Loading Loading @@ -1839,21 +1831,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mAutofillController.performOnCreateInlineSuggestionsRequest(); } /** * Sets current host input token. * * @param callerImeToken the token has been made for the current active input method * @param hostInputToken the host input token of the current active input method */ void setCurHostInputToken(@NonNull IBinder callerImeToken, @Nullable IBinder hostInputToken) { synchronized (ImfLock.class) { if (!calledWithValidTokenLocked(callerImeToken)) { return; } mCurHostInputToken = hostInputToken; } } /** * Gets enabled subtypes of the specified {@link InputMethodInfo}. * Loading Loading @@ -2527,7 +2504,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT; updateSystemUiLocked(mImeWindowVis, mBackDisposition); mCurTokenDisplayId = INVALID_DISPLAY; mCurHostInputToken = null; mAutofillController.onResetSystemUi(); } @GuardedBy("ImfLock.class") Loading Loading @@ -5624,10 +5601,13 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. //TODO(b/150843766): Check if Input Token is valid. final IBinder curHostInputToken; synchronized (ImfLock.class) { if (displayId != mCurTokenDisplayId || mCurHostInputToken == null) { if (displayId != mCurTokenDisplayId) { return false; } curHostInputToken = mAutofillController.getCurHostInputToken(); if (curHostInputToken == null) { return false; } curHostInputToken = mCurHostInputToken; } return mInputManagerInternal.transferTouchGesture(sourceInputToken, curHostInputToken); } Loading Loading @@ -5949,7 +5929,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. + userData.mBindingController.isVisibleBound()); p.println(" mCurToken=" + getCurTokenLocked()); p.println(" mCurTokenDisplayId=" + mCurTokenDisplayId); p.println(" mCurHostInputToken=" + mCurHostInputToken); p.println(" mCurHostInputToken=" + mAutofillController.getCurHostInputToken()); p.println(" mCurIntent=" + getCurIntentLocked()); method = getCurMethodLocked(); p.println(" mCurMethod=" + getCurMethodLocked()); Loading Loading
services/core/java/com/android/server/inputmethod/AutofillSuggestionsController.java +27 −7 Original line number Diff line number Diff line Loading @@ -40,6 +40,13 @@ final class AutofillSuggestionsController { @NonNull private final InputMethodManagerService mService; /** * The host input token of the input method that is currently associated with this controller. */ @GuardedBy("ImfLock.class") @Nullable private IBinder mCurHostInputToken; private static final class CreateInlineSuggestionsRequest { @NonNull final InlineSuggestionsRequestInfo mRequestInfo; @NonNull final IInlineSuggestionsRequestCallback mCallback; Loading Loading @@ -77,6 +84,17 @@ final class AutofillSuggestionsController { mService = service; } @GuardedBy("ImfLock.class") void onResetSystemUi() { mCurHostInputToken = null; } @Nullable @GuardedBy("ImfLock.class") IBinder getCurHostInputToken() { return mCurHostInputToken; } @GuardedBy("ImfLock.class") void onCreateInlineSuggestionsRequest(@UserIdInt int userId, InlineSuggestionsRequestInfo requestInfo, IInlineSuggestionsRequestCallback callback, Loading Loading @@ -124,8 +142,7 @@ final class AutofillSuggestionsController { mPendingInlineSuggestionsRequest.mCallback, mPendingInlineSuggestionsRequest.mPackageName, mService.getCurTokenDisplayIdLocked(), mService.getCurTokenLocked(), mService); mService.getCurTokenLocked()); curMethod.onCreateInlineSuggestionsRequest( mPendingInlineSuggestionsRequest.mRequestInfo, callback); } else { Loading Loading @@ -161,22 +178,20 @@ final class AutofillSuggestionsController { * The decorator which validates the host package name in the * {@link InlineSuggestionsRequest} argument to make sure it matches the IME package name. */ private static final class InlineSuggestionsRequestCallbackDecorator private final class InlineSuggestionsRequestCallbackDecorator extends IInlineSuggestionsRequestCallback.Stub { @NonNull private final IInlineSuggestionsRequestCallback mCallback; @NonNull private final String mImePackageName; private final int mImeDisplayId; @NonNull private final IBinder mImeToken; @NonNull private final InputMethodManagerService mImms; InlineSuggestionsRequestCallbackDecorator( @NonNull IInlineSuggestionsRequestCallback callback, @NonNull String imePackageName, int displayId, @NonNull IBinder imeToken, @NonNull InputMethodManagerService imms) { int displayId, @NonNull IBinder imeToken) { mCallback = callback; mImePackageName = imePackageName; mImeDisplayId = displayId; mImeToken = imeToken; mImms = imms; } @Override Loading @@ -195,7 +210,12 @@ final class AutofillSuggestionsController { + "]."); } request.setHostDisplayId(mImeDisplayId); mImms.setCurHostInputToken(mImeToken, request.getHostInputToken()); synchronized (ImfLock.class) { final IBinder curImeToken = mService.getCurTokenLocked(); if (mImeToken == curImeToken) { mCurHostInputToken = request.getHostInputToken(); } } mCallback.onInlineSuggestionsRequest(request, callback); } Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +7 −27 Original line number Diff line number Diff line Loading @@ -644,14 +644,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @MultiUserUnawareField private int mCurTokenDisplayId = INVALID_DISPLAY; /** * The host input token of the current active input method. */ @GuardedBy("ImfLock.class") @Nullable @MultiUserUnawareField private IBinder mCurHostInputToken; /** * The display ID of the input method indicates the fallback display which returned by * {@link #computeImeDisplayIdForTarget}. Loading Loading @@ -1839,21 +1831,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mAutofillController.performOnCreateInlineSuggestionsRequest(); } /** * Sets current host input token. * * @param callerImeToken the token has been made for the current active input method * @param hostInputToken the host input token of the current active input method */ void setCurHostInputToken(@NonNull IBinder callerImeToken, @Nullable IBinder hostInputToken) { synchronized (ImfLock.class) { if (!calledWithValidTokenLocked(callerImeToken)) { return; } mCurHostInputToken = hostInputToken; } } /** * Gets enabled subtypes of the specified {@link InputMethodInfo}. * Loading Loading @@ -2527,7 +2504,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mBackDisposition = InputMethodService.BACK_DISPOSITION_DEFAULT; updateSystemUiLocked(mImeWindowVis, mBackDisposition); mCurTokenDisplayId = INVALID_DISPLAY; mCurHostInputToken = null; mAutofillController.onResetSystemUi(); } @GuardedBy("ImfLock.class") Loading Loading @@ -5624,10 +5601,13 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. //TODO(b/150843766): Check if Input Token is valid. final IBinder curHostInputToken; synchronized (ImfLock.class) { if (displayId != mCurTokenDisplayId || mCurHostInputToken == null) { if (displayId != mCurTokenDisplayId) { return false; } curHostInputToken = mAutofillController.getCurHostInputToken(); if (curHostInputToken == null) { return false; } curHostInputToken = mCurHostInputToken; } return mInputManagerInternal.transferTouchGesture(sourceInputToken, curHostInputToken); } Loading Loading @@ -5949,7 +5929,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. + userData.mBindingController.isVisibleBound()); p.println(" mCurToken=" + getCurTokenLocked()); p.println(" mCurTokenDisplayId=" + mCurTokenDisplayId); p.println(" mCurHostInputToken=" + mCurHostInputToken); p.println(" mCurHostInputToken=" + mAutofillController.getCurHostInputToken()); p.println(" mCurIntent=" + getCurIntentLocked()); method = getCurMethodLocked(); p.println(" mCurMethod=" + getCurMethodLocked()); Loading