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

Commit 8dca7270 authored by Adam He's avatar Adam He
Browse files

Add missing cases where empty suggestions should be sent to IME.

1. When regular autofill returned null and augmented autofill is
disabled by password. (regular disabled augmented autofill case is
handled by session being destroyed).
2. If the response contains empty/null datasets or service disabled
autofill when response is received by frameworks.

Bug: 159364411
Test: atest InlineLoginActivityTest
Change-Id: Ic0758e757eacd277a5bf43080fe4db82d603953e
parent 26dfdc58
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -982,6 +982,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                || disableDuration > 0) {
                || disableDuration > 0) {
            // Response is "empty" from an UI point of view, need to notify client.
            // Response is "empty" from an UI point of view, need to notify client.
            notifyUnavailableToClient(sessionFinishedState, /* autofillableIds= */ null);
            notifyUnavailableToClient(sessionFinishedState, /* autofillableIds= */ null);
            synchronized (mLock) {
                mInlineSessionController.setInlineFillUiLocked(
                        InlineFillUi.emptyUi(mCurrentViewId));
            }
        }
        }


        if (requestLog != null) {
        if (requestLog != null) {
@@ -3084,12 +3088,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
            notifyUnavailableToClient(AutofillManager.STATE_FINISHED, autofillableIds);
            notifyUnavailableToClient(AutofillManager.STATE_FINISHED, autofillableIds);
            removeSelf();
            removeSelf();
        } else {
        } else {
            if (sVerbose) {
            if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) {
            if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) {
                if (sVerbose) {
                    Slog.v(TAG, "keeping session " + id + " when service returned null and "
                    Slog.v(TAG, "keeping session " + id + " when service returned null and "
                            + "augmented service is disabled for password fields. "
                            + "augmented service is disabled for password fields. "
                            + "AutofillableIds: " + autofillableIds);
                            + "AutofillableIds: " + autofillableIds);
                }
                mInlineSessionController.hideInlineSuggestionsUiLocked(mCurrentViewId);
            } else {
            } else {
                if (sVerbose) {
                    Slog.v(TAG, "keeping session " + id + " when service returned null but "
                    Slog.v(TAG, "keeping session " + id + " when service returned null but "
                            + "it can be augmented. AutofillableIds: " + autofillableIds);
                            + "it can be augmented. AutofillableIds: " + autofillableIds);
                }
                }
@@ -3115,7 +3122,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
    // non-null response but without datasets (for example, just SaveInfo)
    // non-null response but without datasets (for example, just SaveInfo)
    @GuardedBy("mLock")
    @GuardedBy("mLock")
    private Runnable triggerAugmentedAutofillLocked(int flags) {
    private Runnable triggerAugmentedAutofillLocked(int flags) {
        // (TODO: b/141703197) Fix later by passing info to service.
        // TODO: (b/141703197) Fix later by passing info to service.
        if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) {
        if ((flags & FLAG_PASSWORD_INPUT_TYPE) != 0) {
            return null;
            return null;
        }
        }
@@ -3160,7 +3167,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                        + ComponentName.flattenToShortString(mComponentName) + " not whitelisted ");
                        + ComponentName.flattenToShortString(mComponentName) + " not whitelisted ");
            }
            }
            logAugmentedAutofillRequestLocked(mode, remoteService.getComponentName(),
            logAugmentedAutofillRequestLocked(mode, remoteService.getComponentName(),
                    mCurrentViewId, isWhitelisted, /*isInline*/null);
                    mCurrentViewId, isWhitelisted, /* isInline= */ null);
            return null;
            return null;
        }
        }