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

Commit 0257c8a5 authored by Felipe Leme's avatar Felipe Leme
Browse files

Fixed missing auto-fill save callbacks on TextView.

It was accidentally broken during a previous commit where the CTS test
failure was ignored by a known issue being fixed in another change -
this change fixes both problems.

Bug: 33550221
Bug: 3380254
Test: CtsAutoFillServiceTestCases pass (for real now :-)
Change-Id: I5b2aa6060995ca255e51d85aa6ec93a886fa522f
parent 5882c4f5
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -5220,6 +5220,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

        if (needEditableForNotification) {
            sendAfterTextChanged((Editable) text);
        } else {
            // Always notify AutoFillManager - it will return right away if auto-fill is disabled.
            notifyAutoFillManagerAfterTextChanged();
        }

        // SelectionModifierCursorController depends on textCanBeSelected, which depends on text
@@ -9112,15 +9115,19 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
        }

        // Always notify AutoFillManager - it will return right away if auto-fill is disabled.
        notifyAutoFillManagerAfterTextChanged();

        hideErrorIfUnchanged();
    }

    private void notifyAutoFillManagerAfterTextChanged() {
        final AutoFillManager afm = mContext.getSystemService(AutoFillManager.class);
        if (afm != null) {
            if (DEBUG_AUTOFILL) {
                Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + text);
                Log.v(LOG_TAG, "sendAfterTextChanged(): notify AFM for text=" + mText);
            }
            afm.valueChanged(TextView.this);
        }

        hideErrorIfUnchanged();
    }

    void updateAfterEdit() {
+1 −1
Original line number Diff line number Diff line
@@ -726,7 +726,7 @@ final class AutoFillManagerServiceImpl {
                        Slog.d(TAG, "finishSessionLocked(): found a change on " + id + ": "
                                + state.mAutoFillValue);
                    }
                    mUi.showSaveUi();
                    getUiForShowing().showSaveUi();
                    return;
                }
            }
+5 −3
Original line number Diff line number Diff line
@@ -75,9 +75,11 @@ final class AutoFillUI {

    void setCallbackLocked(AutoFillUiCallback callback, IBinder activityToken) {
        mHandler.post(() -> {
            if (callback != mCallback && activityToken != mActivityToken) {
                hideAllUiThread();
                mCallback = callback;
                mActivityToken = activityToken;
            }
        });
    }