From 35ea763042ba20f762cb99926cccc5f6b2a15171 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Tue, 29 Jan 2019 16:13:30 -0800 Subject: [PATCH] Removed unused flag from notifyTextChanged(). (and also fixed typo on hidden constant) Test: m update-api Test: atest CtsContentCaptureServiceTestCases Fixes: 123598012 Change-Id: I63ccb60cf8eebe6b5ef6d7961dbb0ac8be088eda --- api/current.txt | 2 +- core/java/android/view/View.java | 2 +- .../view/contentcapture/ContentCaptureSession.java | 10 ++++------ .../view/contentcapture/MainContentCaptureSession.java | 4 ++-- core/java/android/widget/TextView.java | 2 +- .../view/contentcapture/ContentCaptureSessionTest.java | 2 +- 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/api/current.txt b/api/current.txt index fa147db76e648..c86778b43de34 100644 --- a/api/current.txt +++ b/api/current.txt @@ -52845,7 +52845,7 @@ package android.view.contentcapture { method @NonNull public final android.view.ViewStructure newVirtualViewStructure(@NonNull android.view.autofill.AutofillId, long); method public final void notifyViewAppeared(@NonNull android.view.ViewStructure); method public final void notifyViewDisappeared(@NonNull android.view.autofill.AutofillId); - method public final void notifyViewTextChanged(@NonNull android.view.autofill.AutofillId, @Nullable CharSequence, int); + method public final void notifyViewTextChanged(@NonNull android.view.autofill.AutofillId, @Nullable CharSequence); method public final void notifyViewsDisappeared(@NonNull android.view.autofill.AutofillId, @NonNull long[]); } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a17a188071ec9..519181d364c2f 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8210,7 +8210,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * changed by calling * {@link ContentCaptureSession#notifyViewAppeared(ViewStructure)}, * {@link ContentCaptureSession#notifyViewDisappeared(AutofillId)}, and - * {@link ContentCaptureSession#notifyViewTextChanged(AutofillId, CharSequence, int)} + * {@link ContentCaptureSession#notifyViewTextChanged(AutofillId, CharSequence)} * respectively. The structure for the a child must be created using * {@link ContentCaptureSession#newVirtualViewStructure(AutofillId, long)}, and the * {@code autofillId} for a child can be obtained either through diff --git a/core/java/android/view/contentcapture/ContentCaptureSession.java b/core/java/android/view/contentcapture/ContentCaptureSession.java index c425e7bd37003..7b8fb9c3bce4d 100644 --- a/core/java/android/view/contentcapture/ContentCaptureSession.java +++ b/core/java/android/view/contentcapture/ContentCaptureSession.java @@ -54,7 +54,7 @@ public abstract class ContentCaptureSession implements AutoCloseable { * @hide */ // NOTE: not prefixed by STATE_ so it's not printed on getStateAsString() - public static final int UNKNWON_STATE = 0x0; + public static final int UNKNOWN_STATE = 0x0; /** * Service's startSession() was called, but server didn't confirm it was created yet. @@ -159,7 +159,7 @@ public abstract class ContentCaptureSession implements AutoCloseable { @Nullable protected final String mId; - private int mState = UNKNWON_STATE; + private int mState = UNKNOWN_STATE; // Lazily created on demand. private ContentCaptureSessionId mContentCaptureSessionId; @@ -349,10 +349,8 @@ public abstract class ContentCaptureSession implements AutoCloseable { * * @param id of the node. * @param text new text. - * @param flags currently ignored. */ - public final void notifyViewTextChanged(@NonNull AutofillId id, @Nullable CharSequence text, - int flags) { + public final void notifyViewTextChanged(@NonNull AutofillId id, @Nullable CharSequence text) { Preconditions.checkNotNull(id); if (!isContentCaptureEnabled()) return; @@ -438,7 +436,7 @@ public abstract class ContentCaptureSession implements AutoCloseable { /** @hide */ @NonNull protected static String getStateAsString(int state) { - return state + " (" + (state == UNKNWON_STATE ? "UNKNOWN" + return state + " (" + (state == UNKNOWN_STATE ? "UNKNOWN" : DebugUtils.flagsToString(ContentCaptureSession.class, "STATE_", state)) + ")"; } diff --git a/core/java/android/view/contentcapture/MainContentCaptureSession.java b/core/java/android/view/contentcapture/MainContentCaptureSession.java index 72aefb20f2cb8..2eca51f61e91f 100644 --- a/core/java/android/view/contentcapture/MainContentCaptureSession.java +++ b/core/java/android/view/contentcapture/MainContentCaptureSession.java @@ -115,7 +115,7 @@ public final class MainContentCaptureSession extends ContentCaptureSession { @Nullable private DeathRecipient mDirectServiceVulture; - private int mState = UNKNWON_STATE; + private int mState = UNKNOWN_STATE; @Nullable private IBinder mApplicationToken; @@ -367,7 +367,7 @@ public final class MainContentCaptureSession extends ContentCaptureSession { } private boolean handleHasStarted() { - return mState != UNKNWON_STATE; + return mState != UNKNOWN_STATE; } private void handleScheduleFlush(@FlushReason int reason, boolean checkExisting) { diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 780fe8d821d6d..2b45c0697155d 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -10275,7 +10275,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener final ContentCaptureSession session = getContentCaptureSession(); if (session != null) { // TODO(b/111276913): pass flags when edited by user / add CTS test - session.notifyViewTextChanged(getAutofillId(), getText(), /* flags= */ 0); + session.notifyViewTextChanged(getAutofillId(), getText()); } } } diff --git a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java index bfa6e062b08d4..71612e6859205 100644 --- a/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java +++ b/core/tests/coretests/src/android/view/contentcapture/ContentCaptureSessionTest.java @@ -78,7 +78,7 @@ public class ContentCaptureSessionTest { assertThrows(NullPointerException.class, () -> mSession1.notifyViewAppeared(null)); assertThrows(NullPointerException.class, () -> mSession1.notifyViewDisappeared(null)); assertThrows(NullPointerException.class, - () -> mSession1.notifyViewTextChanged(null, "whatever", 0)); + () -> mSession1.notifyViewTextChanged(null, "whatever")); } @Test