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

Commit 954c18bd authored by Adam He's avatar Adam He Committed by Android (Google) Code Review
Browse files

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

parents ceb2befc ce5c8023
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;