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

Commit 6867e704 authored by Felipe Leme's avatar Felipe Leme
Browse files

Updated SmartSuggestions coordinates when focused field changed.

Test: manual verification
Fixes: 120931578

Change-Id: I6a7ad2b49630a9393136d7420789677e0dcf9a6a
parent f5918914
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -254,6 +254,15 @@ public abstract class AugmentedAutofillService extends Service {
        @GuardedBy("mLock")
        private AutofillValue mFocusedValue;

        /**
         * Id of the last field that cause the Autofill UI to be shown.
         *
         * <p>Used to make sure the SmartSuggestionsParams is updated when a new fields is focused.
         */
        // TODO(b/111330312): might not be needed when using IME
        @GuardedBy("mLock")
        private AutofillId mLastShownId;

        // Objects used to log metrics
        private final long mRequestTime;
        private long mOnSuccessTime;
@@ -284,7 +293,7 @@ public abstract class AugmentedAutofillService extends Service {
        @NonNull
        public SystemPopupPresentationParams getSmartSuggestionParams() {
            synchronized (mLock) {
                if (mSmartSuggestion != null) {
                if (mSmartSuggestion != null && mFocusedId.equals(mLastShownId)) {
                    return mSmartSuggestion;
                }
                Rect rect;
@@ -299,6 +308,7 @@ public abstract class AugmentedAutofillService extends Service {
                    return null;
                }
                mSmartSuggestion = new SystemPopupPresentationParams(this, rect);
                mLastShownId = mFocusedId;
                return mSmartSuggestion;
            }
        }
@@ -401,6 +411,9 @@ public abstract class AugmentedAutofillService extends Service {
            if (mFocusedValue != null) {
                pw.print(prefix); pw.print("focusedValue: "); pw.println(mFocusedValue);
            }
            if (mLastShownId != null) {
                pw.print(prefix); pw.print("lastShownId: "); pw.println(mLastShownId);
            }
            pw.print(prefix); pw.print("client: "); pw.println(mClient);
            final String prefix2 = prefix + "  ";
            if (mFillWindow != null) {