Skip to content

Commit

Permalink
Reland "Do not count as paste when setIgnoreTextChangesForAutocomplet…
Browse files Browse the repository at this point in the history
…e is called"

This is a reland of commit bc664c9

We cannot guarantee the pedal is offered when we type "open incog" in the
test, so test is flaky.
I think that we cannot guarantee that action button is offered, or what
action button will offer to us, so I removed the test.
Since this is a RBS bug, we can land the fix now, and add the test in a
follow up.

Original change's description:
> Do not count as paste when setIgnoreTextChangesForAutocomplete is called
>
> When AutocompleteEditText#mIgnoreTextChangesForAutocomplete is set to
> true, we should not do anything for sanitizing the text.
>
> Bug: 1316248
> Change-Id: I99569055aee88df927082bf39cc1649e578a6536
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3587308
> Reviewed-by: Tomasz Wiszkowski <ender@google.com>
> Commit-Queue: Gang Wu <gangwu@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#992788}

(cherry picked from commit 92c8327)

Bug: 1316248
Change-Id: Id383612e6cc1de7a9774074a4c0a119784e03cb7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3588034
Auto-Submit: Gang Wu <gangwu@chromium.org>
Reviewed-by: Tomasz Wiszkowski <ender@google.com>
Commit-Queue: Tomasz Wiszkowski <ender@google.com>
Cr-Original-Commit-Position: refs/heads/main@{#992970}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3591279
Commit-Queue: Gang Wu <gangwu@chromium.org>
Cr-Commit-Position: refs/branch-heads/5005@{#26}
Cr-Branched-From: 5b4d945-refs/heads/main@{#992738}
  • Loading branch information
Gang Wu authored and Chromium LUCI CQ committed Apr 19, 2022
1 parent 493c44d commit d3e09ed
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public void onTextChanged(CharSequence s, int start, int before, int count) {}

@Override
public void afterTextChanged(Editable editable) {
if (wasLastEditPaste()) {
if (wasLastEditPaste() && !mIgnoreTextChangesForAutocomplete) {
mOnSanitizing = true;
String text = editable.toString();
String sanitizedText = sanitizeTextForPaste(text);
Expand Down Expand Up @@ -243,7 +243,8 @@ protected void onTextChanged(CharSequence text, int start, int lengthBefore, int
// If AutocompleteEditText receives a series of keystrokes(more than 1) from the beginning,
// the input will be considered as paste. We do this because some IME may paste the text as
// a series of keystrokes, not from the system copy/paste method.
mLastEditWasPaste = (start == 0 && (lengthAfter - lengthBefore) > 1 && !mOnSanitizing);
mLastEditWasPaste = (start == 0 && (lengthAfter - lengthBefore) > 1 && !mOnSanitizing
&& !mIgnoreTextChangesForAutocomplete);

if (mModel != null) mModel.onTextChanged(text, start, lengthBefore, lengthAfter);
}
Expand Down

0 comments on commit d3e09ed

Please sign in to comment.