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

Commit 6108847a authored by Adam He's avatar Adam He Committed by Automerger Merge Worker
Browse files

Merge "Don't start new inline autofill flow if one started already." into...

Merge "Don't start new inline autofill flow if one started already." into rvc-dev am: 954c18bd am: 62593ce4

Change-Id: I96add766d99584b677eaa87d22b16acddab40efe
parents 9a8414e3 62593ce4
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
        @GuardedBy("mLock")
        private CountDownLatch mCountDownLatch = new CountDownLatch(0);

        @Nullable Consumer<InlineSuggestionsRequest> newAutofillRequestLocked(
        @Nullable Consumer<InlineSuggestionsRequest> newAutofillRequestLocked(ViewState viewState,
                boolean isInlineRequest) {
            mCountDownLatch = new CountDownLatch(isInlineRequest ? 2 : 1);
            mPendingFillRequest = null;
@@ -338,6 +338,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                    mPendingInlineSuggestionsRequest = inlineSuggestionsRequest;
                    mCountDownLatch.countDown();
                    maybeRequestFillLocked();
                    viewState.resetState(ViewState.STATE_PENDING_CREATE_INLINE_REQUEST);
                }
            } : null;
        }
@@ -716,18 +717,23 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                mService.getRemoteInlineSuggestionRenderServiceLocked();
        if (isInlineSuggestionsEnabledByAutofillProviderLocked() && remoteRenderService != null) {
            Consumer<InlineSuggestionsRequest> inlineSuggestionsRequestConsumer =
                    mAssistReceiver.newAutofillRequestLocked(/*isInlineRequest=*/ true);
                    mAssistReceiver.newAutofillRequestLocked(viewState,
                            /*isInlineRequest=*/ true);
            if (inlineSuggestionsRequestConsumer != null) {
                final AutofillId focusedId = mCurrentViewId;
                remoteRenderService.getInlineSuggestionsRendererInfo(
                        new RemoteCallback((extras) -> {
                            synchronized (mLock) {
                                mInlineSessionController.onCreateInlineSuggestionsRequestLocked(
                                        focusedId, inlineSuggestionsRequestConsumer, extras);
                            }
                ));
                        }, mHandler)
                );
                viewState.setState(ViewState.STATE_PENDING_CREATE_INLINE_REQUEST);
            }
        } else {
            mAssistReceiver.newAutofillRequestLocked(/*isInlineRequest=*/ false);
            mAssistReceiver.newAutofillRequestLocked(viewState,
                    /*isInlineRequest=*/ false);
        }

        // Now request the assist structure data.
@@ -2368,7 +2374,9 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
     */
    @GuardedBy("mLock")
    private boolean shouldStartNewPartitionLocked(@NonNull AutofillId id) {
        if (mResponses == null) {
        final ViewState currentView = mViewStates.get(id);
        if (mResponses == null && currentView != null
                && (currentView.getState() & ViewState.STATE_PENDING_CREATE_INLINE_REQUEST) == 0) {
            return true;
        }

+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ final class ViewState {
    public static final int STATE_CHAR_REMOVED = 0x4000;
    /** Showing inline suggestions is not allowed for this View. */
    public static final int STATE_INLINE_DISABLED = 0x8000;
    /** The View is waiting for an inline suggestions request from IME.*/
    public static final int STATE_PENDING_CREATE_INLINE_REQUEST = 0x10000;

    public final AutofillId id;